Skip to content

Commit

Permalink
chore: updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Brummos committed Oct 9, 2024
1 parent 0b3c5f5 commit 17aad52
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions packages/resource-resolver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,78 @@

---

A Veramo resource resolver plugin. This plugin has the option to cache resources and fetch them from a storage.

## Available functions

- resourceResolve
- resourceClearAllResources
- resourceDefaultStoreId
- resourceDefaultNamespace
- resourceDefaultTtl
-
## Usage

```typescript
import { ResourceResolver } from '@sphereon/ssi-sdk.resource-resolver'
import { KeyValueStoreEntity, kvStoreMigrations, KeyValueStore } from '@sphereon/ssi-sdk.kv-store-temp'

const dbConnection = createConnection({
type: 'react-native',
database: 'app.sqlite',
location: 'default',
logging: false,
synchronize: false,
migrationsRun: true,
migrations: kvStoreMigrations,
entities: [KeyValueStoreEntity],
})

const agent = createAgent<IContactManager>({
plugins: [
new ResourceResolver({
resourceStores: new KeyValueStore({
store: new KeyValueTypeORMStoreAdapter({ dbConnection })
}),
}),
],
})
```

### Resolve a resource:

```typescript
const response = await agent.resourceResolve({
input: 'https://example.com/example_resource.jpg',
resourceType: 'example_type',
})
```

### Clear all resources:

```typescript
const storeId = '3c0e6c59-fe47-433c-a3d2-ad18b9c83517'
const result = await agent.resourceClearAllResources({ storeId })
```

### Get default store id:

```typescript
const result = await agent.resourceDefaultStoreId()
```

### Get default namespace:

```typescript
const result = await agent.resourceDefaultNamespace()
```

### Get default ttl:

```typescript
const result = await agent.resourceDefaultTtl()
```

## Installation

```shell
Expand Down

0 comments on commit 17aad52

Please sign in to comment.