The DidIonUtils class provides utility functions to support operations in the DID ION method.

Constructors

Methods

  • Appends a specified path to a base URL, ensuring proper formatting of the resulting URL.

    This method is useful for constructing URLs for accessing various endpoints, such as Sidetree nodes in the ION network. It handles the nuances of URL path concatenation, including the addition or removal of leading/trailing slashes, to create a well-formed URL.

    Parameters

    • params: {
          baseUrl: string;
          path: string;
      }

      The parameters for URL construction.

      • baseUrl: string

        The base URL to which the path will be appended.

      • path: string

        The path to append to the base URL.

    Returns string

    The fully constructed URL string with the path appended to the base URL.

  • Computes the Long Form DID URI given an ION DID's recovery key, update key, services, and verification methods.

    Parameters

    • params: {
          recoveryKey: Jwk;
          services: DidService[];
          updateKey: Jwk;
          verificationMethods: DidIonVerificationMethod[];
      }

      The parameters for computing the Long Form DID URI.

      • recoveryKey: Jwk

        The ION Recovery Key.

      • services: DidService[]

        An array of services associated with the DID.

      • updateKey: Jwk

        The ION Update Key.

      • verificationMethods: DidIonVerificationMethod[]

        An array of verification methods associated with the DID.

    Returns Promise<string>

    A Promise resolving to the Long Form DID URI.

  • Constructs a Sidetree Create Operation request for a DID document within the ION network.

    This method prepares the necessary payload for submitting a Create Operation to a Sidetree node, encapsulating the details of the DID document, recovery key, and update key.

    Parameters

    • params: {
          ionDocument: default;
          recoveryKey: Jwk;
          updateKey: Jwk;
      }

      Parameters required to construct the Create Operation request.

      • ionDocument: default

        The DID document model containing public keys and service endpoints.

      • recoveryKey: Jwk

        The recovery public key in JWK format.

      • updateKey: Jwk

        The update public key in JWK format.

    Returns Promise<DidIonCreateRequest>

    A promise resolving to the ION Create Operation request model, ready for submission to a Sidetree node.

  • Assembles an ION document model from provided services and verification methods

    This model serves as the foundation for a DID document in the ION network, facilitating the creation and management of decentralized identities. It translates service endpoints and public keys into a format compatible with the Sidetree protocol, ensuring the resulting DID document adheres to the required specifications for ION DIDs. This method is essential for constructing the payload needed to register or update DIDs within the ION network.

    Parameters

    • params: {
          services: DidService[];
          verificationMethods: DidIonVerificationMethod[];
      }

      The parameters containing the services and verification methods to include in the ION document.

      • services: DidService[]

        A list of service endpoints to be included in the DID document, specifying ways to interact with the DID subject.

      • verificationMethods: DidIonVerificationMethod[]

        A list of verification methods to be included, detailing the cryptographic keys and their intended uses within the DID document.

    Returns Promise<default>

    A Promise resolving to an IonDocumentModel, ready for use in Sidetree operations like DID creation and updates.

  • Normalize the given JWK to include only specific members and in lexicographic order.

    Parameters

    • jwk: Jwk

      The JWK to normalize.

    Returns Jwk

    The normalized JWK.