Skip to main content
Version: 0.6

WASM API Reference

Classes

Account

An account manages one identity.

It handles private keys, writing to storage and publishing to the Tangle.

AccountBuilder

An [Account] builder for easy account configuration.

To reduce memory usage, accounts created from the same builder share the same Storageused to store identities, and the same Client used to publish identities to the Tangle.

The configuration on the other hand is cloned, and therefore unique for each built account. This means a builder can be reconfigured in-between account creations, without affecting the configuration of previously built accounts.

AgreementInfo

Agreement information used as the input for the concat KDF.

AutoSave
CekAlgorithm

Supported algorithms used to determine and potentially encrypt the content encryption key (CEK).

ChainState
Client
Credential
CredentialValidationOptions

Options to declare validation criteria when validating credentials.

CredentialValidator
DID
DIDUrl
DiffChainHistory
DiffMessage

Defines the difference between two DID Documents' JSON representations.

Document
DocumentHistory

A DID Document's history and current state.

DocumentMetadata

Additional attributes related to an IOTA DID Document.

Duration

A span of time.

Ed25519
EncryptedData

The structure returned after encrypting data

EncryptionAlgorithm

Supported content encryption algorithms.

ExplorerUrl
IntegrationChainHistory
KeyLocation

The storage location of a verification method key.

A key is uniquely identified by the fragment and a hash of its public key. Importantly, the fragment alone is insufficient to represent the storage location. For example, when rotating a key, there will be two keys in storage for the same identity with the same fragment. The key_hash disambiguates the keys in situations like these.

The string representation of that location can be obtained via canonicalRepr.

KeyPair
MethodContent
MethodData

Supported verification method data formats.

MethodScope

Supported verification method types.

MethodType

Supported verification method types.

Network
Presentation
PresentationValidationOptions

Options to declare validation criteria when validating presentation.

PresentationValidator
Proof

A digital signature.

For field definitions see: https://w3c-ccg.github.io/security-vocab/

ProofOptions

Holds additional options for creating signatures. See IProofOptions.

ProofPurpose

Associates a purpose with a Proof.

See https://w3c-ccg.github.io/security-vocab/#proofPurpose

Receipt
ResolvedDocument

An IOTA DID document resolved from the Tangle. Represents an integration chain message possibly merged with one or more DiffMessages.

Resolver
ResolverBuilder

Builder for configuring [Clients][Client] when constructing a [Resolver].

RevocationBitmap

A compressed bitmap for managing credential revocation.

Service

A DID Document Service used to enable trusted interactions associated with a DID subject.

See: https://www.w3.org/TR/did-core/#services

Signature
StorageTestSuite

A test suite for the Storage interface.

This module contains a set of tests that a correct storage implementation should pass. Note that not every edge case is tested.

Tests usually rely on multiple interface methods being implemented, so they should only be run on a fully implemented version. That's why there is not a single test case for every interface method.

Timestamp
VerificationMethod
VerifierOptions

Holds additional proof verification options. See IVerifierOptions.

X25519

An implementation of X25519 Elliptic-curve Diffie-Hellman (ECDH) cryptographic key exchange.

Members

DIDMessageEncoding
StatusCheck

Controls validation behaviour when checking whether or not a credential has been revoked by itscredentialStatus.

Strict

Validate the status if supported, reject any unsupportedcredentialStatus types.

Only RevocationBitmap2022 is currently supported.

This is the default.

SkipUnsupported

Validate the status if supported, skip any unsupportedcredentialStatus types.

SkipAll

Skip all status checks.

SubjectHolderRelationship

Declares how credential subjects must relate to the presentation holder during validation. See PresentationValidationOptions::subject_holder_relationship.

See also the Subject-Holder Relationship section of the specification.

AlwaysSubject

The holder must always match the subject on all credentials, regardless of their nonTransferable property. This variant is the default used if no other variant is specified when constructing a newPresentationValidationOptions.

SubjectOnNonTransferable

The holder must match the subject only for credentials where the nonTransferable property is true.

Any

The holder is not required to have any kind of relationship to any credential subject.

FailFast

Declares when validation should return if an error occurs.

AllErrors

Return all errors that occur during validation.

FirstError

Return after the first error occurs.

KeyType
MethodRelationship

Functions

start()

Initializes the console error panic hook for better error messages

Account

An account manages one identity.

It handles private keys, writing to storage and publishing to the Tangle.

Kind: global class

account.attachMethodRelationships(options) ⇒ Promise.<void>

Attach one or more verification relationships to a method.

Note: the method must exist and be in the set of verification methods; it cannot be an embedded method.

Kind: instance method of Account

ParamType
optionsAttachMethodRelationshipOptions

account.createMethod(options) ⇒ Promise.<void>

Adds a new verification method to the DID document.

Kind: instance method of Account

ParamType
optionsCreateMethodOptions

account.detachMethodRelationships(options) ⇒ Promise.<void>

Detaches the given relationship from the given method, if the method exists.

Kind: instance method of Account

ParamType
optionsDetachMethodRelationshipOptions

account.did() ⇒ DID

Returns the DID of the managed identity.

Kind: instance method of Account

account.autopublish() ⇒ boolean

Returns whether auto-publish is enabled.

Kind: instance method of Account

account.autosave() ⇒ AutoSave

Returns the auto-save configuration value.

Kind: instance method of Account

account.document() ⇒ Document

Returns a copy of the document managed by the Account.

Note: the returned document only has a valid signature after publishing an integration chain update. In general, for use cases where the signature is required, it is advisable to resolve the document from the Tangle.

Kind: instance method of Account

account.resolveIdentity() ⇒ Promise.<ResolvedDocument>

Resolves the DID Document associated with this Account from the Tangle.

Kind: instance method of Account

account.deleteIdentity() ⇒ Promise.<void>

Removes the identity from the local storage entirely.

Note: This will remove all associated document updates and key material - recovery is NOT POSSIBLE!

Kind: instance method of Account

account.publish(publish_options) ⇒ Promise.<void>

Push all unpublished changes to the tangle in a single message.

Kind: instance method of Account

ParamType
publish_optionsPublishOptions | undefined

account.createSignedCredential(fragment, credential, options) ⇒ Promise.<Credential>

Signs a Credential with the key specified by fragment.

Kind: instance method of Account

ParamType
fragmentstring
credentialCredential
optionsProofOptions

account.createSignedDocument(fragment, document, options) ⇒ Promise.<Document>

Signs a Document with the key specified by fragment.

Kind: instance method of Account

ParamType
fragmentstring
documentDocument
optionsProofOptions

account.createSignedPresentation(fragment, presentation, options) ⇒ Promise.<Presentation>

Signs a Presentation the key specified by fragment.

Kind: instance method of Account

ParamType
fragmentstring
presentationPresentation
optionsProofOptions

account.createSignedData(fragment, data, options) ⇒ Promise.<any>

Signs arbitrary data with the key specified by fragment.

Kind: instance method of Account

ParamType
fragmentstring
dataany
optionsProofOptions

account.updateDocumentUnchecked(document) ⇒ Promise.<void>

Overwrites the Document this account manages, without doing any validation.

WARNING

This method is dangerous and can easily corrupt the internal state, potentially making the identity unusable. Only call this if you fully understand the implications!

Kind: instance method of Account

ParamType
documentDocument

account.fetchDocument() ⇒ Promise.<void>

Fetches the latest changes from the tangle and overwrites the local document.

If a DID is managed from distributed accounts, this should be called before making changes to the identity, to avoid publishing updates that would be ignored.

Kind: instance method of Account

account.revokeCredentials(fragment, credentialIndices) ⇒ Promise.<void>

If the document has a RevocationBitmap service identified by fragment, revoke all credentials with a revocationBitmapIndex in credentialIndices.

Kind: instance method of Account

ParamType
fragmentstring
credentialIndicesnumber | Array.<number>

account.unrevokeCredentials(fragment, credentialIndices) ⇒ Promise.<void>

If the document has a RevocationBitmap service identified by fragment, unrevoke all credentials with a revocationBitmapIndex in credentialIndices.

Kind: instance method of Account

ParamType
fragmentstring
credentialIndicesnumber | Array.<number>

account.encryptData(plaintext, associated_data, encryption_algorithm, cek_algorithm, public_key) ⇒ Promise.<EncryptedData>

Encrypts the given plaintext with the specified encryption_algorithm and cek_algorithm.

Returns an [EncryptedData] instance.

Kind: instance method of Account

ParamType
plaintextUint8Array
associated_dataUint8Array
encryption_algorithmEncryptionAlgorithm
cek_algorithmCekAlgorithm
public_keyUint8Array

account.decryptData(data, encryption_algorithm, cek_algorithm, fragment) ⇒ Promise.<Uint8Array>

Decrypts the given data with the key identified by fragment using the given encryption_algorithm and cek_algorithm.

Returns the decrypted text.

Kind: instance method of Account

ParamType
dataEncryptedData
encryption_algorithmEncryptionAlgorithm
cek_algorithmCekAlgorithm
fragmentstring

account.setAlsoKnownAs(options) ⇒ Promise.<void>

Sets the alsoKnownAs property in the DID document.

Kind: instance method of Account

ParamType
optionsSetAlsoKnownAsOptions

account.deleteMethod(options) ⇒ Promise.<void>

Deletes a verification method if the method exists.

Kind: instance method of Account

ParamType
optionsDeleteMethodOptions

account.deleteService(options) ⇒ Promise.<void>

Deletes a Service if it exists.

Kind: instance method of Account

ParamType
optionsDeleteServiceOptions

account.setController(options) ⇒ Promise.<void>

Sets the controllers of the DID document.

Kind: instance method of Account

ParamType
optionsSetControllerOptions

account.createService(options) ⇒ Promise.<void>

Adds a new Service to the DID Document.

Kind: instance method of Account

ParamType
optionsCreateServiceOptions

AccountBuilder

An [Account] builder for easy account configuration.

To reduce memory usage, accounts created from the same builder share the same Storage used to store identities, and the same Client used to publish identities to the Tangle.

The configuration on the other hand is cloned, and therefore unique for each built account. This means a builder can be reconfigured in-between account creations, without affecting the configuration of previously built accounts.

Kind: global class

new AccountBuilder(options)

Creates a new AccountBuilder.

ParamType
optionsAccountBuilderOptions | undefined

accountBuilder.loadIdentity(did) ⇒ Promise.<Account>

Loads an existing identity with the specified did using the current builder configuration. The identity must exist in the configured Storage.

Kind: instance method of AccountBuilder

ParamType
didDID

accountBuilder.createIdentity(identity_setup) ⇒ Promise.<Account>

Creates a new identity based on the builder configuration and returns an Account object to manage it.

The identity is stored locally in the Storage. The DID network is automatically determined by the Client used to publish it.

Kind: instance method of AccountBuilder

ParamType
identity_setupIdentitySetup | undefined

AgreementInfo

Agreement information used as the input for the concat KDF.

Kind: global class

new AgreementInfo(apu, apv, pub_info, priv_info)

Creates an AgreementInfo Object.

ParamType
apuUint8Array
apvUint8Array
pub_infoUint8Array
priv_infoUint8Array

agreementInfo.apu() ⇒ Uint8Array

Returns a copy of `apu'

Kind: instance method of AgreementInfo

agreementInfo.apv() ⇒ Uint8Array

Returns a copy of `apv'

Kind: instance method of AgreementInfo

agreementInfo.pubInfo() ⇒ Uint8Array

Returns a copy of `pubInfo'

Kind: instance method of AgreementInfo

agreementInfo.privInfo() ⇒ Uint8Array

Returns a copy of `privInfo'

Kind: instance method of AgreementInfo

agreementInfo.toJSON() ⇒ any

Serializes AgreementInfo as a JSON object.

Kind: instance method of AgreementInfo

AgreementInfo.fromJSON(json_value) ⇒ AgreementInfo

Deserializes AgreementInfo from a JSON object.

Kind: static method of AgreementInfo

ParamType
json_valueany

AutoSave

Kind: global class

autoSave.toJSON() ⇒ any

Serializes AutoSave as a JSON object.

Kind: instance method of AutoSave

AutoSave.never() ⇒ AutoSave

Never save.

Kind: static method of AutoSave

AutoSave.every() ⇒ AutoSave

Save after every action.

Kind: static method of AutoSave

AutoSave.batch(number_of_actions) ⇒ AutoSave

Save after every N actions.

Kind: static method of AutoSave

ParamType
number_of_actionsnumber

AutoSave.fromJSON(json_value) ⇒ AutoSave

Deserializes AutoSave from a JSON object.

Kind: static method of AutoSave

ParamType
json_valueany

CekAlgorithm

Supported algorithms used to determine and potentially encrypt the content encryption key (CEK).

Kind: global class

cekAlgorithm.toJSON() ⇒ any

Serializes CekAlgorithm as a JSON object.

Kind: instance method of CekAlgorithm

CekAlgorithm.EcdhEs(agreement) ⇒ CekAlgorithm

Elliptic Curve Diffie-Hellman Ephemeral Static key agreement using Concat KDF.

Kind: static method of CekAlgorithm

ParamType
agreementAgreementInfo

CekAlgorithm.EcdhEsA256Kw(agreement) ⇒ CekAlgorithm

Elliptic Curve Diffie-Hellman Ephemeral Static key agreement using Concat KDF.

Kind: static method of CekAlgorithm

ParamType
agreementAgreementInfo

CekAlgorithm.fromJSON(json_value) ⇒ CekAlgorithm

Deserializes CekAlgorithm from a JSON object.

Kind: static method of CekAlgorithm

ParamType
json_valueany

ChainState

Kind: global class

chainState.toJSON() ⇒ any

Serializes a ChainState object as a JSON object.

Kind: instance method of ChainState

ChainState.fromJSON(json_value) ⇒ ChainState

Deserializes a JSON object as ChainState.

Kind: static method of ChainState

ParamType
json_valueany

Client

Kind: global class

new Client()

Creates a new Client with default settings.

client.network() ⇒ Network

Returns the Client Tangle network.

Kind: instance method of Client

client.publishDocument(document) ⇒ Promise.<Receipt>

Publishes a Document to the Tangle.

Kind: instance method of Client

ParamType
documentDocument

client.publishDiff(message_id, diff) ⇒ Promise.<Receipt>

Deprecated

Publishes a DiffMessage to the Tangle.

Kind: instance method of Client

ParamType
message_idstring
diffDiffMessage

client.publishJSON(index, data) ⇒ Promise.<Receipt>

Publishes arbitrary JSON data to the specified index on the Tangle.

Kind: instance method of Client

ParamType
indexstring
dataany

client.publishJsonWithRetry(index, data, interval, max_attempts) ⇒ Promise.<any>

Publishes arbitrary JSON data to the specified index on the Tangle. Retries (promotes or reattaches) the message until it’s included (referenced by a milestone). Default interval is 5 seconds and max attempts is 40.

Kind: instance method of Client

ParamType
indexstring
dataany
intervalnumber | undefined
max_attemptsnumber | undefined

client.isMessageIncluded(messageId) ⇒ Promise.<boolean>

Checks if a message is confirmed by a milestone.

Kind: instance method of Client

ParamType
messageIdstring

client.resolve(did) ⇒ Promise.<ResolvedDocument>

Fetch the DID document specified by the given DID.

Kind: instance method of Client

ParamType
didDID | string

client.resolveHistory(did) ⇒ Promise.<DocumentHistory>

Returns the message history of the given DID.

Kind: instance method of Client

ParamType
didDID | string

client.resolveDiffHistory(document) ⇒ Promise.<DiffChainHistory>

Deprecated

Returns the DiffChainHistory of a diff chain starting from a document on the integration chain.

NOTE: the document must have been published to the tangle and have a valid message id and capability invocation method.

Kind: instance method of Client

ParamType
documentResolvedDocument

Client.fromConfig(config) ⇒ Promise.<Client>

Creates a new Client with the given settings.

Kind: static method of Client

ParamType
configIClientConfig

Credential

Kind: global class

new Credential(values)

Constructs a new Credential.

ParamType
valuesICredential

credential.context() ⇒ Array.<(string|Record.<string, any>)>

Returns a copy of the JSON-LD context(s) applicable to the Credential.

Kind: instance method of Credential

credential.id() ⇒ string | undefined

Returns a copy of the unique URI identifying the Credential .

Kind: instance method of Credential

credential.type() ⇒ Array.<string>

Returns a copy of the URIs defining the type of the Credential.

Kind: instance method of Credential

credential.credentialSubject() ⇒ Array.<Subject>

Returns a copy of the Credential subject(s).

Kind: instance method of Credential

credential.issuer() ⇒ string | Issuer

Returns a copy of the issuer of the Credential.

Kind: instance method of Credential

credential.issuanceDate() ⇒ Timestamp

Returns a copy of the timestamp of when the Credential becomes valid.

Kind: instance method of Credential

credential.expirationDate() ⇒ Timestamp | undefined

Returns a copy of the timestamp of when the Credential should no longer be considered valid.

Kind: instance method of Credential

credential.credentialStatus() ⇒ Array.<Status>

Returns a copy of the information used to determine the current status of the Credential.

Kind: instance method of Credential

credential.credentialSchema() ⇒ Array.<Schema>

Returns a copy of the information used to assist in the enforcement of a specific Credential structure.

Kind: instance method of Credential

credential.refreshService() ⇒ Array.<RefreshService>

Returns a copy of the service(s) used to refresh an expired Credential.

Kind: instance method of Credential

credential.termsOfUse() ⇒ Array.<Policy>

Returns a copy of the terms-of-use specified by the Credential issuer.

Kind: instance method of Credential

credential.evidence() ⇒ Array.<Evidence>

Returns a copy of the human-readable evidence used to support the claims within the Credential.

Kind: instance method of Credential

credential.nonTransferable() ⇒ boolean | undefined

Returns whether or not the Credential must only be contained within a Presentation with a proof issued from the Credential subject.

Kind: instance method of Credential

credential.proof() ⇒ Proof | undefined

Returns a copy of the proof used to verify the Credential.

Kind: instance method of Credential

credential.properties() ⇒ Map.<string, any>

Returns a copy of the miscellaneous properties on the Credential.

Kind: instance method of Credential

credential.toJSON() ⇒ any

Serializes a Credential to a JSON object.

Kind: instance method of Credential

credential.clone() ⇒ Credential

Deep clones the object.

Kind: instance method of Credential

Credential.BaseContext() ⇒ string

Returns the base JSON-LD context.

Kind: static method of Credential

Credential.BaseType() ⇒ string

Returns the base type.

Kind: static method of Credential

Credential.fromJSON(json) ⇒ Credential

Deserializes a Credential from a JSON object.

Kind: static method of Credential

ParamType
jsonany

CredentialValidationOptions

Options to declare validation criteria when validating credentials.

Kind: global class

new CredentialValidationOptions(options)

Creates a new CredentialValidationOptions from the given fields.

Throws an error if any of the options are invalid.

ParamType
optionsICredentialValidationOptions

credentialValidationOptions.toJSON() ⇒ any

Serializes a CredentialValidationOptions as a JSON object.

Kind: instance method of CredentialValidationOptions

credentialValidationOptions.clone() ⇒ CredentialValidationOptions

Deep clones the object.

Kind: instance method of CredentialValidationOptions

CredentialValidationOptions.default() ⇒ CredentialValidationOptions

Creates a new CredentialValidationOptions with defaults.

Kind: static method of CredentialValidationOptions

CredentialValidationOptions.fromJSON(json) ⇒ CredentialValidationOptions

Deserializes a CredentialValidationOptions from a JSON object.

Kind: static method of CredentialValidationOptions

ParamType
jsonany

CredentialValidator

Kind: global class

CredentialValidator.validate(credential, issuer, options, fail_fast)

Validates a Credential.

The following properties are validated according to options:

  • the issuer's signature,
  • the expiration date,
  • the issuance date,
  • the semantic structure.

Warning

The lack of an error returned from this method is in of itself not enough to conclude that the credential can be trusted. This section contains more information on additional checks that should be carried out before and after calling this method.

The state of the issuer's DID Document

The caller must ensure that issuer represents an up-to-date DID Document. The convenience method Resolver::resolveCredentialIssuer can help extract the latest available state of the issuer's DID Document.

Properties that are not validated

There are many properties defined in The Verifiable Credentials Data Model that are not validated, such as: credentialStatus, type, credentialSchema, refreshService, and more. These should be manually checked after validation, according to your requirements.

Errors

An error is returned whenever a validated condition is not satisfied.

Kind: static method of CredentialValidator

ParamType
credentialCredential
issuerDocument | ResolvedDocument
optionsCredentialValidationOptions
fail_fastnumber

CredentialValidator.checkStructure(credential)

Validates the semantic structure of the Credential.

Warning

This does not validate against the credential's schema nor the structure of the subject claims.

Kind: static method of CredentialValidator

ParamType
credentialCredential

CredentialValidator.checkExpiresOnOrAfter(credential, timestamp)

Validate that the credential expires on or after the specified timestamp.

Kind: static method of CredentialValidator

ParamType
credentialCredential
timestampTimestamp

CredentialValidator.checkIssuedOnOrBefore(credential, timestamp)

Validate that the credential is issued on or before the specified timestamp.

Kind: static method of CredentialValidator

ParamType
credentialCredential
timestampTimestamp

CredentialValidator.verifySignature(credential, trusted_issuers, options)

Verify the signature using the DID Document of a trusted issuer.

Warning

The caller must ensure that the DID Documents of the trusted issuers are up-to-date.

Errors

This method immediately returns an error if the credential issuer' url cannot be parsed to a DID belonging to one of the trusted issuers. Otherwise an attempt to verify the credential's signature will be made and an error is returned upon failure.

Kind: static method of CredentialValidator

ParamType
credentialCredential
trusted_issuersArray.<Document> | Array.<ResolvedDocument>
optionsVerifierOptions

CredentialValidator.check_subject_holder_relationship(credential, holder_url, relationship)

Validate that the relationship between the holder and the credential subjects is in accordance with relationship. The holder_url parameter is expected to be the URL of the holder.

Kind: static method of CredentialValidator

ParamType
credentialCredential
holder_urlstring
relationshipnumber

CredentialValidator.checkStatus(credential, trustedIssuers, statusCheck)

Checks whether the credential status has been revoked.

Only supports BitmapRevocation2022.

Kind: static method of CredentialValidator

ParamType
credentialCredential
trustedIssuersArray.<Document> | Array.<ResolvedDocument>
statusChecknumber

DID

Kind: global class

new DID(public_key, network)

Creates a new DID from a public key.

ParamType
public_keyUint8Array
networkstring | undefined

did.networkName ⇒ string

Returns the IOTA tangle network of the DID.

Kind: instance property of DID

did.network() ⇒ Network

Returns the IOTA tangle network of the DID.

Kind: instance method of DID

did.tag() ⇒ string

Returns a copy of the unique tag of the DID.

Kind: instance method of DID

did.join(segment) ⇒ DIDUrl

Construct a new DIDUrl by joining with a relative DID Url string.

Kind: instance method of DID

ParamType
segmentstring

did.toUrl() ⇒ DIDUrl

Clones the DID into a DIDUrl.

Kind: instance method of DID

did.intoUrl() ⇒ DIDUrl

Converts the DID into a DIDUrl.

Kind: instance method of DID

did.toString() ⇒ string

Returns the DID as a string.

Kind: instance method of DID

did.toJSON() ⇒ any

Serializes a DID as a JSON object.

Kind: instance method of DID

did.clone() ⇒ DID

Deep clones the object.

Kind: instance method of DID

DID.parse(input) ⇒ DID

Parses a DID from the input string.

Kind: static method of DID

ParamType
inputstring

DID.fromJSON(json_value) ⇒ DID

Deserializes a JSON object as DID.

Kind: static method of DID

ParamType
json_valueany

DIDUrl

Kind: global class

didUrl.did() ⇒ DID

Return a copy of the DID section of the DIDUrl.

Kind: instance method of DIDUrl

didUrl.urlStr() ⇒ string

Return a copy of the relative DID Url as a string, including only the path, query, and fragment.

Kind: instance method of DIDUrl

didUrl.fragment() ⇒ string | undefined

Returns a copy of the DIDUrl method fragment, if any. Excludes the leading '#'.

Kind: instance method of DIDUrl

didUrl.setFragment(value)

Sets the fragment component of the DIDUrl.

Kind: instance method of DIDUrl

ParamType
valuestring | undefined

didUrl.path() ⇒ string | undefined

Returns a copy of the DIDUrl path.

Kind: instance method of DIDUrl

didUrl.setPath(value)

Sets the path component of the DIDUrl.

Kind: instance method of DIDUrl

ParamType
valuestring | undefined

didUrl.query() ⇒ string | undefined

Returns a copy of the DIDUrl method query, if any. Excludes the leading '?'.

Kind: instance method of DIDUrl

didUrl.setQuery(value)

Sets the query component of the DIDUrl.

Kind: instance method of DIDUrl

ParamType
valuestring | undefined

didUrl.join(segment) ⇒ DIDUrl

Append a string representing a path, query, and/or fragment, returning a new DIDUrl.

Must begin with a valid delimiter character: '/', '?', '#'. Overwrites the existing URL segment and any following segments in order of path, query, then fragment.

I.e.

  • joining a path will clear the query and fragment.
  • joining a query will clear the fragment.
  • joining a fragment will only overwrite the fragment.

Kind: instance method of DIDUrl

ParamType
segmentstring

didUrl.toString() ⇒ string

Returns the DIDUrl as a string.

Kind: instance method of DIDUrl

didUrl.toJSON() ⇒ any

Serializes a DIDUrl as a JSON object.

Kind: instance method of DIDUrl

didUrl.clone() ⇒ DIDUrl

Deep clones the object.

Kind: instance method of DIDUrl

DIDUrl.parse(input) ⇒ DIDUrl

Parses a DIDUrl from the input string.

Kind: static method of DIDUrl

ParamType
inputstring

DiffChainHistory

Deprecated

Kind: global class

diffChainHistory.chainData() ⇒ Array.<DiffMessage>

Returns an Array of the diff chain DiffMessages.

NOTE: this clones the field.

Kind: instance method of DiffChainHistory

diffChainHistory.spam() ⇒ Array.<string>

Returns an Array of MessageIds as strings.

NOTE: this clones the field.

Kind: instance method of DiffChainHistory

diffChainHistory.toJSON() ⇒ any

Serializes as a JSON object.

Kind: instance method of DiffChainHistory

DiffChainHistory.fromJSON(json) ⇒ DiffChainHistory

Deserializes from a JSON object.

Kind: static method of DiffChainHistory

ParamType
jsonany

DiffMessage

Deprecated

Defines the difference between two DID Documents' JSON representations.

Kind: global class

diffMessage.id() ⇒ DID

Deprecated

Returns the DID of the associated DID Document.

NOTE: clones the data.

Kind: instance method of DiffMessage

diffMessage.did() ⇒ DID

Deprecated

Returns a copy of the DID of the associated DID Document.

Kind: instance method of DiffMessage

diffMessage.diff() ⇒ string

Deprecated

Returns a copy of the raw contents of the DID Document diff as a JSON string.

Kind: instance method of DiffMessage

diffMessage.messageId() ⇒ string

Deprecated

Returns a copy of the message_id of the DID Document diff.

Kind: instance method of DiffMessage

diffMessage.setMessageId(message_id)

Deprecated

Sets the message_id of the DID Document diff.

Kind: instance method of DiffMessage

ParamType
message_idstring

diffMessage.previousMessageId() ⇒ string

Deprecated

Returns a copy of the Tangle message id of the previous DID Document diff.

Kind: instance method of DiffMessage

diffMessage.setPreviousMessageId(message_id)

Deprecated

Sets the Tangle message id of the previous DID Document diff.

Kind: instance method of DiffMessage

ParamType
message_idstring

diffMessage.proof() ⇒ Proof | undefined

Deprecated

Returns a copy of the proof.

Kind: instance method of DiffMessage

diffMessage.merge(document) ⇒ Document

Deprecated

Returns a new DID Document which is the result of merging self with the given Document.

Kind: instance method of DiffMessage

ParamType
documentDocument

diffMessage.toJSON() ⇒ any

Deprecated

Serializes a DiffMessage as a JSON object.

Kind: instance method of DiffMessage

diffMessage.clone() ⇒ DiffMessage

Deep clones the object.

Kind: instance method of DiffMessage

DiffMessage.fromJSON(json) ⇒ DiffMessage

Deprecated

Deserializes a DiffMessage from a JSON object.

Kind: static method of DiffMessage

ParamType
jsonany

Document

Kind: global class

new Document(keypair, network, fragment)

Creates a new DID Document from the given KeyPair, network, and verification method fragment name.

The DID Document will be pre-populated with a single verification method derived from the provided KeyPair embedded as a capability invocation verification relationship. This method will have the DID URL fragment #sign-0 by default and can be easily retrieved with Document::defaultSigningMethod.

NOTE: the generated document is unsigned, see Document::signSelf.

Arguments:

  • keypair: the initial verification method is derived from the public key with this keypair.
  • network: Tangle network to use for the DID, default Network::mainnet.
  • fragment: name of the initial verification method, default "sign-0".
ParamType
keypairKeyPair
networkstring | undefined
fragmentstring | undefined

document.id() ⇒ DID

Returns a copy of the DID Document id.

Kind: instance method of Document

document.setController(controllers)

Sets the controllers of the DID Document.

Note: Duplicates will be ignored. Use null to remove all controllers.

Kind: instance method of Document

ParamType
controllersDID | Array.<DID> | null

document.controller() ⇒ Array.<DID>

Returns a list of document controllers.

Kind: instance method of Document

document.setAlsoKnownAs(urls)

Sets the alsoKnownAs property in the DID document.

Kind: instance method of Document

ParamType
urlsstring | Array.<string> | null

document.alsoKnownAs() ⇒ Array.<string>

Returns a set of the document's alsoKnownAs.

Kind: instance method of Document

document.setPropertyUnchecked(key, value)

Adds a custom property to the DID Document. If the value is set to null, the custom property will be removed.

WARNING

This method can overwrite existing properties like id and result in an invalid document.

Kind: instance method of Document

ParamType
keystring
valueany

document.properties() ⇒ Map.<string, any>

Returns a copy of the custom DID Document properties.

Kind: instance method of Document

document.service() ⇒ Array.<Service>

Return a set of all Services in the document.

Kind: instance method of Document

document.insertService(service) ⇒ boolean

Add a new Service to the document.

Returns true if the service was added.

Kind: instance method of Document

ParamType
serviceService

document.removeService(did) ⇒ boolean

Remove a Service identified by the given DIDUrl from the document.

Returns true if a service was removed.

Kind: instance method of Document

ParamType
didDIDUrl

document.methods() ⇒ Array.<VerificationMethod>

Returns a list of all VerificationMethod in the DID Document.

Kind: instance method of Document

document.insertMethod(method, scope)

Adds a new Verification Method to the DID Document.

Kind: instance method of Document

ParamType
methodVerificationMethod
scopeMethodScope

document.removeMethod(did)

Removes all references to the specified Verification Method.

Kind: instance method of Document

ParamType
didDIDUrl

document.defaultSigningMethod() ⇒ VerificationMethod

Returns a copy of the first VerificationMethod with a capability invocation relationship capable of signing this DID document.

Throws an error if no signing method is present.

Kind: instance method of Document

document.resolveMethod(query, scope) ⇒ VerificationMethod | undefined

Returns a copy of the first VerificationMethod with an id property matching the provided query.

Throws an error if the method is not found.

Kind: instance method of Document

ParamType
queryDIDUrl | string
scopeMethodScope | undefined

document.resolveSigningMethod(query) ⇒ VerificationMethod

Attempts to resolve the given method query into a method capable of signing a document update.

Kind: instance method of Document

ParamType
queryDIDUrl | string

document.attachMethodRelationship(did_url, relationship) ⇒ boolean

Attaches the relationship to the given method, if the method exists.

Note: The method needs to be in the set of verification methods, so it cannot be an embedded one.

Kind: instance method of Document

ParamType
did_urlDIDUrl
relationshipnumber

document.detachMethodRelationship(did_url, relationship) ⇒ boolean

Detaches the given relationship from the given method, if the method exists.

Kind: instance method of Document

ParamType
did_urlDIDUrl
relationshipnumber

document.signSelf(key_pair, method_query)

Signs the DID document with the verification method specified by method_query. The method_query may be the full DIDUrl of the method or just its fragment, e.g. "#sign-0".

NOTE: does not validate whether the private key of the given key_pair corresponds to the verification method. See Document::verifySelfSigned.

Kind: instance method of Document

ParamType
key_pairKeyPair
method_queryDIDUrl | string

document.signDocument(document, key_pair, method_query)

Signs another DID document using the verification method specified by method_query. The method_query may be the full DIDUrl of the method or just its fragment, e.g. "#sign-0".

Document.signSelf should be used in general, this throws an error if trying to operate on the same document. This is intended for signing updates to a document where a sole capability invocation method is rotated or replaced entirely.

NOTE: does not validate whether the private key of the given key_pair corresponds to the verification method. See Document.verifyDocument.

Kind: instance method of Document

ParamType
documentDocument
key_pairKeyPair
method_queryDIDUrl | string

document.signCredential(credential, privateKey, methodQuery, options) ⇒ Credential

Creates a signature for the given Credential with the specified DID Document Verification Method.

Kind: instance method of Document

ParamType
credentialCredential
privateKeyUint8Array
methodQueryDIDUrl | string
optionsProofOptions

document.signPresentation(presentation, privateKey, methodQuery, options) ⇒ Presentation

Creates a signature for the given Presentation with the specified DID Document Verification Method.

Kind: instance method of Document

ParamType
presentationPresentation
privateKeyUint8Array
methodQueryDIDUrl | string
optionsProofOptions

document.signData(data, privateKey, methodQuery, options) ⇒ any

Creates a signature for the given data with the specified DID Document Verification Method.

NOTE: use signSelf or signDocument for DID Documents.

Kind: instance method of Document

ParamType
dataany
privateKeyUint8Array
methodQueryDIDUrl | string
optionsProofOptions

document.verifyData(data, options) ⇒ boolean

Verifies the authenticity of data using the target verification method.

Kind: instance method of Document

ParamType
dataany
optionsVerifierOptions

document.verifyDocument(signed)

Verifies that the signature on the DID document signed was generated by a valid method from this DID document.

Errors

Fails if:

  • The signature proof section is missing in the signed document.
  • The method is not found in this document.
  • An unsupported verification method is used.
  • The signature verification operation fails.

Kind: instance method of Document

ParamType
signedDocument

document.diff(other, message_id, key, method_query) ⇒ DiffMessage

Deprecated

Generate a DiffMessage between two DID Documents and sign it using the specified key and method.

Kind: instance method of Document

ParamType
otherDocument
message_idstring
keyKeyPair
method_queryDIDUrl | string

document.verifyDiff(diff)

Deprecated

Verifies the signature of the diff was created using a capability invocation method in this DID Document.

Errors

Fails if an unsupported verification method is used or the verification operation fails.

Kind: instance method of Document

ParamType
diffDiffMessage

document.mergeDiff(diff)

Deprecated

Verifies a DiffMessage signature and attempts to merge the changes into self.

Kind: instance method of Document

ParamType
diffDiffMessage

document.integrationIndex() ⇒ string

Returns the Tangle index of the integration chain for this DID.

This is simply the tag segment of the DID. E.g. For a document with DID: did:iota:1234567890abcdefghijklmnopqrstuvxyzABCDEFGHI, doc.integration_index() == "1234567890abcdefghijklmnopqrstuvxyzABCDEFGHI"

Kind: instance method of Document

document.metadata() ⇒ DocumentMetadata

Returns a copy of the metadata associated with this document.

NOTE: Copies all the metadata. See also metadataCreated, metadataUpdated, metadataPreviousMessageId, metadataProof if only a subset of the metadata required.

Kind: instance method of Document

document.metadataCreated() ⇒ Timestamp | undefined

Returns a copy of the timestamp of when the DID document was created.

Kind: instance method of Document

document.setMetadataCreated(timestamp)

Sets the timestamp of when the DID document was created.

Kind: instance method of Document

ParamType
timestampTimestamp | undefined

document.metadataUpdated() ⇒ Timestamp | undefined

Returns a copy of the timestamp of the last DID document update.

Kind: instance method of Document

document.setMetadataUpdated(timestamp)

Sets the timestamp of the last DID document update.

Kind: instance method of Document

ParamType
timestampTimestamp | undefined

document.metadataPreviousMessageId() ⇒ string

Returns a copy of the previous integration chain message id.

Kind: instance method of Document

document.setMetadataPreviousMessageId(value)

Sets the previous integration chain message id.

Kind: instance method of Document

ParamType
valuestring

document.proof() ⇒ Proof | undefined

Returns a copy of the proof.

Kind: instance method of Document

document.revokeCredentials(fragment, credentialIndices)

If the document has a RevocationBitmap service identified by fragment, revoke all credentials with a revocationBitmapIndex in credentialIndices.

Kind: instance method of Document

ParamType
fragmentstring
credentialIndicesnumber | Array.<number>

document.unrevokeCredentials(fragment, credentialIndices)

If the document has a RevocationBitmap service identified by fragment, unrevoke all credentials with a revocationBitmapIndex in credentialIndices.

Kind: instance method of Document

ParamType
fragmentstring
credentialIndicesnumber | Array.<number>

document.toJSON() ⇒ any

Serializes a Document as a JSON object.

Kind: instance method of Document

document.clone() ⇒ Document

Deep clones the object.

Kind: instance method of Document

Document.fromVerificationMethod(method) ⇒ Document

Creates a new DID Document from the given VerificationMethod.

NOTE: the generated document is unsigned, see Document::signSelf.

Kind: static method of Document

ParamType
methodVerificationMethod

Document.isSigningMethodType(method_type) ⇒ boolean

Returns whether the given MethodType can be used to sign document updates.

Kind: static method of Document

ParamType
method_typeMethodType

Document.verifyRootDocument(document)

Verifies whether document is a valid root DID document according to the IOTA DID method specification.

It must be signed using a verification method with a public key whose BLAKE2b-256 hash matches the DID tag.

Kind: static method of Document

ParamType
documentDocument

Document.diffIndex(message_id) ⇒ string

Deprecated

Returns the Tangle index of the DID diff chain. This should only be called on documents published on the integration chain.

This is the Base58-btc encoded SHA-256 digest of the hex-encoded message id.

Kind: static method of Document

ParamType
message_idstring

Document.fromJSON(json) ⇒ Document

Deserializes a Document from a JSON object.

Kind: static method of Document

ParamType
jsonany

DocumentHistory

A DID Document's history and current state.

Kind: global class

documentHistory.integrationChainData() ⇒ Array.<ResolvedDocument>

Returns an Array of integration chain Documents.

NOTE: clones the data.

Kind: instance method of DocumentHistory

documentHistory.integrationChainSpam() ⇒ Array.<string>

Returns an Array of message id strings for "spam" messages on the same index as the integration chain.

NOTE: clones the data.

Kind: instance method of DocumentHistory

documentHistory.diffChainData() ⇒ Array.<DiffMessage>

Deprecated

Returns an Array of diff chain DiffMessages.

NOTE: clones the data.

Kind: instance method of DocumentHistory

documentHistory.diffChainSpam() ⇒ Array.<string>

Deprecated

Returns an Array of message id strings for "spam" messages on the same index as the diff chain.

NOTE: clones the data.

Kind: instance method of DocumentHistory

documentHistory.toJSON() ⇒ any

Serializes DocumentHistory as a JSON object.

Kind: instance method of DocumentHistory

documentHistory.clone() ⇒ DocumentHistory

Deep clones the object.

Kind: instance method of DocumentHistory

DocumentHistory.fromJSON(json) ⇒ DocumentHistory

Deserializes DocumentHistory from a JSON object.

Kind: static method of DocumentHistory

ParamType
jsonany

DocumentMetadata

Additional attributes related to an IOTA DID Document.

Kind: global class

documentMetadata.previousMessageId ⇒ string

Kind: instance property of DocumentMetadata

documentMetadata.created() ⇒ Timestamp | undefined

Returns a copy of the timestamp of when the DID document was created.

Kind: instance method of DocumentMetadata

documentMetadata.updated() ⇒ Timestamp | undefined

Returns a copy of the timestamp of the last DID document update.

Kind: instance method of DocumentMetadata

documentMetadata.clone() ⇒ DocumentMetadata

Deep clones the object.

Kind: instance method of DocumentMetadata

Duration

A span of time.

Kind: global class

duration.toJSON() ⇒ any

Serializes a Duration as a JSON object.

Kind: instance method of Duration

Duration.seconds(seconds) ⇒ Duration

Create a new Duration with the given number of seconds.

Kind: static method of Duration

ParamType
secondsnumber

Duration.minutes(minutes) ⇒ Duration

Create a new Duration with the given number of minutes.

Kind: static method of Duration

ParamType
minutesnumber

Duration.hours(hours) ⇒ Duration

Create a new Duration with the given number of hours.

Kind: static method of Duration

ParamType
hoursnumber

Duration.days(days) ⇒ Duration

Create a new Duration with the given number of days.

Kind: static method of Duration

ParamType
daysnumber

Duration.weeks(weeks) ⇒ Duration

Create a new Duration with the given number of weeks.

Kind: static method of Duration

ParamType
weeksnumber

Duration.fromJSON(json) ⇒ Duration

Deserializes a Duration from a JSON object.

Kind: static method of Duration

ParamType
jsonany

Ed25519

Kind: global class

Ed25519.PRIVATE_KEY_LENGTH() ⇒ number

Length in bytes of an Ed25519 private key.

Kind: static method of Ed25519

Ed25519.PUBLIC_KEY_LENGTH() ⇒ number

Length in bytes of an Ed25519 public key.

Kind: static method of Ed25519

Ed25519.SIGNATURE_LENGTH() ⇒ number

Length in bytes of an Ed25519 signature.

Kind: static method of Ed25519

Ed25519.sign(message, privateKey) ⇒ Uint8Array

Computes an EdDSA signature using an Ed25519 private key.

NOTE: this differs from Document.signData which uses JCS to canonicalize JSON messages.

The private key must be a 32-byte seed in compliance with RFC 8032. Other implementations often use another format. See this blog post for further explanation.

Kind: static method of Ed25519

ParamType
messageUint8Array
privateKeyUint8Array

Ed25519.verify(message, signature, publicKey)

Verifies an EdDSA signature against an Ed25519 public key.

NOTE: this differs from Document.verifyData which uses JCS to canonicalize JSON messages.

Kind: static method of Ed25519

ParamType
messageUint8Array
signatureUint8Array
publicKeyUint8Array

EncryptedData

The structure returned after encrypting data

Kind: global class

encryptedData.nonce() ⇒ Uint8Array

Returns a copy of the nonce

Kind: instance method of EncryptedData

encryptedData.associatedData() ⇒ Uint8Array

Returns a copy of the associated data

Kind: instance method of EncryptedData

encryptedData.ciphertext() ⇒ Uint8Array

Returns a copy of the ciphertext

Kind: instance method of EncryptedData

encryptedData.tag() ⇒ Uint8Array

Returns a copy of the tag

Kind: instance method of EncryptedData

encryptedData.toJSON() ⇒ any

Serializes EncryptedData as a JSON object.

Kind: instance method of EncryptedData

EncryptedData.fromJSON(json_value) ⇒ EncryptedData

Deserializes EncryptedData from a JSON object.

Kind: static method of EncryptedData

ParamType
json_valueany

EncryptionAlgorithm

Supported content encryption algorithms.

Kind: global class

encryptionAlgorithm.keyLength() ⇒ number

Returns the length of the cipher's key.

Kind: instance method of EncryptionAlgorithm

encryptionAlgorithm.toJSON() ⇒ any

Serializes EncryptionAlgorithm as a JSON object.

Kind: instance method of EncryptionAlgorithm

EncryptionAlgorithm.A256GCM() ⇒ EncryptionAlgorithm

AES GCM using 256-bit key.

Kind: static method of EncryptionAlgorithm

EncryptionAlgorithm.fromJSON(json_value) ⇒ EncryptionAlgorithm

Deserializes EncryptionAlgorithm from a JSON object.

Kind: static method of EncryptionAlgorithm

ParamType
json_valueany

ExplorerUrl

Kind: global class

explorerUrl.messageUrl(message_id) ⇒ string

Returns the web explorer URL of the given message_id.

E.g. https://explorer.iota.org/mainnet/message/{message_id}

Kind: instance method of ExplorerUrl

ParamType
message_idstring

explorerUrl.resolverUrl(did) ⇒ string

Returns the web identity resolver URL for the given DID.

E.g. https://explorer.iota.org/mainnet/identity-resolver/{did}

Kind: instance method of ExplorerUrl

ParamType
didDID | string

explorerUrl.toString() ⇒ string

Kind: instance method of ExplorerUrl

ExplorerUrl.parse(url) ⇒ ExplorerUrl

Constructs a new Tangle explorer URL from a string.

Use ExplorerUrl::mainnet or ExplorerUrl::devnet unless using a private Tangle or local explorer.

Kind: static method of ExplorerUrl

ParamType
urlstring

ExplorerUrl.mainnet() ⇒ ExplorerUrl

Returns the Tangle explorer URL for the mainnet.

Kind: static method of ExplorerUrl

ExplorerUrl.devnet() ⇒ ExplorerUrl

Returns the Tangle explorer URL for the devnet.

Kind: static method of ExplorerUrl

IntegrationChainHistory

Kind: global class

integrationChainHistory.chainData() ⇒ Array.<ResolvedDocument>

Returns an Array of the integration chain Documents.

NOTE: this clones the field.

Kind: instance method of IntegrationChainHistory

integrationChainHistory.spam() ⇒ Array.<string>

Returns an Array of MessageIds as strings.

NOTE: this clones the field.

Kind: instance method of IntegrationChainHistory

integrationChainHistory.toJSON() ⇒ any

Serializes as a JSON object.

Kind: instance method of IntegrationChainHistory

IntegrationChainHistory.fromJSON(json) ⇒ IntegrationChainHistory

Deserializes from a JSON object.

Kind: static method of IntegrationChainHistory

ParamType
jsonany

KeyLocation

The storage location of a verification method key.

A key is uniquely identified by the fragment and a hash of its public key. Importantly, the fragment alone is insufficient to represent the storage location. For example, when rotating a key, there will be two keys in storage for the same identity with the same fragment. The key_hash disambiguates the keys in situations like these.

The string representation of that location can be obtained via canonicalRepr.

Kind: global class

new KeyLocation(keyType, fragment, publicKey)

Create a location from a KeyType, the fragment of a verification method and the bytes of a public key.

ParamType
keyTypenumber
fragmentstring
publicKeyUint8Array

keyLocation.canonical() ⇒ string

Returns the canonical string representation of the location.

This should be used as the representation for storage keys.

Kind: instance method of KeyLocation

keyLocation.keyType() ⇒ number

Returns a copy of the key type of the key location.

Kind: instance method of KeyLocation

keyLocation.toJSON() ⇒ any

Serializes KeyLocation as a JSON object.

Kind: instance method of KeyLocation

keyLocation.toString() ⇒ string

Kind: instance method of KeyLocation

KeyLocation.fromVerificationMethod(method) ⇒ KeyLocation

Obtain the location of a verification method's key in storage.

Kind: static method of KeyLocation

ParamType
methodVerificationMethod

KeyLocation.fromJSON(json_value) ⇒ KeyLocation

Deserializes a JSON object into a KeyLocation.

Kind: static method of KeyLocation

ParamType
json_valueany

KeyPair

Kind: global class

new KeyPair(type_)

Generates a new KeyPair object.

ParamType
type_number

keyPair.type() ⇒ number

Returns the KeyType of the KeyPair object.

Kind: instance method of KeyPair

keyPair.public() ⇒ Uint8Array

Returns a copy of the public key as a Uint8Array.

Kind: instance method of KeyPair

keyPair.private() ⇒ Uint8Array

Returns a copy of the private key as a Uint8Array.

Kind: instance method of KeyPair

keyPair.toJSON() ⇒ any

Serializes a KeyPair object as a JSON object.

Kind: instance method of KeyPair

keyPair.clone() ⇒ KeyPair

Deep clones the object.

Kind: instance method of KeyPair

KeyPair.fromKeys(type_, public_key, private_key) ⇒ KeyPair

Parses a KeyPair object from the public/private keys.

Kind: static method of KeyPair

ParamType
type_number
public_keyUint8Array
private_keyUint8Array

KeyPair.tryFromPrivateKeyBytes(keyType, privateKeyBytes) ⇒ KeyPair

Reconstructs a KeyPair from the bytes of a private key.

The private key for Ed25519 must be a 32-byte seed in compliance with RFC 8032. Other implementations often use another format. See this blog post for further explanation.

Kind: static method of KeyPair

ParamType
keyTypenumber
privateKeyBytesUint8Array

KeyPair.fromJSON(json) ⇒ KeyPair

Deserializes a KeyPair object from a JSON object.

Kind: static method of KeyPair

ParamType
jsonany

MethodContent

Kind: global class

methodContent.toJSON() ⇒ any

Serializes MethodContent as a JSON object.

Kind: instance method of MethodContent

MethodContent.GenerateEd25519() ⇒ MethodContent

Generate and store a new Ed25519 keypair for a new Ed25519VerificationKey2018 method.

Kind: static method of MethodContent

MethodContent.PrivateEd25519(privateKey) ⇒ MethodContent

Store an existing Ed25519 private key and derive a public key from it for a new Ed25519VerificationKey2018 method.

Kind: static method of MethodContent

ParamType
privateKeyUint8Array

MethodContent.PublicEd25519(publicKey) ⇒ MethodContent

Insert an existing Ed25519 public key into a new Ed25519VerificationKey2018 method, without generating or storing a private key.

NOTE: the method will be unable to be used to sign anything without a private key.

Kind: static method of MethodContent

ParamType
publicKeyUint8Array

MethodContent.GenerateX25519() ⇒ MethodContent

Generate and store a new X25519 keypair for a new X25519KeyAgreementKey2019 method.

Kind: static method of MethodContent

MethodContent.PrivateX25519(privateKey) ⇒ MethodContent

Store an existing X25519 private key and derive a public key from it for a new X25519KeyAgreementKey2019 method.

Kind: static method of MethodContent

ParamType
privateKeyUint8Array

MethodContent.PublicX25519(publicKey) ⇒ MethodContent

Insert an existing X25519 public key into a new X25519KeyAgreementKey2019 method, without generating or storing a private key.

NOTE: the method will be unable to be used for key exchange without a private key.

Kind: static method of MethodContent

ParamType
publicKeyUint8Array

MethodContent.fromJSON(json_value) ⇒ MethodContent

Deserializes MethodContent from a JSON object.

Kind: static method of MethodContent

ParamType
json_valueany

MethodData

Supported verification method data formats.

Kind: global class

methodData.tryDecode() ⇒ Uint8Array

Returns a Uint8Array containing the decoded bytes of the MethodData.

This is generally a public key identified by a MethodData value.

Errors

Decoding can fail if MethodData has invalid content or cannot be represented as a vector of bytes.

Kind: instance method of MethodData

methodData.toJSON() ⇒ any

Serializes a MethodData object as a JSON object.

Kind: instance method of MethodData

methodData.clone() ⇒ MethodData

Deep clones the object.

Kind: instance method of MethodData

MethodData.newBase58(data) ⇒ MethodData

Creates a new MethodData variant with Base58-BTC encoded content.

Kind: static method of MethodData

ParamType
dataUint8Array

MethodData.newMultibase(data) ⇒ MethodData

Creates a new MethodData variant with Multibase-encoded content.

Kind: static method of MethodData

ParamType
dataUint8Array

MethodData.fromJSON(json) ⇒ MethodData

Deserializes a MethodData object from a JSON object.

Kind: static method of MethodData

ParamType
jsonany

MethodScope

Supported verification method types.

Kind: global class

methodScope.toString() ⇒ string

Returns the MethodScope as a string.

Kind: instance method of MethodScope

methodScope.toJSON() ⇒ any

Serializes a MethodScope object as a JSON object.

Kind: instance method of MethodScope

methodScope.clone() ⇒ MethodScope

Deep clones the object.

Kind: instance method of MethodScope

MethodScope.VerificationMethod() ⇒ MethodScope

Kind: static method of MethodScope

MethodScope.Authentication() ⇒ MethodScope

Kind: static method of MethodScope

MethodScope.AssertionMethod() ⇒ MethodScope

Kind: static method of MethodScope

MethodScope.KeyAgreement() ⇒ MethodScope

Kind: static method of MethodScope

MethodScope.CapabilityDelegation() ⇒ MethodScope

Kind: static method of MethodScope

MethodScope.CapabilityInvocation() ⇒ MethodScope

Kind: static method of MethodScope

MethodScope.fromJSON(json) ⇒ MethodScope

Deserializes a MethodScope object from a JSON object.

Kind: static method of MethodScope

ParamType
jsonany

MethodType

Supported verification method types.

Kind: global class

methodType.toJSON() ⇒ any

Serializes a MethodType object as a JSON object.

Kind: instance method of MethodType

methodType.toString() ⇒ string

Returns the MethodType as a string.

Kind: instance method of MethodType

methodType.clone() ⇒ MethodType

Deep clones the object.

Kind: instance method of MethodType

MethodType.Ed25519VerificationKey2018() ⇒ MethodType

Kind: static method of MethodType

MethodType.X25519KeyAgreementKey2019() ⇒ MethodType

Kind: static method of MethodType

MethodType.fromJSON(json) ⇒ MethodType

Deserializes a MethodType object from a JSON object.

Kind: static method of MethodType

ParamType
jsonany

Network

Kind: global class

network.name() ⇒ string

Returns a copy of the network name.

Kind: instance method of Network

network.defaultNodeURL() ⇒ string | undefined

Returns a copy of the node URL of the Tangle network.

Kind: instance method of Network

network.toString() ⇒ string

Kind: instance method of Network

network.toJSON() ⇒ any

Serializes a Network as a JSON object.

Kind: instance method of Network

network.clone() ⇒ Network

Deep clones the object.

Kind: instance method of Network

Network.tryFromName(name) ⇒ Network

Parses the provided string to a Network.

Errors if the name is invalid.

Kind: static method of Network

ParamType
namestring

Network.mainnet() ⇒ Network

Kind: static method of Network

Network.devnet() ⇒ Network

Kind: static method of Network

Network.fromJSON(json) ⇒ Network

Deserializes a Network from a JSON object.

Kind: static method of Network

ParamType
jsonany

Presentation

Kind: global class

new Presentation(values)

Constructs a new Presentation.

ParamType
valuesIPresentation

presentation.context() ⇒ Array.<(string|Record.<string, any>)>

Returns a copy of the JSON-LD context(s) applicable to the Presentation.

Kind: instance method of Presentation

presentation.id() ⇒ string | undefined

Returns a copy of the unique URI identifying the Presentation.

Kind: instance method of Presentation

presentation.type() ⇒ Array.<string>

Returns a copy of the URIs defining the type of the Presentation.

Kind: instance method of Presentation

presentation.verifiableCredential() ⇒ Array.<Credential>

Returns a copy of the Credential(s) expressing the claims of the Presentation.

Kind: instance method of Presentation

presentation.holder() ⇒ string | undefined

Returns a copy of the URI of the entity that generated the Presentation.

Kind: instance method of Presentation

presentation.refreshService() ⇒ Array.<RefreshService>

Returns a copy of the service(s) used to refresh an expired Credential in the Presentation.

Kind: instance method of Presentation

presentation.termsOfUse() ⇒ Array.<Policy>

Returns a copy of the terms-of-use specified by the Presentation holder

Kind: instance method of Presentation

presentation.proof() ⇒ Proof | undefined

Returns a copy of the proof used to verify the Presentation.

Kind: instance method of Presentation

presentation.properties() ⇒ Map.<string, any>

Returns a copy of the miscellaneous properties on the Presentation.

Kind: instance method of Presentation

presentation.toJSON() ⇒ any

Serializes a Presentation as a JSON object.

Kind: instance method of Presentation

presentation.clone() ⇒ Presentation

Deep clones the object.

Kind: instance method of Presentation

Presentation.BaseContext() ⇒ string

Returns the base JSON-LD context.

Kind: static method of Presentation

Presentation.BaseType() ⇒ string

Returns the base type.

Kind: static method of Presentation

Presentation.fromJSON(json) ⇒ Presentation

Deserializes a Presentation from a JSON object.

Kind: static method of Presentation

ParamType
jsonany

PresentationValidationOptions

Options to declare validation criteria when validating presentation.

Kind: global class

new PresentationValidationOptions(options)

Creates a new PresentationValidationOptions from the given fields.

Throws an error if any of the options are invalid.

ParamType
optionsIPresentationValidationOptions

presentationValidationOptions.toJSON() ⇒ any

Serializes a PresentationValidationOptions as a JSON object.

Kind: instance method of PresentationValidationOptions

presentationValidationOptions.clone() ⇒ PresentationValidationOptions

Deep clones the object.

Kind: instance method of PresentationValidationOptions

PresentationValidationOptions.default() ⇒ PresentationValidationOptions

Creates a new PresentationValidationOptions with defaults.

Kind: static method of PresentationValidationOptions

PresentationValidationOptions.fromJSON(json) ⇒ PresentationValidationOptions

Deserializes a PresentationValidationOptions from a JSON object.

Kind: static method of PresentationValidationOptions

ParamType
jsonany

PresentationValidator

Kind: global class

PresentationValidator.validate(presentation, holder, issuers, options, fail_fast)

Validate a Presentation.

The following properties are validated according to options:

  • the semantic structure of the presentation,
  • the holder's signature,
  • the relationship between the holder and the credential subjects,
  • the signatures and some properties of the constituent credentials (see CredentialValidator::validate).

Warning

The lack of an error returned from this method is in of itself not enough to conclude that the presentation can be trusted. This section contains more information on additional checks that should be carried out before and after calling this method.

The state of the supplied DID Documents.

The caller must ensure that the DID Documents in holder and issuers are up-to-date. The convenience methods Resolver::resolve_presentation_holder and Resolver::resolve_presentation_issuers can help extract the latest available states of these DID Documents.

Properties that are not validated

There are many properties defined in The Verifiable Credentials Data Model that are not validated, such as: credentialStatus, type, credentialSchema, refreshService, and more. These should be manually checked after validation, according to your requirements.

Errors

An error is returned whenever a validated condition is not satisfied.

Kind: static method of PresentationValidator

ParamType
presentationPresentation
holderDocument | ResolvedDocument
issuersArray.<Document> | Array.<ResolvedDocument>
optionsPresentationValidationOptions
fail_fastnumber

PresentationValidator.verifyPresentationSignature(presentation, holder, options)

Verify the presentation's signature using the resolved document of the holder.

Warning

The caller must ensure that the DID Document of the holder is up-to-date.

Errors

Fails if the holder does not match the presentation's holder property. Fails if signature verification against the holder document fails.

Kind: static method of PresentationValidator

ParamType
presentationPresentation
holderDocument | ResolvedDocument
optionsVerifierOptions

PresentationValidator.checkStructure(presentation)

Validates the semantic structure of the Presentation.

Kind: static method of PresentationValidator

ParamType
presentationPresentation

Proof

A digital signature.

For field definitions see: https://w3c-ccg.github.io/security-vocab/

Kind: global class

proof.type() ⇒ string

Returns a copy of the proof type.

Kind: instance method of Proof

proof.value() ⇒ string

Returns a copy of the proof value string.

Kind: instance method of Proof

proof.verificationMethod() ⇒ string

Returns a copy of the identifier of the DID method used to create this proof.

Kind: instance method of Proof

proof.created() ⇒ Timestamp | undefined

When the proof was generated.

Kind: instance method of Proof

proof.expires() ⇒ Timestamp | undefined

When the proof expires.

Kind: instance method of Proof

proof.challenge() ⇒ string | undefined

Challenge from a proof requester to mitigate replay attacks.

Kind: instance method of Proof

proof.domain() ⇒ string | undefined

Domain for which a proof is valid to mitigate replay attacks.

Kind: instance method of Proof

proof.purpose() ⇒ ProofPurpose | undefined

Purpose for which the proof was generated.

Kind: instance method of Proof

proof.toJSON() ⇒ any

Serializes a Proof to a JSON object.

Kind: instance method of Proof

proof.clone() ⇒ Proof

Deep clones the object.

Kind: instance method of Proof

Proof.fromJSON(json) ⇒ Proof

Deserializes a Proof from a JSON object.

Kind: static method of Proof

ParamType
jsonany

ProofOptions

Holds additional options for creating signatures. See IProofOptions.

Kind: global class

new ProofOptions(options)

Creates a new ProofOptions from the given fields.

Throws an error if any of the options are invalid.

ParamType
optionsIProofOptions

proofOptions.clone() ⇒ ProofOptions

Deep clones the object.

Kind: instance method of ProofOptions

ProofOptions.default() ⇒ ProofOptions

Creates a new ProofOptions with default options.

Kind: static method of ProofOptions

ProofPurpose

Associates a purpose with a Proof.

See https://w3c-ccg.github.io/security-vocab/#proofPurpose

Kind: global class

proofPurpose.toJSON() ⇒ any

Serializes a ProofPurpose to a JSON object.

Kind: instance method of ProofPurpose

proofPurpose.clone() ⇒ ProofPurpose

Deep clones the object.

Kind: instance method of ProofPurpose

ProofPurpose.assertionMethod() ⇒ ProofPurpose

Purpose is to assert a claim. See https://www.w3.org/TR/did-core/#assertion

Kind: static method of ProofPurpose

ProofPurpose.authentication() ⇒ ProofPurpose

Purpose is to authenticate the signer. See https://www.w3.org/TR/did-core/#authentication

Kind: static method of ProofPurpose

ProofPurpose.fromJSON(json) ⇒ ProofPurpose

Deserializes a ProofPurpose from a JSON object.

Kind: static method of ProofPurpose

ParamType
jsonany

Receipt

Kind: global class

receipt.network() ⇒ Network

Returns a copy of the associated IOTA Tangle Network.

Kind: instance method of Receipt

receipt.messageId() ⇒ string

Returns a copy of the message id.

Kind: instance method of Receipt

receipt.networkId() ⇒ string

Returns a copy of the message network_id.

Kind: instance method of Receipt

receipt.nonce() ⇒ string

Returns a copy of the message nonce.

Kind: instance method of Receipt

receipt.toJSON() ⇒ any

Serializes a Receipt as a JSON object.

Kind: instance method of Receipt

receipt.clone() ⇒ Receipt

Deep clones the object.

Kind: instance method of Receipt

Receipt.fromJSON(json) ⇒ Receipt

Deserializes a Receipt from a JSON object.

Kind: static method of Receipt

ParamType
jsonany

ResolvedDocument

An IOTA DID document resolved from the Tangle. Represents an integration chain message possibly merged with one or more DiffMessages.

Kind: global class

resolvedDocument.mergeDiffMessage(diff_message)

Deprecated

Attempts to merge changes from a DiffMessage into this document and updates the ResolvedDocument::diffMessageId.

If merging fails the document remains unmodified, otherwise this represents the merged document state.

See Document::mergeDiff.

Errors

Fails if the merge operation or signature verification on the diff fails.

Kind: instance method of ResolvedDocument

ParamType
diff_messageDiffMessage

resolvedDocument.document() ⇒ Document

Returns a copy of the inner DID document.

NOTE: If the ResolvedDocument is no longer needed after calling this method then consider using intoDocument() for efficiency.

Kind: instance method of ResolvedDocument

resolvedDocument.intoDocument() ⇒ Document

Consumes this object and returns the inner DID document.

NOTE: trying to use the ResolvedDocument after calling this will throw an error.

Kind: instance method of ResolvedDocument

resolvedDocument.diffMessageId() ⇒ string

Deprecated

Returns a copy of the diff chain message id.

Kind: instance method of ResolvedDocument

resolvedDocument.setDiffMessageId(value)

Deprecated

Sets the diff chain message id.

Kind: instance method of ResolvedDocument

ParamType
valuestring

resolvedDocument.integrationMessageId() ⇒ string

Returns a copy of the integration chain message id.

Kind: instance method of ResolvedDocument

resolvedDocument.setIntegrationMessageId(value)

Sets the integration chain message id.

Kind: instance method of ResolvedDocument

ParamType
valuestring

resolvedDocument.toJSON() ⇒ any

Serializes a Document object as a JSON object.

Kind: instance method of ResolvedDocument

resolvedDocument.clone() ⇒ ResolvedDocument

Deep clones the object.

Kind: instance method of ResolvedDocument

ResolvedDocument.fromJSON(json) ⇒ ResolvedDocument

Deserializes a Document object from a JSON object.

Kind: static method of ResolvedDocument

ParamType
jsonany

Resolver

Kind: global class

new Resolver()

Constructs a new Resolver with a default Client for the Mainnet.

resolver.getClient(network_name) ⇒ Client | undefined

Returns the Client corresponding to the given network name if one exists.

Kind: instance method of Resolver

ParamType
network_namestring

resolver.resolve(did) ⇒ Promise.<ResolvedDocument>

Fetches the Document of the given DID.

Kind: instance method of Resolver

ParamType
didDID | string

resolver.resolveHistory(did) ⇒ Promise.<DocumentHistory>

Fetches the DocumentHistory of the given DID.

Kind: instance method of Resolver

ParamType
didDID | string

resolver.resolveDiffHistory(document) ⇒ Promise.<DiffChainHistory>

Deprecated

Returns the DiffChainHistory of a diff chain starting from a Document on the integration chain.

NOTE: the document must have been published to the Tangle and have a valid message id.

Kind: instance method of Resolver

ParamType
documentResolvedDocument

resolver.resolveCredentialIssuer(credential) ⇒ Promise.<ResolvedDocument>

Fetches the DID Document of the issuer on a Credential.

Errors

Errors if the issuer URL is not a valid DID or document resolution fails.

Kind: instance method of Resolver

ParamType
credentialCredential

resolver.resolvePresentationIssuers(presentation) ⇒ Promise.<Array.<ResolvedDocument>>

Fetches all DID Documents of Credential issuers contained in a Presentation. Issuer documents are returned in arbitrary order.

Errors

Errors if any issuer URL is not a valid DID or document resolution fails.

Kind: instance method of Resolver

ParamType
presentationPresentation

resolver.resolvePresentationHolder(presentation) ⇒ Promise.<ResolvedDocument>

Fetches the DID Document of the holder of a Presentation.

Errors

Errors if the holder URL is missing, is not a valid DID, or document resolution fails.

Kind: instance method of Resolver

ParamType
presentationPresentation

resolver.verifyPresentation(presentation, options, fail_fast, holder, issuers) ⇒ Promise.<void>

Verifies a Presentation.

Important

See PresentationValidator::validate for information about which properties get validated and what is expected of the optional arguments holder and issuer.

Resolution

The DID Documents for the holder and issuers are optionally resolved if not given. If you already have up-to-date versions of these DID Documents, you may want to use PresentationValidator::validate. See also Resolver::resolvePresentationIssuers and Resolver::resolvePresentationHolder.

Errors

Errors from resolving the holder and issuer DID Documents, if not provided, will be returned immediately. Otherwise, errors from validating the presentation and its credentials will be returned according to the fail_fast parameter.

Kind: instance method of Resolver

ParamType
presentationPresentation
optionsPresentationValidationOptions
fail_fastnumber
holderResolvedDocument | undefined
issuersArray.<ResolvedDocument> | undefined

Resolver.builder() ⇒ ResolverBuilder

Returns a ResolverBuilder to construct a new Resolver.

Kind: static method of Resolver

ResolverBuilder

Builder for configuring [Clients][client] when constructing a [Resolver].

Kind: global class

new ResolverBuilder()

Constructs a new ResolverBuilder with no Clients configured.

resolverBuilder.client(client) ⇒ ResolverBuilder

Inserts a Client.

NOTE: replaces any previous Client or Config with the same network name.

Kind: instance method of ResolverBuilder

ParamType
clientClient

resolverBuilder.clientConfig(config) ⇒ ResolverBuilder

Inserts a Config used to create a Client.

NOTE: replaces any previous Client or Config with the same network name.

Kind: instance method of ResolverBuilder

ParamType
configIClientConfig

resolverBuilder.build() ⇒ Promise.<Resolver>

Constructs a new [Resolver] based on the builder configuration.

Kind: instance method of ResolverBuilder

RevocationBitmap

A compressed bitmap for managing credential revocation.

Kind: global class

new RevocationBitmap()

Creates a new RevocationBitmap instance.

revocationBitmap.isRevoked(index) ⇒ boolean

Returns true if the credential at the given index is revoked.

Kind: instance method of RevocationBitmap

ParamType
indexnumber

revocationBitmap.revoke(index) ⇒ boolean

Mark the given index as revoked.

Returns true if the index was absent from the set.

Kind: instance method of RevocationBitmap

ParamType
indexnumber

revocationBitmap.unrevoke(index) ⇒ boolean

Mark the index as not revoked.

Returns true if the index was present in the set.

Kind: instance method of RevocationBitmap

ParamType
indexnumber

revocationBitmap.len() ⇒ number

Returns the number of revoked credentials.

Kind: instance method of RevocationBitmap

revocationBitmap.toEndpoint() ⇒ string | Array.<string> | Map.<string, Array.<string>>

Return the bitmap as a data url embedded in a service endpoint.

Kind: instance method of RevocationBitmap

RevocationBitmap.type() ⇒ string

The name of the service type.

Kind: static method of RevocationBitmap

RevocationBitmap.fromEndpoint(endpoint) ⇒ RevocationBitmap

Construct a RevocationBitmap from a data url.

Kind: static method of RevocationBitmap

ParamType
endpointstring | Array.<string> | Map.<string, Array.<string>>

Service

A DID Document Service used to enable trusted interactions associated with a DID subject.

See: https://www.w3.org/TR/did-core/#services

Kind: global class

new Service(service)

ParamType
serviceIService

service.id() ⇒ DIDUrl

Returns a copy of the Service id.

Kind: instance method of Service

service.type() ⇒ string

Returns a copy of the Service type.

Kind: instance method of Service

service.serviceEndpoint() ⇒ string | Array.<string> | Map.<string, Array.<string>>

Returns a copy of the Service endpoint.

Kind: instance method of Service

service.properties() ⇒ Map.<string, any>

Returns a copy of the custom properties on the Service.

Kind: instance method of Service

service.toJSON() ⇒ any

Serializes a Service object as a JSON object.

Kind: instance method of Service

service.clone() ⇒ Service

Deep clones the object.

Kind: instance method of Service

Service.fromJSON(value) ⇒ Service

Deserializes a Service object from a JSON object.

Kind: static method of Service

ParamType
valueany

Signature

Kind: global class

new Signature(data)

Creates a new Signature.

ParamType
dataUint8Array

signature.asBytes() ⇒ Uint8Array

Returns a copy of the signature as a UInt8Array.

Kind: instance method of Signature

signature.toJSON() ⇒ any

Serializes a Signature as a JSON object.

Kind: instance method of Signature

Signature.fromJSON(json_value) ⇒ Signature

Deserializes a JSON object as Signature.

Kind: static method of Signature

ParamType
json_valueany

StorageTestSuite

A test suite for the Storage interface.

This module contains a set of tests that a correct storage implementation should pass. Note that not every edge case is tested.

Tests usually rely on multiple interface methods being implemented, so they should only be run on a fully implemented version. That's why there is not a single test case for every interface method.

Kind: global class

StorageTestSuite.didCreateGenerateKeyTest(storage) ⇒ Promise.<void>

Kind: static method of StorageTestSuite

ParamType
storageStorage

StorageTestSuite.didCreatePrivateKeyTest(storage) ⇒ Promise.<void>

Kind: static method of StorageTestSuite

ParamType
storageStorage

StorageTestSuite.didListTest(storage) ⇒ Promise.<void>

Kind: static method of StorageTestSuite

ParamType
storageStorage

StorageTestSuite.didPurgeTest(storage) ⇒ Promise.<void>

Kind: static method of StorageTestSuite

ParamType
storageStorage

StorageTestSuite.keyGenerateTest(storage) ⇒ Promise.<void>

Kind: static method of StorageTestSuite

ParamType
storageStorage

StorageTestSuite.keyDeleteTest(storage) ⇒ Promise.<void>

Kind: static method of StorageTestSuite

ParamType
storageStorage

StorageTestSuite.keyInsertTest(storage) ⇒ Promise.<void>

Kind: static method of StorageTestSuite

ParamType
storageStorage

StorageTestSuite.keySignEd25519Test(storage) ⇒ Promise.<void>

Kind: static method of StorageTestSuite

ParamType
storageStorage

StorageTestSuite.encryptionTest(alice_storage, bob_storage) ⇒ Promise.<void>

Kind: static method of StorageTestSuite

ParamType
alice_storageStorage
bob_storageStorage

Timestamp

Kind: global class

timestamp.toRFC3339() ⇒ string

Returns the Timestamp as an RFC 3339 String.

Kind: instance method of Timestamp

timestamp.checkedAdd(duration) ⇒ Timestamp | undefined

Computes self + duration

Returns null if the operation leads to a timestamp not in the valid range for RFC 3339.

Kind: instance method of Timestamp

ParamType
durationDuration

timestamp.checkedSub(duration) ⇒ Timestamp | undefined

Computes self - duration

Returns null if the operation leads to a timestamp not in the valid range for RFC 3339.

Kind: instance method of Timestamp

ParamType
durationDuration

timestamp.toJSON() ⇒ any

Serializes a Timestamp as a JSON object.

Kind: instance method of Timestamp

Timestamp.parse(input) ⇒ Timestamp

Parses a Timestamp from the provided input string.

Kind: static method of Timestamp

ParamType
inputstring

Timestamp.nowUTC() ⇒ Timestamp

Creates a new Timestamp with the current date and time.

Kind: static method of Timestamp

Timestamp.fromJSON(json) ⇒ Timestamp

Deserializes a Timestamp from a JSON object.

Kind: static method of Timestamp

ParamType
jsonany

VerificationMethod

Kind: global class

new VerificationMethod(did, key_type, public_key, fragment)

Creates a new VerificationMethod object from the given did and public key.

ParamType
didDID
key_typenumber
public_keyUint8Array
fragmentstring

verificationMethod.id() ⇒ DIDUrl

Returns a copy of the id DIDUrl of the VerificationMethod object.

Kind: instance method of VerificationMethod

verificationMethod.controller() ⇒ DID

Returns a copy of the controller DID of the VerificationMethod object.

Kind: instance method of VerificationMethod

verificationMethod.SetController(did)

Sets the controller DID of the VerificationMethod object.

Kind: instance method of VerificationMethod

ParamType
didDID

verificationMethod.type() ⇒ MethodType

Returns a copy of the VerificationMethod type.

Kind: instance method of VerificationMethod

verificationMethod.data() ⇒ MethodData

Returns a copy of the VerificationMethod public key data.

Kind: instance method of VerificationMethod

verificationMethod.toJSON() ⇒ any

Serializes a VerificationMethod object as a JSON object.

Kind: instance method of VerificationMethod

verificationMethod.clone() ⇒ VerificationMethod

Deep clones the object.

Kind: instance method of VerificationMethod

VerificationMethod.fromJSON(value) ⇒ VerificationMethod

Deserializes a VerificationMethod object from a JSON object.

Kind: static method of VerificationMethod

ParamType
valueany

VerifierOptions

Holds additional proof verification options. See IVerifierOptions.

Kind: global class

new VerifierOptions(options)

Creates a new VerifierOptions from the given fields.

Throws an error if any of the options are invalid.

ParamType
optionsIVerifierOptions

verifierOptions.toJSON() ⇒ any

Serializes a VerifierOptions as a JSON object.

Kind: instance method of VerifierOptions

verifierOptions.clone() ⇒ VerifierOptions

Deep clones the object.

Kind: instance method of VerifierOptions

VerifierOptions.default() ⇒ VerifierOptions

Creates a new VerifierOptions with default options.

Kind: static method of VerifierOptions

VerifierOptions.fromJSON(json) ⇒ VerifierOptions

Deserializes a VerifierOptions from a JSON object.

Kind: static method of VerifierOptions

ParamType
jsonany

X25519

An implementation of X25519 Elliptic-curve Diffie-Hellman (ECDH) cryptographic key exchange.

Kind: global class

X25519.PRIVATE_KEY_LENGTH() ⇒ number

Length in bytes of an X25519 private key.

Kind: static method of X25519

X25519.PUBLIC_KEY_LENGTH() ⇒ number

Length in bytes of an X25519 public key.

Kind: static method of X25519

X25519.keyExchange(privateKey, publicKey) ⇒ Uint8Array

Performs Diffie-Hellman key exchange using the private key of the first party with the public key of the second party, resulting in a shared secret.

Kind: static method of X25519

ParamType
privateKeyUint8Array
publicKeyUint8Array

X25519.Ed25519toX25519Private(privateKey) ⇒ Uint8Array

Transforms an Ed25519 private key to an X25519 private key.

This is possible because Ed25519 is birationally equivalent to Curve25519 used by X25519.

Kind: static method of X25519

ParamType
privateKeyUint8Array

X25519.Ed25519toX25519Public(publicKey) ⇒ Uint8Array

Transforms an Ed25519 public key to an X25519 public key.

This is possible because Ed25519 is birationally equivalent to Curve25519 used by X25519.

Kind: static method of X25519

ParamType
publicKeyUint8Array

DIDMessageEncoding

Kind: global variable

StatusCheck

Controls validation behaviour when checking whether or not a credential has been revoked by its credentialStatus.

Kind: global variable

Strict

Validate the status if supported, reject any unsupported credentialStatus types.

Only RevocationBitmap2022 is currently supported.

This is the default.

Kind: global variable

SkipUnsupported

Validate the status if supported, skip any unsupported credentialStatus types.

Kind: global variable

SkipAll

Skip all status checks.

Kind: global variable

SubjectHolderRelationship

Declares how credential subjects must relate to the presentation holder during validation. See PresentationValidationOptions::subject_holder_relationship.

See also the Subject-Holder Relationship section of the specification.

Kind: global variable

AlwaysSubject

The holder must always match the subject on all credentials, regardless of their nonTransferable property. This variant is the default used if no other variant is specified when constructing a new PresentationValidationOptions.

Kind: global variable

SubjectOnNonTransferable

The holder must match the subject only for credentials where the nonTransferable property is true.

Kind: global variable

Any

The holder is not required to have any kind of relationship to any credential subject.

Kind: global variable

FailFast

Declares when validation should return if an error occurs.

Kind: global variable

AllErrors

Return all errors that occur during validation.

Kind: global variable

FirstError

Return after the first error occurs.

Kind: global variable

KeyType

Kind: global variable

MethodRelationship

Kind: global variable

start()

Initializes the console error panic hook for better error messages

Kind: global function