Class DidDhtApi

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final String methodName
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • create

        @JvmOverloads() final BearerDid create(KeyManager keyManager, CreateDidDhtOptions options)

        Creates a new "did:dht" DID, derived from an initial identity key, and stores the associated private key in the provided KeyManager.

        The method-specific identifier of a "did:dht" DID is a z-base-32 encoded public key.

        Note: By default, no additional keys or services are added to the document

        Parameters:
        keyManager - A KeyManager instance where the new key will be stored.
        options - Optional parameters (CreateDidDhtOptions) to specify additional keys, services, and optional publishing during creation.
        Returns:

        A DidDht instance representing the newly created "did:dht" DID.

      • create

        @JvmOverloads() final BearerDid create(KeyManager keyManager)

        Creates a new "did:dht" DID, derived from an initial identity key, and stores the associated private key in the provided KeyManager.

        The method-specific identifier of a "did:dht" DID is a z-base-32 encoded public key.

        Note: By default, no additional keys or services are added to the document

        Parameters:
        keyManager - A KeyManager instance where the new key will be stored.
        Returns:

        A DidDht instance representing the newly created "did:dht" DID.

      • resolve

         final DidResolutionResult resolve(String did)

        Resolves a "did:dht" DID into a DidResolutionResult, which contains the DID Document and possible related metadata.

        This implementation talks to a DID DHT gateway to retrieve the DID Document, which in turn takes the z-base-32 encoded identifier public key and uses it to retrieve the DID Document from the DHT. Next, the Pkarr response is parsed, and used to reconstruct the DID Document.

        Parameters:
        did - The "did:dht" DID that needs to be resolved.
        Returns:

        A DidResolutionResult instance containing the DID Document and related context, including types as part of the DidDocumentMetadata, if available.

      • import

        @JvmOverloads() final BearerDid import(PortableDid portableDid, KeyManager keyManager)

        Instantiates a BearerDid object for the DID DHT method from a given PortableDid.

        This method allows for the creation of a BearerDid object using a previously created DID's key material, DID document, and metadata.

        Parameters:
        portableDid -
        • The PortableDid object to import.

        keyManager -
        • Optionally specify an external Key Management System (KMS) used to generate keys and sign data. If not given, a new InMemoryKeyManager instance will be created and used.

      • import

        @JvmOverloads() final BearerDid import(PortableDid portableDid)

        Instantiates a BearerDid object for the DID DHT method from a given PortableDid.

        This method allows for the creation of a BearerDid object using a previously created DID's key material, DID document, and metadata.

        Parameters:
        portableDid -
        • The PortableDid object to import.

      • suffix

         final String suffix(String didUrl)

        Returns the suffix of the DID, which is the last part of the DID's method-specific identifier.

        Parameters:
        didUrl - The DID to get the suffix of.
        Returns:

        The suffix of the DID String.