Skip to content

animo/afj-universal-resolver

Repository files navigation

Animo Logo

Univeral Resolver integration for Aries Framework JavaScript

Powered by   Animo Logo


Getting started  |  Usage  |  Contributing  |  License


Getting Started

Yarn
yarn add @animo-id/afj-universal-resolver

Usage

NOTE: it is recommended to use a self-hosted universal resolver and only use the development hosted one for development.

import { UniversalDidResolver } from "@animo-id/afj-universal-resolver"
import { agentDependencies } from "@aries-framework/node"
import { Agent, DidsModule } from "@aries-framework/core"
import { AskarModule } from "@aries-framework/askar"
import { ariesAskar } from "@hyperledger/aries-askar-nodejs"

const devUniResolverUrl = "https://dev.uniresolver.io/1.0"
const didKey =
  "did:key:z4MXj1wBzi9jUstyPMS4jQqB6KdJaiatPkAtVtGc6bQEQEEsKTic4G7Rou3iBf9vPmT5dbkm9qsZsuVNjq8HCuW1w24nhBFGkRE4cd2Uf2tfrB3N7h4mnyPp1BF3ZttHTYv3DLUPi1zMdkULiow3M1GfXkoC6DoxDUm1jmN6GBj22SjVsr6dxezRVQc7aj9TxE7JLbMH1wh5X3kA58H3DFW8rnYMakFGbca5CB2Jf6CnGQZmL7o5uJAdTwXfy2iiiyPxXEGerMhHwhjTA1mKYobyk2CpeEcmvynADfNZ5MBvcCS7m3XkFCMNUYBS9NQ3fze6vMSUPsNa6GVYmKx2x6JrdEjCk3qRMMmyjnjCMfR4pXbRMZa3i"

const uni = await UniversalDidResolver.initializeWithDynamicMethods(
  agentDependencies,
  `${devUniResolverUrl}/methods`,
  `${devUniResolverUrl}/identifiers`
)

const agent = new Agent({
  config: {
    label: "my-agent",
    walletConfig: { id: "some-id", key: "some-key" }
  },
  modules: {
    askar: new AskarModule({ ariesAskar }),
    dids: new DidsModule({ resolvers: [uni] })
  },
  dependencies: agentDependencies
})

await agent.initialize()

const { didDocument } = await agent.dids.resolve(didKey)

Contributing

Is there something you'd like to fix or add? Great, we love community contributions! To get involved, please follow our contribution guidelines.

License

Apache 2.0

About

Universal Resolver integration for AFJ

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published