Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
shamilovtim committed Dec 1, 2023
1 parent 9aa2d51 commit 1c71b96
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions packages/identity-agent/README.md
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 });
```

0 comments on commit 1c71b96

Please sign in to comment.