The DID document associated with this DID.
Key Management System (KMS) used to manage the DIDs keys and sign data.
Each DID method requires at least one key be present in the provided keyManager
.
Represents metadata about a DID resulting from create, update, or deactivate operations.
A string representation of the DID.
A DID is a URI composed of three parts: the scheme did:
, a method identifier, and a unique,
method-specific identifier specified by the DID method.
Converts a BearerDid
object to a portable format containing the URI and verification methods
associated with the DID.
This method is useful when you need to represent the key material and metadata associated with
a DID in format that can be used independently of the specific DID method implementation. It
extracts both public and private keys from the DID's key manager and organizes them into a
PortableDid
structure.
A PortableDid
containing the URI, DID document, metadata, and optionally private
keys associated with the BearerDid
.
If the DID's key manager does not allow private keys to be exported, the PortableDid
returned
will not contain a privateKeys
property. This enables the importing and exporting DIDs that
use the same underlying KMS even if the KMS does not support exporting private keys. Examples
include hardware security modules (HSMs) and cloud-based KMS services like AWS KMS.
If the DID's key manager does support exporting private keys, the resulting PortableDid
will
include a privateKeys
property which contains the same number of entries as there are
verification methods as the DID document, each with its associated private key and the
purpose(s) for which the key can be used (e.g., authentication
, assertionMethod
, etc.).
// Assuming `did` is an instance of BearerDid
const portableDid = await did.export();
// portableDid now contains the DID URI, document, metadata, and optionally, private keys.
An error if the DID document does not contain any verification methods or the keys for any verification method are missing in the key manager.
Return a Signer that can be used to sign messages, credentials, or arbitrary data.
If given, the methodId
parameter is used to select a key from the verification methods
present in the DID Document.
If methodID
is not given, the first verification method intended for signing claims is used.
Optional
params: { The parameters for the getSigner
operation.
ID of the verification method key that will be used for sign and verify operations. Optional.
An instantiated Signer that can be used to sign and verify data.
Static
importInstantiates a BearerDid object 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.
The parameters for the import operation.
Optional
keyOptionally specify an external Key Management System (KMS) used to generate keys and sign data. If not given, a new LocalKeyManager instance will be created and used.
The PortableDid object to import.
A Promise resolving to a BearerDid
object representing the DID formed from the
provided PortableDid.
// Export an existing BearerDid to PortableDid format.
const portableDid = await did.export();
// Reconstruct a BearerDid object from the PortableDid.
const did = await BearerDid.import({ portableDid });
An error if the PortableDid document does not contain any verification methods or the keys for any verification method are missing in the key manager.
Represents a Decentralized Identifier (DID) along with its DID document, key manager, metadata, and convenience functions.