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
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.
- 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
DiffChainHistoryDiffMessageDefines the difference between two DID
Document
s' 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.
- 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.
- 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 its
credentialStatus
.- Strict
Validate the status if supported, reject any unsupported
credentialStatus
types.Only
RevocationBitmap2022
is currently supported.This is the default.
- SkipUnsupported
Validate the status if supported, skip any unsupported
credentialStatus
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 istrue
.- 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>
- .createMethod(options) ⇒
Promise.<void>
- .detachMethodRelationships(options) ⇒
Promise.<void>
- .did() ⇒
DID
- .autopublish() ⇒
boolean
- .autosave() ⇒
AutoSave
- .document() ⇒
Document
- .resolveIdentity() ⇒
Promise.<ResolvedDocument>
- .deleteIdentity() ⇒
Promise.<void>
- .publish(publish_options) ⇒
Promise.<void>
- .createSignedCredential(fragment, credential, options) ⇒
Promise.<Credential>
- .createSignedDocument(fragment, document, options) ⇒
Promise.<Document>
- .createSignedPresentation(fragment, presentation, options) ⇒
Promise.<Presentation>
- .createSignedData(fragment, data, options) ⇒
Promise.<any>
- .updateDocumentUnchecked(document) ⇒
Promise.<void>
- .fetchDocument() ⇒
Promise.<void>
- .revokeCredentials(fragment, credentialIndices) ⇒
Promise.<void>
- .unrevokeCredentials(fragment, credentialIndices) ⇒
Promise.<void>
- .encryptData(plaintext, associated_data, encryption_algorithm, cek_algorithm, public_key) ⇒
Promise.<EncryptedData>
- .decryptData(data, encryption_algorithm, cek_algorithm, fragment) ⇒
Promise.<Uint8Array>
- .setAlsoKnownAs(options) ⇒
Promise.<void>
- .deleteMethod(options) ⇒
Promise.<void>
- .deleteService(options) ⇒
Promise.<void>
- .setController(options) ⇒
Promise.<void>
- .createService(options) ⇒
Promise.<void>
- .attachMethodRelationships(options) ⇒
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
Param | Type |
---|---|
options | AttachMethodRelationshipOptions |
account.createMethod(options) ⇒ Promise.<void>
Adds a new verification method to the DID document.
Kind: instance method of Account
Param | Type |
---|---|
options | CreateMethodOptions |
account.detachMethodRelationships(options) ⇒ Promise.<void>
Detaches the given relationship from the given method, if the method exists.
Kind: instance method of Account
Param | Type |
---|---|
options | DetachMethodRelationshipOptions |
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
Param | Type |
---|---|
publish_options | PublishOptions | undefined |
account.createSignedCredential(fragment, credential, options) ⇒ Promise.<Credential>
Signs a Credential with the key specified by fragment
.
Kind: instance method of Account
Param | Type |
---|---|
fragment | string |
credential | Credential |
options | ProofOptions |
account.createSignedDocument(fragment, document, options) ⇒ Promise.<Document>
Signs a Document with the key specified by fragment
.
Kind: instance method of Account
Param | Type |
---|---|
fragment | string |
document | Document |
options | ProofOptions |
account.createSignedPresentation(fragment, presentation, options) ⇒ Promise.<Presentation>
Signs a Presentation the key specified by fragment
.
Kind: instance method of Account
Param | Type |
---|---|
fragment | string |
presentation | Presentation |
options | ProofOptions |
account.createSignedData(fragment, data, options) ⇒ Promise.<any>
Signs arbitrary data
with the key specified by fragment
.
Kind: instance method of Account
Param | Type |
---|---|
fragment | string |
data | any |
options | ProofOptions |
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
Param | Type |
---|---|
document | Document |
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
Param | Type |
---|---|
fragment | string |
credentialIndices | number | 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
Param | Type |
---|---|
fragment | string |
credentialIndices | number | 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
Param | Type |
---|---|
plaintext | Uint8Array |
associated_data | Uint8Array |
encryption_algorithm | EncryptionAlgorithm |
cek_algorithm | CekAlgorithm |
public_key | Uint8Array |
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
Param | Type |
---|---|
data | EncryptedData |
encryption_algorithm | EncryptionAlgorithm |
cek_algorithm | CekAlgorithm |
fragment | string |
account.setAlsoKnownAs(options) ⇒ Promise.<void>
Sets the alsoKnownAs
property in the DID document.
Kind: instance method of Account
Param | Type |
---|---|
options | SetAlsoKnownAsOptions |
account.deleteMethod(options) ⇒ Promise.<void>
Deletes a verification method if the method exists.
Kind: instance method of Account
Param | Type |
---|---|
options | DeleteMethodOptions |
account.deleteService(options) ⇒ Promise.<void>
Deletes a Service if it exists.
Kind: instance method of Account
Param | Type |
---|---|
options | DeleteServiceOptions |
account.setController(options) ⇒ Promise.<void>
Sets the controllers of the DID document.
Kind: instance method of Account
Param | Type |
---|---|
options | SetControllerOptions |
account.createService(options) ⇒ Promise.<void>
Adds a new Service to the DID Document.
Kind: instance method of Account
Param | Type |
---|---|
options | CreateServiceOptions |
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
.
Param | Type |
---|---|
options | AccountBuilderOptions | 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
Param | Type |
---|---|
did | DID |
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
Param | Type |
---|---|
identity_setup | IdentitySetup | undefined |
AgreementInfo
Agreement information used as the input for the concat KDF.
Kind: global class
- AgreementInfo
- new AgreementInfo(apu, apv, pub_info, priv_info)
- instance
- .apu() ⇒
Uint8Array
- .apv() ⇒
Uint8Array
- .pubInfo() ⇒
Uint8Array
- .privInfo() ⇒
Uint8Array
- .toJSON() ⇒
any
- static
- .fromJSON(json_value) ⇒
AgreementInfo
new AgreementInfo(apu, apv, pub_info, priv_info)
Creates an AgreementInfo
Object.
Param | Type |
---|---|
apu | Uint8Array |
apv | Uint8Array |
pub_info | Uint8Array |
priv_info | Uint8Array |
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
Param | Type |
---|---|
json_value | any |
AutoSave
Kind: global class
- AutoSave
- instance
- .toJSON() ⇒
any
- static
- .never() ⇒
AutoSave
- .every() ⇒
AutoSave
- .batch(number_of_actions) ⇒
AutoSave
- .fromJSON(json_value) ⇒
AutoSave
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
Param | Type |
---|---|
number_of_actions | number |
AutoSave.fromJSON(json_value) ⇒ AutoSave
Deserializes AutoSave
from a JSON object.
Kind: static method of AutoSave
Param | Type |
---|---|
json_value | any |
CekAlgorithm
Supported algorithms used to determine and potentially encrypt the content encryption key (CEK).
Kind: global class
- CekAlgorithm
- instance
- .toJSON() ⇒
any
- static
- .EcdhEs(agreement) ⇒
CekAlgorithm
- .EcdhEsA256Kw(agreement) ⇒
CekAlgorithm
- .fromJSON(json_value) ⇒
CekAlgorithm
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
Param | Type |
---|---|
agreement | AgreementInfo |
CekAlgorithm.EcdhEsA256Kw(agreement) ⇒ CekAlgorithm
Elliptic Curve Diffie-Hellman Ephemeral Static key agreement using Concat KDF.
Kind: static method of CekAlgorithm
Param | Type |
---|---|
agreement | AgreementInfo |
CekAlgorithm.fromJSON(json_value) ⇒ CekAlgorithm
Deserializes CekAlgorithm
from a JSON object.
Kind: static method of CekAlgorithm
Param | Type |
---|---|
json_value | any |
ChainState
Kind: global class
- ChainState
- instance
- .toJSON() ⇒
any
- static
- .fromJSON(json_value) ⇒
ChainState
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
Param | Type |
---|---|
json_value | any |
Client
Kind: global class
- Client
- new Client()
- instance
- .network() ⇒
Network
- .publishDocument(document) ⇒
Promise.<Receipt>
.publishDiff(message_id, diff) ⇒Promise.<Receipt>
- .publishJSON(index, data) ⇒
Promise.<Receipt>
- .publishJsonWithRetry(index, data, interval, max_attempts) ⇒
Promise.<any>
- .isMessageIncluded(messageId) ⇒
Promise.<boolean>
- .resolve(did) ⇒
Promise.<ResolvedDocument>
- .resolveHistory(did) ⇒
Promise.<DocumentHistory>
.resolveDiffHistory(document) ⇒Promise.<DiffChainHistory>
- static
- .fromConfig(config) ⇒
Promise.<Client>
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
Param | Type |
---|---|
document | Document |
client.publishDiff(message_id, diff) ⇒ Promise.<Receipt>
Promise.<Receipt>
Deprecated
Publishes a DiffMessage
to the Tangle.
Kind: instance method of Client
Param | Type |
---|---|
message_id | string |
diff | DiffMessage |
client.publishJSON(index, data) ⇒ Promise.<Receipt>
Publishes arbitrary JSON data to the specified index on the Tangle.
Kind: instance method of Client
Param | Type |
---|---|
index | string |
data | any |
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
Param | Type |
---|---|
index | string |
data | any |
interval | number | undefined |
max_attempts | number | undefined |
client.isMessageIncluded(messageId) ⇒ Promise.<boolean>
Checks if a message is confirmed by a milestone.
Kind: instance method of Client
Param | Type |
---|---|
messageId | string |
client.resolve(did) ⇒ Promise.<ResolvedDocument>
Fetch the DID document specified by the given DID
.
Kind: instance method of Client
Param | Type |
---|---|
did | DID | string |
client.resolveHistory(did) ⇒ Promise.<DocumentHistory>
Returns the message history of the given DID.
Kind: instance method of Client
Param | Type |
---|---|
did | DID | string |
client.resolveDiffHistory(document) ⇒ Promise.<DiffChainHistory>
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
Param | Type |
---|---|
document | ResolvedDocument |
Client.fromConfig(config) ⇒ Promise.<Client>
Creates a new Client
with the given settings.
Kind: static method of Client
Param | Type |
---|---|
config | IClientConfig |
Credential
Kind: global class
- Credential
- new Credential(values)
- instance
- .context() ⇒
Array.<(string|Record.<string, any>)>
- .id() ⇒
string
|undefined
- .type() ⇒
Array.<string>
- .credentialSubject() ⇒
Array.<Subject>
- .issuer() ⇒
string
|Issuer
- .issuanceDate() ⇒
Timestamp
- .expirationDate() ⇒
Timestamp
|undefined
- .credentialStatus() ⇒
Array.<Status>
- .credentialSchema() ⇒
Array.<Schema>
- .refreshService() ⇒
Array.<RefreshService>
- .termsOfUse() ⇒
Array.<Policy>
- .evidence() ⇒
Array.<Evidence>
- .nonTransferable() ⇒
boolean
|undefined
- .proof() ⇒
Proof
|undefined
- .properties() ⇒
Map.<string, any>
- .toJSON() ⇒
any
- .clone() ⇒
Credential
- static
- .BaseContext() ⇒
string
- .BaseType() ⇒
string
- .fromJSON(json) ⇒
Credential
new Credential(values)
Constructs a new Credential
.
Param | Type |
---|---|
values | ICredential |
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
Param | Type |
---|---|
json | any |
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.
Param | Type |
---|---|
options | ICredentialValidationOptions |
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
Param | Type |
---|---|
json | any |
CredentialValidator
Kind: global class
- CredentialValidator
- .validate(credential, issuer, options, fail_fast)
- .checkStructure(credential)
- .checkExpiresOnOrAfter(credential, timestamp)
- .checkIssuedOnOrBefore(credential, timestamp)
- .verifySignature(credential, trusted_issuers, options)
- .check_subject_holder_relationship(credential, holder_url, relationship)
- .checkStatus(credential, trustedIssuers, statusCheck)
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
Param | Type |
---|---|
credential | Credential |
issuer | Document | ResolvedDocument |
options | CredentialValidationOptions |
fail_fast | number |
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
Param | Type |
---|---|
credential | Credential |
CredentialValidator.checkExpiresOnOrAfter(credential, timestamp)
Validate that the credential expires on or after the specified timestamp.
Kind: static method of CredentialValidator
Param | Type |
---|---|
credential | Credential |
timestamp | Timestamp |
CredentialValidator.checkIssuedOnOrBefore(credential, timestamp)
Validate that the credential is issued on or before the specified timestamp.
Kind: static method of CredentialValidator
Param | Type |
---|---|
credential | Credential |
timestamp | Timestamp |
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
Param | Type |
---|---|
credential | Credential |
trusted_issuers | Array.<Document> | Array.<ResolvedDocument> |
options | VerifierOptions |
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
Param | Type |
---|---|
credential | Credential |
holder_url | string |
relationship | number |
CredentialValidator.checkStatus(credential, trustedIssuers, statusCheck)
Checks whether the credential status has been revoked.
Only supports BitmapRevocation2022
.
Kind: static method of CredentialValidator
Param | Type |
---|---|
credential | Credential |
trustedIssuers | Array.<Document> | Array.<ResolvedDocument> |
statusCheck | number |
DID
Kind: global class
- DID
- new DID(public_key, network)
- instance
- .networkName ⇒
string
- .network() ⇒
Network
- .tag() ⇒
string
- .join(segment) ⇒
DIDUrl
- .toUrl() ⇒
DIDUrl
- .intoUrl() ⇒
DIDUrl
- .toString() ⇒
string
- .toJSON() ⇒
any
- .clone() ⇒
DID
- static
- .parse(input) ⇒
DID
- .fromJSON(json_value) ⇒
DID
new DID(public_key, network)
Creates a new DID
from a public key.
Param | Type |
---|---|
public_key | Uint8Array |
network | string | 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
Param | Type |
---|---|
segment | string |
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
Param | Type |
---|---|
input | string |
DID.fromJSON(json_value) ⇒ DID
Deserializes a JSON object as DID
.
Kind: static method of DID
Param | Type |
---|---|
json_value | any |
DIDUrl
Kind: global class
- DIDUrl
- instance
- .did() ⇒
DID
- .urlStr() ⇒
string
- .fragment() ⇒
string
|undefined
- .setFragment(value)
- .path() ⇒
string
|undefined
- .setPath(value)
- .query() ⇒
string
|undefined
- .setQuery(value)
- .join(segment) ⇒
DIDUrl
- .toString() ⇒
string
- .toJSON() ⇒
any
- .clone() ⇒
DIDUrl
- static
- .parse(input) ⇒
DIDUrl
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
Param | Type |
---|---|
value | string | 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
Param | Type |
---|---|
value | string | 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
Param | Type |
---|---|
value | string | 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
Param | Type |
---|---|
segment | string |
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
Param | Type |
---|---|
input | string |
DiffChainHistory
Deprecated
Kind: global class
DiffChainHistory- instance
- .chainData() ⇒
Array.<DiffMessage>
- .spam() ⇒
Array.<string>
- .toJSON() ⇒
any
- static
- .fromJSON(json) ⇒
DiffChainHistory
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
Param | Type |
---|---|
json | any |
DiffMessage
Deprecated
Defines the difference between two DID Document
s' JSON representations.
Kind: global class
DiffMessage- instance
.id() ⇒DID
.did() ⇒DID
.diff() ⇒string
.messageId() ⇒string
.setMessageId(message_id).previousMessageId() ⇒string
.setPreviousMessageId(message_id).proof() ⇒Proof
|undefined
.merge(document) ⇒Document
.toJSON() ⇒any
- .clone() ⇒
DiffMessage
- static
.fromJSON(json) ⇒DiffMessage
diffMessage.id() ⇒ DID
DID
Deprecated
Returns the DID of the associated DID Document.
NOTE: clones the data.
Kind: instance method of DiffMessage
diffMessage.did() ⇒ DID
DID
Deprecated
Returns a copy of the DID of the associated DID Document.
Kind: instance method of DiffMessage
diffMessage.diff() ⇒ string
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
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
Param | Type |
---|---|
message_id | string |
diffMessage.previousMessageId() ⇒ string
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
Param | Type |
---|---|
message_id | string |
diffMessage.proof() ⇒ Proof
| undefined
Proof
| undefined
Deprecated
Returns a copy of the proof.
Kind: instance method of DiffMessage
diffMessage.merge(document) ⇒ Document
Document
Deprecated
Returns a new DID Document which is the result of merging self
with the given Document.
Kind: instance method of DiffMessage
Param | Type |
---|---|
document | Document |
diffMessage.toJSON() ⇒ any
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
DiffMessage
Deprecated
Deserializes a DiffMessage
from a JSON object.
Kind: static method of DiffMessage
Param | Type |
---|---|
json | any |
Document
Kind: global class
- Document
- new Document(keypair, network, fragment)
- instance
- .id() ⇒
DID
- .setController(controllers)
- .controller() ⇒
Array.<DID>
- .setAlsoKnownAs(urls)
- .alsoKnownAs() ⇒
Array.<string>
- .setPropertyUnchecked(key, value)
- .properties() ⇒
Map.<string, any>
- .service() ⇒
Array.<Service>
- .insertService(service) ⇒
boolean
- .removeService(did) ⇒
boolean
- .methods() ⇒
Array.<VerificationMethod>
- .insertMethod(method, scope)
- .removeMethod(did)
- .defaultSigningMethod() ⇒
VerificationMethod
- .resolveMethod(query, scope) ⇒
VerificationMethod
|undefined
- .resolveSigningMethod(query) ⇒
VerificationMethod
- .attachMethodRelationship(did_url, relationship) ⇒
boolean
- .detachMethodRelationship(did_url, relationship) ⇒
boolean
- .signSelf(key_pair, method_query)
- .signDocument(document, key_pair, method_query)
- .signCredential(credential, privateKey, methodQuery, options) ⇒
Credential
- .signPresentation(presentation, privateKey, methodQuery, options) ⇒
Presentation
- .signData(data, privateKey, methodQuery, options) ⇒
any
- .verifyData(data, options) ⇒
boolean
- .verifyDocument(signed)
.diff(other, message_id, key, method_query) ⇒DiffMessage
.verifyDiff(diff).mergeDiff(diff)- .integrationIndex() ⇒
string
- .metadata() ⇒
DocumentMetadata
- .metadataCreated() ⇒
Timestamp
|undefined
- .setMetadataCreated(timestamp)
- .metadataUpdated() ⇒
Timestamp
|undefined
- .setMetadataUpdated(timestamp)
- .metadataPreviousMessageId() ⇒
string
- .setMetadataPreviousMessageId(value)
- .proof() ⇒
Proof
|undefined
- .revokeCredentials(fragment, credentialIndices)
- .unrevokeCredentials(fragment, credentialIndices)
- .toJSON() ⇒
any
- .clone() ⇒
Document
- static
- .fromVerificationMethod(method) ⇒
Document
- .isSigningMethodType(method_type) ⇒
boolean
- .verifyRootDocument(document)
.diffIndex(message_id) ⇒string
- .fromJSON(json) ⇒
Document
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".
Param | Type |
---|---|
keypair | KeyPair |
network | string | undefined |
fragment | string | 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
Param | Type |
---|---|
controllers | DID | 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
Param | Type |
---|---|
urls | string | 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
Param | Type |
---|---|
key | string |
value | any |
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
Param | Type |
---|---|
service | Service |
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
Param | Type |
---|---|
did | DIDUrl |
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
Param | Type |
---|---|
method | VerificationMethod |
scope | MethodScope |
document.removeMethod(did)
Removes all references to the specified Verification Method.
Kind: instance method of Document
Param | Type |
---|---|
did | DIDUrl |
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
Param | Type |
---|---|
query | DIDUrl | string |
scope | MethodScope | 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
Param | Type |
---|---|
query | DIDUrl | 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
Param | Type |
---|---|
did_url | DIDUrl |
relationship | number |
document.detachMethodRelationship(did_url, relationship) ⇒ boolean
Detaches the given relationship from the given method, if the method exists.
Kind: instance method of Document
Param | Type |
---|---|
did_url | DIDUrl |
relationship | number |
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
Param | Type |
---|---|
key_pair | KeyPair |
method_query | DIDUrl | 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
Param | Type |
---|---|
document | Document |
key_pair | KeyPair |
method_query | DIDUrl | 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
Param | Type |
---|---|
credential | Credential |
privateKey | Uint8Array |
methodQuery | DIDUrl | string |
options | ProofOptions |
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
Param | Type |
---|---|
presentation | Presentation |
privateKey | Uint8Array |
methodQuery | DIDUrl | string |
options | ProofOptions |
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
Param | Type |
---|---|
data | any |
privateKey | Uint8Array |
methodQuery | DIDUrl | string |
options | ProofOptions |
document.verifyData(data, options) ⇒ boolean
Verifies the authenticity of data
using the target verification method.
Kind: instance method of Document
Param | Type |
---|---|
data | any |
options | VerifierOptions |
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
Param | Type |
---|---|
signed | Document |
document.diff(other, message_id, key, method_query) ⇒ DiffMessage
DiffMessage
Deprecated
Generate a DiffMessage
between two DID Documents and sign it using the specified
key
and method
.
Kind: instance method of Document
Param | Type |
---|---|
other | Document |
message_id | string |
key | KeyPair |
method_query | DIDUrl | 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
Param | Type |
---|---|
diff | DiffMessage |
document.mergeDiff(diff)
Deprecated
Verifies a DiffMessage
signature and attempts to merge the changes into self
.
Kind: instance method of Document
Param | Type |
---|---|
diff | DiffMessage |
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
Param | Type |
---|---|
timestamp | Timestamp | 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
Param | Type |
---|---|
timestamp | Timestamp | 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
Param | Type |
---|---|
value | string |
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
Param | Type |
---|---|
fragment | string |
credentialIndices | number | 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
Param | Type |
---|---|
fragment | string |
credentialIndices | number | 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
Param | Type |
---|---|
method | VerificationMethod |
Document.isSigningMethodType(method_type) ⇒ boolean
Returns whether the given MethodType can be used to sign document updates.
Kind: static method of Document
Param | Type |
---|---|
method_type | MethodType |
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
Param | Type |
---|---|
document | Document |
Document.diffIndex(message_id) ⇒ string
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
Param | Type |
---|---|
message_id | string |
Document.fromJSON(json) ⇒ Document
Deserializes a Document
from a JSON object.
Kind: static method of Document
Param | Type |
---|---|
json | any |
DocumentHistory
A DID Document's history and current state.
Kind: global class
- DocumentHistory
- instance
- .integrationChainData() ⇒
Array.<ResolvedDocument>
- .integrationChainSpam() ⇒
Array.<string>
.diffChainData() ⇒Array.<DiffMessage>
.diffChainSpam() ⇒Array.<string>
- .toJSON() ⇒
any
- .clone() ⇒
DocumentHistory
- static
- .fromJSON(json) ⇒
DocumentHistory
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>
Array.<DiffMessage>
Deprecated
Returns an Array
of diff chain DiffMessages
.
NOTE: clones the data.
Kind: instance method of DocumentHistory
documentHistory.diffChainSpam() ⇒ Array.<string>
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
Param | Type |
---|---|
json | any |
DocumentMetadata
Additional attributes related to an IOTA DID Document.
Kind: global class
- DocumentMetadata
- .previousMessageId ⇒
string
- .created() ⇒
Timestamp
|undefined
- .updated() ⇒
Timestamp
|undefined
- .clone() ⇒
DocumentMetadata
- .previousMessageId ⇒
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
- instance
- .toJSON() ⇒
any
- static
- .seconds(seconds) ⇒
Duration
- .minutes(minutes) ⇒
Duration
- .hours(hours) ⇒
Duration
- .days(days) ⇒
Duration
- .weeks(weeks) ⇒
Duration
- .fromJSON(json) ⇒
Duration
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
Param | Type |
---|---|
seconds | number |
Duration.minutes(minutes) ⇒ Duration
Create a new Duration
with the given number of minutes.
Kind: static method of Duration
Param | Type |
---|---|
minutes | number |
Duration.hours(hours) ⇒ Duration
Create a new Duration
with the given number of hours.
Kind: static method of Duration
Param | Type |
---|---|
hours | number |
Duration.days(days) ⇒ Duration
Create a new Duration
with the given number of days.
Kind: static method of Duration
Param | Type |
---|---|
days | number |
Duration.weeks(weeks) ⇒ Duration
Create a new Duration
with the given number of weeks.
Kind: static method of Duration
Param | Type |
---|---|
weeks | number |
Duration.fromJSON(json) ⇒ Duration
Deserializes a Duration
from a JSON object.
Kind: static method of Duration
Param | Type |
---|---|
json | any |
Ed25519
Kind: global class
- Ed25519
- .PRIVATE_KEY_LENGTH() ⇒
number
- .PUBLIC_KEY_LENGTH() ⇒
number
- .SIGNATURE_LENGTH() ⇒
number
- .sign(message, privateKey) ⇒
Uint8Array
- .verify(message, signature, publicKey)
- .PRIVATE_KEY_LENGTH() ⇒
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
Param | Type |
---|---|
message | Uint8Array |
privateKey | Uint8Array |
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
Param | Type |
---|---|
message | Uint8Array |
signature | Uint8Array |
publicKey | Uint8Array |
EncryptedData
The structure returned after encrypting data
Kind: global class
- EncryptedData
- instance
- .nonce() ⇒
Uint8Array
- .associatedData() ⇒
Uint8Array
- .ciphertext() ⇒
Uint8Array
- .tag() ⇒
Uint8Array
- .toJSON() ⇒
any
- static
- .fromJSON(json_value) ⇒
EncryptedData
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
Param | Type |
---|---|
json_value | any |
EncryptionAlgorithm
Supported content encryption algorithms.
Kind: global class
- EncryptionAlgorithm
- instance
- .keyLength() ⇒
number
- .toJSON() ⇒
any
- static
- .A256GCM() ⇒
EncryptionAlgorithm
- .fromJSON(json_value) ⇒
EncryptionAlgorithm
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
Param | Type |
---|---|
json_value | any |
ExplorerUrl
Kind: global class
- ExplorerUrl
- instance
- .messageUrl(message_id) ⇒
string
- .resolverUrl(did) ⇒
string
- .toString() ⇒
string
- static
- .parse(url) ⇒
ExplorerUrl
- .mainnet() ⇒
ExplorerUrl
- .devnet() ⇒
ExplorerUrl
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
Param | Type |
---|---|
message_id | string |
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
Param | Type |
---|---|
did | DID | 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
Param | Type |
---|---|
url | string |
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
- instance
- .chainData() ⇒
Array.<ResolvedDocument>
- .spam() ⇒
Array.<string>
- .toJSON() ⇒
any
- static
- .fromJSON(json) ⇒
IntegrationChainHistory
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
Param | Type |
---|---|
json | any |
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
- KeyLocation
- new KeyLocation(keyType, fragment, publicKey)
- instance
- .canonical() ⇒
string
- .keyType() ⇒
number
- .toJSON() ⇒
any
- .toString() ⇒
string
- static
- .fromVerificationMethod(method) ⇒
KeyLocation
- .fromJSON(json_value) ⇒
KeyLocation
new KeyLocation(keyType, fragment, publicKey)
Create a location from a KeyType
, the fragment of a verification method
and the bytes of a public key.
Param | Type |
---|---|
keyType | number |
fragment | string |
publicKey | Uint8Array |
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
Param | Type |
---|---|
method | VerificationMethod |
KeyLocation.fromJSON(json_value) ⇒ KeyLocation
Deserializes a JSON object into a KeyLocation
.
Kind: static method of KeyLocation
Param | Type |
---|---|
json_value | any |
KeyPair
Kind: global class
- KeyPair
- new KeyPair(type_)
- instance
- .type() ⇒
number
- .public() ⇒
Uint8Array
- .private() ⇒
Uint8Array
- .toJSON() ⇒
any
- .clone() ⇒
KeyPair
- static
- .fromKeys(type_, public_key, private_key) ⇒
KeyPair
- .tryFromPrivateKeyBytes(keyType, privateKeyBytes) ⇒
KeyPair
- .fromJSON(json) ⇒
KeyPair
new KeyPair(type_)
Generates a new KeyPair
object.
Param | Type |
---|---|
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
Param | Type |
---|---|
type_ | number |
public_key | Uint8Array |
private_key | Uint8Array |
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
Param | Type |
---|---|
keyType | number |
privateKeyBytes | Uint8Array |
KeyPair.fromJSON(json) ⇒ KeyPair
Deserializes a KeyPair
object from a JSON object.
Kind: static method of KeyPair
Param | Type |
---|---|
json | any |
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
Param | Type |
---|---|
privateKey | Uint8Array |
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
Param | Type |
---|---|
publicKey | Uint8Array |
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
Param | Type |
---|---|
privateKey | Uint8Array |
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
Param | Type |
---|---|
publicKey | Uint8Array |
MethodContent.fromJSON(json_value) ⇒ MethodContent
Deserializes MethodContent
from a JSON object.
Kind: static method of MethodContent
Param | Type |
---|---|
json_value | any |
MethodData
Supported verification method data formats.
Kind: global class
- MethodData
- instance
- .tryDecode() ⇒
Uint8Array
- .toJSON() ⇒
any
- .clone() ⇒
MethodData
- static
- .newBase58(data) ⇒
MethodData
- .newMultibase(data) ⇒
MethodData
- .fromJSON(json) ⇒
MethodData
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
Param | Type |
---|---|
data | Uint8Array |
MethodData.newMultibase(data) ⇒ MethodData
Creates a new MethodData
variant with Multibase-encoded content.
Kind: static method of MethodData
Param | Type |
---|---|
data | Uint8Array |
MethodData.fromJSON(json) ⇒ MethodData
Deserializes a MethodData
object from a JSON object.
Kind: static method of MethodData
Param | Type |
---|---|
json | any |
MethodScope
Supported verification method types.
Kind: global class
- MethodScope
- instance
- .toString() ⇒
string
- .toJSON() ⇒
any
- .clone() ⇒
MethodScope
- static
- .VerificationMethod() ⇒
MethodScope
- .Authentication() ⇒
MethodScope
- .AssertionMethod() ⇒
MethodScope
- .KeyAgreement() ⇒
MethodScope
- .CapabilityDelegation() ⇒
MethodScope
- .CapabilityInvocation() ⇒
MethodScope
- .fromJSON(json) ⇒
MethodScope
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
Param | Type |
---|---|
json | any |
MethodType
Supported verification method types.
Kind: global class
- MethodType
- instance
- .toJSON() ⇒
any
- .toString() ⇒
string
- .clone() ⇒
MethodType
- static
- .Ed25519VerificationKey2018() ⇒
MethodType
- .X25519KeyAgreementKey2019() ⇒
MethodType
- .fromJSON(json) ⇒
MethodType
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
Param | Type |
---|---|
json | any |
Network
Kind: global class
- Network
- instance
- .name() ⇒
string
- .defaultNodeURL() ⇒
string
|undefined
- .toString() ⇒
string
- .toJSON() ⇒
any
- .clone() ⇒
Network
- static
- .tryFromName(name) ⇒
Network
- .mainnet() ⇒
Network
- .devnet() ⇒
Network
- .fromJSON(json) ⇒
Network
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
Param | Type |
---|---|
name | string |
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
Param | Type |
---|---|
json | any |
Presentation
Kind: global class
- Presentation
- new Presentation(values)
- instance
- .context() ⇒
Array.<(string|Record.<string, any>)>
- .id() ⇒
string
|undefined
- .type() ⇒
Array.<string>
- .verifiableCredential() ⇒
Array.<Credential>
- .holder() ⇒
string
|undefined
- .refreshService() ⇒
Array.<RefreshService>
- .termsOfUse() ⇒
Array.<Policy>
- .proof() ⇒
Proof
|undefined
- .properties() ⇒
Map.<string, any>
- .toJSON() ⇒
any
- .clone() ⇒
Presentation
- static
- .BaseContext() ⇒
string
- .BaseType() ⇒
string
- .fromJSON(json) ⇒
Presentation
new Presentation(values)
Constructs a new Presentation
.
Param | Type |
---|---|
values | IPresentation |
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
Param | Type |
---|---|
json | any |
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.
Param | Type |
---|---|
options | IPresentationValidationOptions |
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
Param | Type |
---|---|
json | any |
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
Param | Type |
---|---|
presentation | Presentation |
holder | Document | ResolvedDocument |
issuers | Array.<Document> | Array.<ResolvedDocument> |
options | PresentationValidationOptions |
fail_fast | number |
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
Param | Type |
---|---|
presentation | Presentation |
holder | Document | ResolvedDocument |
options | VerifierOptions |
PresentationValidator.checkStructure(presentation)
Validates the semantic structure of the Presentation
.
Kind: static method of PresentationValidator
Param | Type |
---|---|
presentation | Presentation |
Proof
A digital signature.
For field definitions see: https://w3c-ccg.github.io/security-vocab/
Kind: global class
- Proof
- instance
- .type() ⇒
string
- .value() ⇒
string
- .verificationMethod() ⇒
string
- .created() ⇒
Timestamp
|undefined
- .expires() ⇒
Timestamp
|undefined
- .challenge() ⇒
string
|undefined
- .domain() ⇒
string
|undefined
- .purpose() ⇒
ProofPurpose
|undefined
- .toJSON() ⇒
any
- .clone() ⇒
Proof
- static
- .fromJSON(json) ⇒
Proof
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
Param | Type |
---|---|
json | any |
ProofOptions
Holds additional options for creating signatures.
See IProofOptions
.
Kind: global class
- ProofOptions
- new ProofOptions(options)
- instance
- .clone() ⇒
ProofOptions
- static
- .default() ⇒
ProofOptions
new ProofOptions(options)
Creates a new ProofOptions
from the given fields.
Throws an error if any of the options are invalid.
Param | Type |
---|---|
options | IProofOptions |
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
- instance
- .toJSON() ⇒
any
- .clone() ⇒
ProofPurpose
- static
- .assertionMethod() ⇒
ProofPurpose
- .authentication() ⇒
ProofPurpose
- .fromJSON(json) ⇒
ProofPurpose
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
Param | Type |
---|---|
json | any |
Receipt
Kind: global class
- Receipt
- instance
- .network() ⇒
Network
- .messageId() ⇒
string
- .networkId() ⇒
string
- .nonce() ⇒
string
- .toJSON() ⇒
any
- .clone() ⇒
Receipt
- static
- .fromJSON(json) ⇒
Receipt
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
Param | Type |
---|---|
json | any |
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
Param | Type |
---|---|
diff_message | DiffMessage |
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
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
Param | Type |
---|---|
value | string |
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
Param | Type |
---|---|
value | string |
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
Param | Type |
---|---|
json | any |
Resolver
Kind: global class
- Resolver
- new Resolver()
- instance
- .getClient(network_name) ⇒
Client
|undefined
- .resolve(did) ⇒
Promise.<ResolvedDocument>
- .resolveHistory(did) ⇒
Promise.<DocumentHistory>
.resolveDiffHistory(document) ⇒Promise.<DiffChainHistory>
- .resolveCredentialIssuer(credential) ⇒
Promise.<ResolvedDocument>
- .resolvePresentationIssuers(presentation) ⇒
Promise.<Array.<ResolvedDocument>>
- .resolvePresentationHolder(presentation) ⇒
Promise.<ResolvedDocument>
- .verifyPresentation(presentation, options, fail_fast, holder, issuers) ⇒
Promise.<void>
- static
- .builder() ⇒
ResolverBuilder
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
Param | Type |
---|---|
network_name | string |
resolver.resolve(did) ⇒ Promise.<ResolvedDocument>
Fetches the Document
of the given DID
.
Kind: instance method of Resolver
Param | Type |
---|---|
did | DID | string |
resolver.resolveHistory(did) ⇒ Promise.<DocumentHistory>
Fetches the DocumentHistory
of the given DID
.
Kind: instance method of Resolver
Param | Type |
---|---|
did | DID | string |
resolver.resolveDiffHistory(document) ⇒ Promise.<DiffChainHistory>
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
Param | Type |
---|---|
document | ResolvedDocument |
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
Param | Type |
---|---|
credential | Credential |
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
Param | Type |
---|---|
presentation | Presentation |
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
Param | Type |
---|---|
presentation | Presentation |
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
Param | Type |
---|---|
presentation | Presentation |
options | PresentationValidationOptions |
fail_fast | number |
holder | ResolvedDocument | undefined |
issuers | Array.<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
Param | Type |
---|---|
client | Client |
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
Param | Type |
---|---|
config | IClientConfig |
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
- RevocationBitmap
- new RevocationBitmap()
- instance
- .isRevoked(index) ⇒
boolean
- .revoke(index) ⇒
boolean
- .unrevoke(index) ⇒
boolean
- .len() ⇒
number
- .toEndpoint() ⇒
string
|Array.<string>
|Map.<string, Array.<string>>
- static
- .type() ⇒
string
- .fromEndpoint(endpoint) ⇒
RevocationBitmap
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
Param | Type |
---|---|
index | number |
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
Param | Type |
---|---|
index | number |
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
Param | Type |
---|---|
index | number |
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
Param | Type |
---|---|
endpoint | string | 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
- Service
- new Service(service)
- instance
- .id() ⇒
DIDUrl
- .type() ⇒
string
- .serviceEndpoint() ⇒
string
|Array.<string>
|Map.<string, Array.<string>>
- .properties() ⇒
Map.<string, any>
- .toJSON() ⇒
any
- .clone() ⇒
Service
- static
- .fromJSON(value) ⇒
Service
new Service(service)
Param | Type |
---|---|
service | IService |
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
Param | Type |
---|---|
value | any |
Signature
Kind: global class
- Signature
- new Signature(data)
- instance
- .asBytes() ⇒
Uint8Array
- .toJSON() ⇒
any
- static
- .fromJSON(json_value) ⇒
Signature
new Signature(data)
Creates a new Signature
.
Param | Type |
---|---|
data | Uint8Array |
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
Param | Type |
---|---|
json_value | any |
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>
- .didCreatePrivateKeyTest(storage) ⇒
Promise.<void>
- .didListTest(storage) ⇒
Promise.<void>
- .didPurgeTest(storage) ⇒
Promise.<void>
- .keyGenerateTest(storage) ⇒
Promise.<void>
- .keyDeleteTest(storage) ⇒
Promise.<void>
- .keyInsertTest(storage) ⇒
Promise.<void>
- .keySignEd25519Test(storage) ⇒
Promise.<void>
- .encryptionTest(alice_storage, bob_storage) ⇒
Promise.<void>
- .didCreateGenerateKeyTest(storage) ⇒
StorageTestSuite.didCreateGenerateKeyTest(storage) ⇒ Promise.<void>
Kind: static method of StorageTestSuite
Param | Type |
---|---|
storage | Storage |
StorageTestSuite.didCreatePrivateKeyTest(storage) ⇒ Promise.<void>
Kind: static method of StorageTestSuite
Param | Type |
---|---|
storage | Storage |
StorageTestSuite.didListTest(storage) ⇒ Promise.<void>
Kind: static method of StorageTestSuite
Param | Type |
---|---|
storage | Storage |
StorageTestSuite.didPurgeTest(storage) ⇒ Promise.<void>
Kind: static method of StorageTestSuite
Param | Type |
---|---|
storage | Storage |
StorageTestSuite.keyGenerateTest(storage) ⇒ Promise.<void>
Kind: static method of StorageTestSuite
Param | Type |
---|---|
storage | Storage |
StorageTestSuite.keyDeleteTest(storage) ⇒ Promise.<void>
Kind: static method of StorageTestSuite
Param | Type |
---|---|
storage | Storage |
StorageTestSuite.keyInsertTest(storage) ⇒ Promise.<void>
Kind: static method of StorageTestSuite
Param | Type |
---|---|
storage | Storage |
StorageTestSuite.keySignEd25519Test(storage) ⇒ Promise.<void>
Kind: static method of StorageTestSuite
Param | Type |
---|---|
storage | Storage |
StorageTestSuite.encryptionTest(alice_storage, bob_storage) ⇒ Promise.<void>
Kind: static method of StorageTestSuite
Param | Type |
---|---|
alice_storage | Storage |
bob_storage | Storage |
Timestamp
Kind: global class
- Timestamp
- instance
- .toRFC3339() ⇒
string
- .checkedAdd(duration) ⇒
Timestamp
|undefined
- .checkedSub(duration) ⇒
Timestamp
|undefined
- .toJSON() ⇒
any
- static
- .parse(input) ⇒
Timestamp
- .nowUTC() ⇒
Timestamp
- .fromJSON(json) ⇒
Timestamp
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
Param | Type |
---|---|
duration | Duration |
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
Param | Type |
---|---|
duration | Duration |
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
Param | Type |
---|---|
input | string |
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
Param | Type |
---|---|
json | any |
VerificationMethod
Kind: global class
new VerificationMethod(did, key_type, public_key, fragment)
Creates a new VerificationMethod
object from the given did
and public key.
Param | Type |
---|---|
did | DID |
key_type | number |
public_key | Uint8Array |
fragment | string |
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
Param | Type |
---|---|
did | DID |
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
Param | Type |
---|---|
value | any |
VerifierOptions
Holds additional proof verification options.
See IVerifierOptions
.
Kind: global class
- VerifierOptions
- new VerifierOptions(options)
- instance
- .toJSON() ⇒
any
- .clone() ⇒
VerifierOptions
- static
- .default() ⇒
VerifierOptions
- .fromJSON(json) ⇒
VerifierOptions
new VerifierOptions(options)
Creates a new VerifierOptions
from the given fields.
Throws an error if any of the options are invalid.
Param | Type |
---|---|
options | IVerifierOptions |
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
Param | Type |
---|---|
json | any |
X25519
An implementation of X25519
Elliptic-curve Diffie-Hellman (ECDH) cryptographic key exchange.
Kind: global class
- X25519
- .PRIVATE_KEY_LENGTH() ⇒
number
- .PUBLIC_KEY_LENGTH() ⇒
number
- .keyExchange(privateKey, publicKey) ⇒
Uint8Array
- .Ed25519toX25519Private(privateKey) ⇒
Uint8Array
- .Ed25519toX25519Public(publicKey) ⇒
Uint8Array
- .PRIVATE_KEY_LENGTH() ⇒
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
Param | Type |
---|---|
privateKey | Uint8Array |
publicKey | Uint8Array |
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
Param | Type |
---|---|
privateKey | Uint8Array |
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
Param | Type |
---|---|
publicKey | Uint8Array |
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