did-resolver

  • Version 4.1.0
  • Published
  • 131 kB
  • No dependencies
  • Apache-2.0 license

Install

npm i did-resolver
yarn add did-resolver
pnpm add did-resolver

Overview

Resolve DID documents

Index

Functions

function inMemoryCache

inMemoryCache: () => DIDCache;

    function noCache

    noCache: (
    parsed: ParsedDID,
    resolve: WrappedResolver
    ) => Promise<DIDResolutionResult>;

      function parse

      parse: (didUrl: string) => ParsedDID | null;
      • Parses a DID URL and builds a ParsedDID object

        Parameter didUrl

        the DID URL string to be parsed

        Returns

        a ParsedDID object, or null if the input is not a DID URL

      function wrapLegacyResolver

      wrapLegacyResolver: (resolve: LegacyDIDResolver) => DIDResolver;

        Classes

        class Resolver

        class Resolver implements Resolvable {}
        • This implementation of Resolvable bundles together multiple implementations of DIDResolver and presents a single function call to users.

        constructor

        constructor(registry?: ResolverRegistry, options?: ResolverOptions);

          method resolve

          resolve: (
          didUrl: string,
          options?: DIDResolutionOptions
          ) => Promise<DIDResolutionResult>;

            Interfaces

            interface ConditionWeightedThreshold

            interface ConditionWeightedThreshold {}

              property condition

              condition: VerificationMethod;

                property weight

                weight: number;

                  interface DIDDocumentMetadata

                  interface DIDDocumentMetadata extends Extensible {}

                  property canonicalId

                  canonicalId?: string;

                    property created

                    created?: string;

                      property deactivated

                      deactivated?: boolean;

                        property equivalentId

                        equivalentId?: string;

                          property nextUpdate

                          nextUpdate?: string;

                            property nextVersionId

                            nextVersionId?: string;

                              property updated

                              updated?: string;

                                property versionId

                                versionId?: string;

                                  interface DIDResolutionMetadata

                                  interface DIDResolutionMetadata extends Extensible {}

                                  property contentType

                                  contentType?: string;

                                    property error

                                    error?:
                                    | 'invalidDid'
                                    | 'notFound'
                                    | 'representationNotSupported'
                                    | 'unsupportedDidMethod'
                                    | string;

                                      interface DIDResolutionOptions

                                      interface DIDResolutionOptions extends Extensible {}

                                      property accept

                                      accept?: string;

                                        interface DIDResolutionResult

                                        interface DIDResolutionResult {}

                                        property '@context'

                                        '@context'?: 'https://w3id.org/did-resolution/v1' | string | string[];

                                          property didDocument

                                          didDocument: DIDDocument | null;

                                            property didDocumentMetadata

                                            didDocumentMetadata: DIDDocumentMetadata;

                                              property didResolutionMetadata

                                              didResolutionMetadata: DIDResolutionMetadata;

                                                interface JsonWebKey

                                                interface JsonWebKey extends Extensible {}
                                                • Encapsulates a JSON web key type that includes only the public properties that can be used in DID documents.

                                                  The private properties are intentionally omitted to discourage the use (and accidental disclosure) of private keys in DID documents.

                                                  See Also

                                                property alg

                                                alg?: string;

                                                  property crv

                                                  crv?: string;

                                                    property e

                                                    e?: string;

                                                      property ext

                                                      ext?: boolean;

                                                        property key_ops

                                                        key_ops?: string[];

                                                          property kid

                                                          kid?: string;

                                                            property kty

                                                            kty: string;

                                                              property n

                                                              n?: string;

                                                                property use

                                                                use?: string;

                                                                  property x

                                                                  x?: string;

                                                                    property y

                                                                    y?: string;

                                                                      interface LegacyResolverRegistry

                                                                      interface LegacyResolverRegistry {}

                                                                        index signature

                                                                        [index: string]: LegacyDIDResolver;

                                                                          interface Params

                                                                          interface Params {}
                                                                          • URI params resulting from parsing a DID URI

                                                                          index signature

                                                                          [index: string]: string;

                                                                            interface ParsedDID

                                                                            interface ParsedDID {}
                                                                            • An object containing the results of parsing a DID URI string.

                                                                              This is forwarded to implementations of particular DID resolvers when calling the resolve method.

                                                                              See Also

                                                                            property did

                                                                            did: string;

                                                                              property didUrl

                                                                              didUrl: string;

                                                                                property fragment

                                                                                fragment?: string;

                                                                                  property id

                                                                                  id: string;

                                                                                    property method

                                                                                    method: string;

                                                                                      property params

                                                                                      params?: Params;

                                                                                        property path

                                                                                        path?: string;

                                                                                          property query

                                                                                          query?: string;

                                                                                            interface Resolvable

                                                                                            interface Resolvable {}
                                                                                            • The method signature implemented by this resolver.

                                                                                            property resolve

                                                                                            resolve: (
                                                                                            didUrl: string,
                                                                                            options?: DIDResolutionOptions
                                                                                            ) => Promise<DIDResolutionResult>;

                                                                                              interface ResolverOptions

                                                                                              interface ResolverOptions {}

                                                                                                property cache

                                                                                                cache?: DIDCache | boolean | undefined;

                                                                                                  property legacyResolvers

                                                                                                  legacyResolvers?: LegacyResolverRegistry;

                                                                                                    interface Service

                                                                                                    interface Service {}

                                                                                                    property id

                                                                                                    id: string;

                                                                                                      property serviceEndpoint

                                                                                                      serviceEndpoint: ServiceEndpoint | ServiceEndpoint[];

                                                                                                        property type

                                                                                                        type: string;

                                                                                                          index signature

                                                                                                          [x: string]: any;

                                                                                                            interface VerificationMethod

                                                                                                            interface VerificationMethod {}

                                                                                                            property blockchainAccountId

                                                                                                            blockchainAccountId?: string;

                                                                                                              property conditionAnd

                                                                                                              conditionAnd?: VerificationMethod[];

                                                                                                                property conditionDelegated

                                                                                                                conditionDelegated?: string;

                                                                                                                  property conditionOr

                                                                                                                  conditionOr?: VerificationMethod[];

                                                                                                                    property conditionThreshold

                                                                                                                    conditionThreshold?: VerificationMethod[];

                                                                                                                      property conditionWeightedThreshold

                                                                                                                      conditionWeightedThreshold?: ConditionWeightedThreshold[];

                                                                                                                        property controller

                                                                                                                        controller: string;

                                                                                                                          property ethereumAddress

                                                                                                                          ethereumAddress?: string;

                                                                                                                            property id

                                                                                                                            id: string;

                                                                                                                              property publicKeyBase58

                                                                                                                              publicKeyBase58?: string;

                                                                                                                                property publicKeyBase64

                                                                                                                                publicKeyBase64?: string;

                                                                                                                                  property publicKeyHex

                                                                                                                                  publicKeyHex?: string;

                                                                                                                                    property publicKeyJwk

                                                                                                                                    publicKeyJwk?: JsonWebKey;

                                                                                                                                      property publicKeyMultibase

                                                                                                                                      publicKeyMultibase?: string;

                                                                                                                                        property relationshipChild

                                                                                                                                        relationshipChild?: string[];

                                                                                                                                          property relationshipParent

                                                                                                                                          relationshipParent?: string[];

                                                                                                                                            property relationshipSibling

                                                                                                                                            relationshipSibling?: string[];

                                                                                                                                              property threshold

                                                                                                                                              threshold?: number;

                                                                                                                                                property type

                                                                                                                                                type: string;

                                                                                                                                                  Type Aliases

                                                                                                                                                  type DIDCache

                                                                                                                                                  type DIDCache = (
                                                                                                                                                  parsed: ParsedDID,
                                                                                                                                                  resolve: WrappedResolver
                                                                                                                                                  ) => Promise<DIDResolutionResult>;

                                                                                                                                                    type DIDDocument

                                                                                                                                                    type DIDDocument = {
                                                                                                                                                    '@context'?: 'https://www.w3.org/ns/did/v1' | string | string[];
                                                                                                                                                    id: string;
                                                                                                                                                    alsoKnownAs?: string[];
                                                                                                                                                    controller?: string | string[];
                                                                                                                                                    verificationMethod?: VerificationMethod[];
                                                                                                                                                    service?: Service[];
                                                                                                                                                    /**
                                                                                                                                                    * @deprecated
                                                                                                                                                    */
                                                                                                                                                    publicKey?: VerificationMethod[];
                                                                                                                                                    } & {
                                                                                                                                                    [x in KeyCapabilitySection]?: (string | VerificationMethod)[];
                                                                                                                                                    };

                                                                                                                                                    type DIDResolver

                                                                                                                                                    type DIDResolver = (
                                                                                                                                                    did: string,
                                                                                                                                                    parsed: ParsedDID,
                                                                                                                                                    resolver: Resolvable,
                                                                                                                                                    options: DIDResolutionOptions
                                                                                                                                                    ) => Promise<DIDResolutionResult>;
                                                                                                                                                    • The DID resolution function that DID Resolver implementations must implement.

                                                                                                                                                    type Extensible

                                                                                                                                                    type Extensible = Record<string, any>;
                                                                                                                                                    • Defines an object type that can be extended with other properties.

                                                                                                                                                    type KeyCapabilitySection

                                                                                                                                                    type KeyCapabilitySection =
                                                                                                                                                    | 'authentication'
                                                                                                                                                    | 'assertionMethod'
                                                                                                                                                    | 'keyAgreement'
                                                                                                                                                    | 'capabilityInvocation'
                                                                                                                                                    | 'capabilityDelegation';

                                                                                                                                                    type LegacyDIDResolver

                                                                                                                                                    type LegacyDIDResolver = (
                                                                                                                                                    did: string,
                                                                                                                                                    parsed: ParsedDID,
                                                                                                                                                    resolver: Resolvable
                                                                                                                                                    ) => Promise<DIDDocument>;

                                                                                                                                                      type ResolverRegistry

                                                                                                                                                      type ResolverRegistry = Record<string, DIDResolver>;

                                                                                                                                                        type ServiceEndpoint

                                                                                                                                                        type ServiceEndpoint = string | Record<string, any>;

                                                                                                                                                        type WrappedResolver

                                                                                                                                                        type WrappedResolver = () => Promise<DIDResolutionResult>;

                                                                                                                                                          Package Files (1)

                                                                                                                                                          Dependencies (0)

                                                                                                                                                          No dependencies.

                                                                                                                                                          Dev Dependencies (18)

                                                                                                                                                          Peer Dependencies (0)

                                                                                                                                                          No peer dependencies.

                                                                                                                                                          Badge

                                                                                                                                                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/did-resolver.

                                                                                                                                                          • Markdown
                                                                                                                                                            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/did-resolver)
                                                                                                                                                          • HTML
                                                                                                                                                            <a href="https://www.jsdocs.io/package/did-resolver"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>