Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update readme #14

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
# afj-polygon-w3c-module
# Credo did:polygon W3C Module

- W3C did:polygon method registry for [credo-ts](https://github.com/openwallet-foundation/credo-ts).

## Usage

```ts
import { PolygonDidResolver, PolygonDidRegistrar, PolygonModule } from 'afj-polygon-w3c-module'

const agent = new Agent({
config: {
/* agent config */
},
dependencies,
modules: {
/* ... */
dids: new DidsModule({
resolvers: [ /* ... */, new PolygonDidResolver()],
registrars: [ /* ... */, new PolygonDidRegistrar()],
}),
/* ... */
polygon: new PolygonModule({
rpcUrl: 'rpcUrl' // polygon rpc url,
didContractAddress: 'didContractAddress' // polygon did contract address,
fileServerToken: 'fileServerToken' // polygon file server token to store schema json,
schemaManagerContractAddress: 'schemaManagerContractAddress' // polygon schema manager contract address,
serverUrl: 'serverUrl' // polygon file server url,
}),
})
```
3 changes: 2 additions & 1 deletion src/dids/didPolygonUtil.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { DidCreateResult, DidDocument } from '@aries-framework/core'

import { VERIFICATION_METHOD_TYPE_ECDSA_SECP256K1_VERIFICATION_KEY_2019 } from '@aries-framework/core'
import { computeAddress } from 'ethers'

export const VERIFICATION_METHOD_TYPE_ECDSA_SECP256K1_VERIFICATION_KEY_2019 = 'EcdsaSecp256k1VerificationKey2019'

export const polygonDidRegex = new RegExp(/^did:polygon(:testnet)?:0x[0-9a-fA-F]{40}$/)

export const isValidPolygonDid = (did: string) => polygonDidRegex.test(did)
Expand Down
Loading