Skip to content

Commit

Permalink
docs(did-resolver): update inline docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceanis committed Jun 8, 2022
1 parent 97a2ce1 commit 24b8ef4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
24 changes: 17 additions & 7 deletions packages/did-resolver/src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,24 @@ import {
parse as parseDID,
Resolvable,
} from 'did-resolver'

export { DIDDocument }
import Debug from 'debug'

const debug = Debug('veramo:resolver')

interface Options {
resolver: Resolvable
}

/**
* A Veramo Plugin that enables users to resolve DID documents.
*
* This plugin is used automatically by plugins that create or verify Verifiable Credentials or Presentations or when
* working with DIDComm
*
* @public
*/
export class DIDResolverPlugin implements IAgentPlugin {
readonly methods: IResolver
readonly schema = schema.IResolver
Expand All @@ -33,9 +43,9 @@ export class DIDResolverPlugin implements IAgentPlugin {

/** {@inheritDoc @veramo/core#IResolver.resolveDid} */
async resolveDid({
didUrl,
options,
}: {
didUrl,
options,
}: {
didUrl: string
options?: DIDResolutionOptions
}): Promise<DIDResolutionResult> {
Expand All @@ -62,10 +72,10 @@ export class DIDResolverPlugin implements IAgentPlugin {

/** {@inheritDoc @veramo/core#IResolver.getDIDComponentById} */
async getDIDComponentById({
didDocument,
didUrl,
section,
}: {
didDocument,
didUrl,
section,
}: {
didDocument: DIDDocument
didUrl: string
section?: DIDDocumentSection
Expand Down
12 changes: 9 additions & 3 deletions packages/did-resolver/src/universal-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ interface Options {

/**
* @deprecated please use `getUniresolver(url)` or `getUniresolverFor(methods, url)` instead
*
* @internal
*/
export class UniversalResolver {
constructor(options: Options) {
Expand All @@ -27,8 +29,10 @@ export class UniversalResolver {
* })
* ```
*
* @param url the URL for the universal resolver instance (See https://uniresolver.io )
* @param url - the URL for the universal resolver instance (See https://uniresolver.io )
* @returns `DIDResolver`
*
* @public
*/
export function getUniversalResolver(
url: string = 'https://dev.uniresolver.io/1.0/identifiers/',
Expand Down Expand Up @@ -62,9 +66,11 @@ export function getUniversalResolver(
* })
* ```
*
* @param methods an array of DID methods that should be resolved by this universal resolver
* @param url the URL for the universal resolver instance (See https://uniresolver.io )
* @param methods - an array of DID methods that should be resolved by this universal resolver
* @param url - the URL for the universal resolver instance (See https://uniresolver.io )
* @returns `Record<string, DIDResolver>` a mapping of the given methods to an instance of `DIDResolver`
*
* @public
*/
export function getUniversalResolverFor(
methods: string[],
Expand Down

0 comments on commit 24b8ef4

Please sign in to comment.