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