Class DidDhtApi
-
- All Implemented Interfaces:
public class DidDhtApiBase class for managing DID DHT operations. Uses the given DidDhtConfiguration.
-
-
Field Summary
Fields Modifier and Type Field Description private final StringmethodName
-
Method Summary
Modifier and Type Method Description final StringgetMethodName()final BearerDidcreate(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. final BearerDidcreate(KeyManager keyManager)Creates a new "did:dht" DID, derived from an initial identity key, and stores the associated private key in the provided KeyManager. final DidResolutionResultresolve(String did)Resolves a "did:dht" DID into a DidResolutionResult, which contains the DID Document and possible related metadata. final BearerDidimport(PortableDid portableDid, KeyManager keyManager)Instantiates a BearerDid object for the DID DHT method from a given PortableDid. final BearerDidimport(PortableDid portableDid)Instantiates a BearerDid object for the DID DHT method from a given PortableDid. final Unitpublish(KeyManager manager, DidDocument didDocument, List<DidDhtTypeIndexing> types)Publishes a DidDocument to the DHT. final Unitpublish(KeyManager manager, DidDocument didDocument)Publishes a DidDocument to the DHT. final Stringsuffix(String didUrl)Returns the suffix of the DID, which is the last part of the DID's method-specific identifier. -
-
Method Detail
-
getMethodName
final String getMethodName()
-
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
BearerDidobject 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
BearerDidobject using a previously created DID's key material, DID document, and metadata.- Parameters:
portableDid-The PortableDid object to import.
-
publish
@JvmOverloads() final Unit publish(KeyManager manager, DidDocument didDocument, List<DidDhtTypeIndexing> types)
Publishes a DidDocument to the DHT.
- Parameters:
manager- The KeyManager instance to use for signing the message.didDocument- The DidDocument to publish.types- A list of types to include in the packet.
-
publish
@JvmOverloads() final Unit publish(KeyManager manager, DidDocument didDocument)
Publishes a DidDocument to the DHT.
- Parameters:
manager- The KeyManager instance to use for signing the message.didDocument- The DidDocument to publish.
-
-
-
-