generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9aa2d51
commit 1c71b96
Showing
1 changed file
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,26 @@ | ||
<!-- TODO: This is just a start. Will add a better description eventually. --> | ||
|
||
## Description | ||
|
||
This package implements the building blocks in `@web5/agent` in order to provide a minimum implementation of an Identity Agent. | ||
This package provides an implementation of a web5 agent using the building blocks in `@web5/agent`. | ||
|
||
While similar to `@web5/user-agent`, this package differs by not using IndexedDB for the DID Resolution Cache (detailed below). Use `@web5/user-agent` on web platforms with IndexedDB access. For platforms without IndexedDB access (e.g., React Native), this package is more suitable. | ||
|
||
## Implementation | ||
|
||
Start by examining the self-documenting [identity-agent.ts](./src/identity-agent.ts) file. | ||
|
||
#### DidResolver | ||
|
||
If you do not supply a `DidResolver`, the agent defaults to an unpersisted in-memory cache. For larger production applications, supply `create` with a custom `DidResolver` featuring a `cache` attribute, which should be a class implementing the `DidResolverCache` class. | ||
|
||
Browsers with IndexedDB access can utilize `DidResolverCacheLevel`. In such cases, using the `@web5/user-agent` package is recommended, as it employs this persistent cache by default. | ||
|
||
```typescript | ||
const didResolver = new DidResolver({ | ||
cache: new CustomDidResolverCache(), | ||
didResolvers: [DidIonMethod, DidKeyMethod], | ||
}); | ||
|
||
<!-- TODO: This is just a start. Will add a better description eventually. --> | ||
IdentityAgent.create({ didResolver }); | ||
``` |