Object DidKey.Companion
-
- All Implemented Interfaces:
public class DidKey.Companion
-
-
Field Summary
Fields Modifier and Type Field Description public final static DidKey.CompanionINSTANCE
-
Method Summary
Modifier and Type Method Description final BearerDidcreate(KeyManager keyManager, CreateDidKeyOptions options)Creates a new "did:key" DID, derived from a public key, and stores the associated private key in the provided KeyManager. final BearerDidcreate(KeyManager keyManager)Creates a new "did:key" DID, derived from a public key, and stores the associated private key in the provided KeyManager. final DidResolutionResultresolve(String did)Resolves a "did:key" 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 KEY method from a given PortableDid. final BearerDidimport(PortableDid portableDid)Instantiates a BearerDid object for the DID KEY method from a given PortableDid. -
-
Method Detail
-
create
@JvmOverloads() final BearerDid create(KeyManager keyManager, CreateDidKeyOptions options)
Creates a new "did:key" DID, derived from a public key, and stores the associated private key in the provided KeyManager.
The method-specific identifier of a "did:key" DID is a multibase encoded public key.
Note: Defaults to ES256K if no options are provided
- Parameters:
keyManager- A KeyManager instance where the new key will be stored.options- Optional parameters (CreateDidKeyOptions) to specify algorithmId during key creation.- Returns:
A DidKey instance representing the newly created "did:key" DID.
-
create
@JvmOverloads() final BearerDid create(KeyManager keyManager)
Creates a new "did:key" DID, derived from a public key, and stores the associated private key in the provided KeyManager.
The method-specific identifier of a "did:key" DID is a multibase encoded public key.
Note: Defaults to ES256K if no options are provided
- Parameters:
keyManager- A KeyManager instance where the new key will be stored.- Returns:
A DidKey instance representing the newly created "did:key" DID.
-
resolve
final DidResolutionResult resolve(String did)
Resolves a "did:key" DID into a DidResolutionResult, which contains the DID Document and possible related metadata.
This implementation primarily constructs a DID Document with a single verification method derived from the DID's method-specific identifier (the public key).
- Parameters:
did- The "did:key" DID that needs to be resolved.- Returns:
A DidResolutionResult instance containing the DID Document and related context.
-
import
@JvmOverloads() final BearerDid import(PortableDid portableDid, KeyManager keyManager)
Instantiates a BearerDid object for the DID KEY 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 KEY 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.
-
-
-
-