Static
methodName of the DID method, as defined in the DID ION specification.
Static
createCreates a new DID using the did:ion
method formed from a newly generated key.
Notes:
options
are given, by default a new Ed25519 key will be generated.The parameters for the create operation.
Optional
keyOptionally specify a Key Management System (KMS) used to generate keys and sign data.
Optional
options?: DidIonCreateOptions<TKms>Optional parameters that can be specified when creating a new DID.
A Promise resolving to a BearerDid object representing the new DID.
// DID Creation
const did = await DidIon.create();
// DID Creation with a KMS
const keyManager = new LocalKeyManager();
const did = await DidIon.create({ keyManager });
Static
getGiven the W3C DID Document of a did:ion
DID, return the verification method that will be used
for signing messages and credentials. If given, the methodId
parameter is used to select the
verification method. If not given, the first verification method in the authentication property
in the DID Document is used.
The parameters for the getSigningMethod
operation.
DID Document to get the verification method from.
Optional
methodID of the verification method to use for signing.
Verification method to use for signing.
Static
importInstantiates a BearerDid object for the DID ION 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.
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 DidIon.import({ portableDid });
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.
Static
publishPublishes a DID to a Sidetree node, making it publicly discoverable and resolvable.
This method handles the publication of a DID Document associated with a did:ion
DID to a
Sidetree node.
The parameters for the publish
operation.
The BearerDid
object representing the DID to be published.
Optional
gatewayOptional. The URI of a server involved in executing DID method operations. In the context of publishing, the endpoint is expected to be a Sidetree node. If not specified, a default node is used.
A Promise resolving to a boolean indicating whether the publication was successful.
publish
option is set to false
.// Generate a new DID and keys but explicitly disable publishing.
const did = await DidIon.create({ options: { publish: false } });
// Publish the DID to the Sidetree network.
const isPublished = await DidIon.publish({ did });
// `isPublished` is true if the DID was successfully published.
Static
resolveResolves a did:ion
identifier to its corresponding DID document.
This method performs the resolution of a did:ion
DID, retrieving its DID Document from the
Sidetree-based DID overlay network. The process involves querying a Sidetree node to retrieve
the DID Document that corresponds to the given DID identifier.
The DID to be resolved.
Optional parameters for resolving the DID. Unused by this DID method.
A Promise resolving to a DidResolutionResult object representing the result of the resolution.
gatewayUri
option is not specified, a default node is used to access the Sidetree
network.const resolutionResult = await DidIon.resolve('did:ion:example');
The
DidIon
class provides an implementation of thedid:ion
DID method.Features:
did:ion
DIDs.did:ion
to its corresponding DID Document stored in the Sidetree network.See
Example