Global

Members

accumulator

Gets the SDK's `Accumulator` module
Source:

anchor

Gets the SDK's Anchor module
Source:

bbs

Gets the SDK's `BBS` module
Source:

bbsPlus

Gets the SDK's `BBSPlus` module
Source:

(constant) BlacklistedProperties

Properties that won't be patched/visited during the patching.
Source:

blob

Gets the SDK's Blob module
Source:

(constant) cacheLast

Caches last function result and returns it if function called with the same args again.
Source:

(constant) createNewDockDID

Create and return a fully qualified Dock DID, i.e. "did:dock:"
Source:

(constant) createResolver

Creates a resolver.
Source:

did

Gets the SDK's DID module
Source:

(constant) ensureExtrinsicSucceeded

Checks supplied events and in case either of them indicates transaction failure, throws an error.
Source:

(constant) ensureItemsAllowed

Ensures that each item is present in the allowed set and that both sets are valid.
Source:

(constant) ensureMatchesPattern

Ensures that provided value matches supplied pattern(s), throws an error otherwise.
Source:

(constant) FASTBLOCK_TIME_MS

Block time in ms for the fastblock build configuration.
Source:

(constant) findExtrinsicBlock

Attempts to find extrinsic with the given hash across the blocks with the supplied numbers. Returns the found block in case of success. **This method will concurrently request all candidate blocks at the same time.**
Source:

(constant) fmtIter

Returns string containing comma-separated items of the provided iterable.
Source:

(constant) HEX_ID_REG_EXP_PATTERN

`RegExp` pattern for the hex identifier `0x...`.
Source:

(constant) isAccumulatorRevocationStatus

Returns `true` if supplied status is a accumulator revocation status.
Source:

isConnected

Checks if the API instance is connected to the node
Source:

(constant) isRegistryRevocationStatus

Returns `true` if supplied status is a registry revocation status.
Source:

(constant) METHOD_REG_EXP_PATTERN

`RegExp` pattern to match the `METHOD`.
Source:

offchainSignatures

Gets the SDK's OffchainSignaturesModule module
Source:

(constant) patchQueryApi

Patches the query API methods, so they will throw an error if there's no result within the `8 seconds` timeout after `2` retries.
Source:

ps

Gets the SDK's `PS` module
Source:

publicKey

Returns underlying public key.
Source:

revocation

Gets the SDK's revocation module
Source:

(constant) STANDARD_BLOCK_TIME_MS

Block time in ms for the standard build configuration.
Source:

statusListCredential

Gets the SDK's StatusListCredentialModule module
Source:

(constant) timeout

Creates a promise that will call the optional supplied function `f` and return its result after `time` passes. If no function is provided, the promise will be resolved to `undefined`.
Source:

trustRegistry

Gets the SDK's TrustRegistryModule module
Source:

(constant) WILDCARD

Use to specify `PREFIX`/`METHOD` that will be dispatched in case no direct matches are found.
Source:

(constant) withInitializedDockAPI

Before resolving an entity, ensures that `DockAPI` is initialized, throws an error otherwise.
Source:

(constant) withTimeout

Combines supplied `promise` with a `timeout` that will call supplied `f` after `time` passes. Resolves to the earliest produced value.
Source:

Methods

acceptCompositeClaims(expandedPresentation, rules) → {Promise.<Array.<Object>>}

Returns a list of all RDF statements proven by the presentation. DOES NOT VERIFY THE PRESENTATION. Verification must be performed for the results of this function to be trustworthy. The return value may contaim duplicate claims. This function throws an error if: a provided proof is not applicable given the ruleset, a provided proof makes unverified assumptions, a provided proof is malformed.
Parameters:
Name Type Description
expandedPresentation a VCDM presentation as expanded json-ld
rules ordered list of axioms which will be accepted within proofs of composite claims
Source:
Returns:
Type
Promise.<Array.<Object>>

accumulatedAsHex(accumulated, typ) → {string}

Return the accumulated value as hex
Parameters:
Name Type Description
accumulated Uint8Array | KBUniversalAccumulatorValue
typ number Type of the accumulator
Source:
Returns:
Type
string

accumulatedFromHex(accumulated, typ) → {Uint8Array|KBUniversalAccumulatorValue}

Parse the given accumulated value in hex form
Parameters:
Name Type Description
accumulated string
typ number Type of the accumulator
Source:
Returns:
Type
Uint8Array | KBUniversalAccumulatorValue

adaptKey(key, msgCount)

Attempts to adapt supplied key for the `msgCount` messages. Throws an error if `msgCount` is greater than the supported message count.
Parameters:
Name Type Description
key *
msgCount *
Source:

adaptKey(key, _msgCount)

Adapts the provided public or secret key for the given message count.
Parameters:
Name Type Description
key *
_msgCount *
Source:

addAttributeToReveal(credentialIndex, attributes)

Species attributes to be revealed in the credential
Parameters:
Name Type Description
credentialIndex number
attributes Array.<string>
Source:

(async) addCredentialToPresent(credentialLD, options) → {Promise.<number>}

Adds a JSON-LD credential to be presented
Parameters:
Name Type Description
credentialLD
options
Source:
Returns:
Type
Promise.<number>

(async) addKBUniversalAccumulator(id, accumulated, publicKeyRef, signerDid, signingKeyRef, nonce, didModule, waitForFinalization, params) → {Promise.<*>}

Add KB universal (supports add/remove) accumulator
Parameters:
Name Type Description
id Unique accumulator id
accumulated Current accumulated value.
publicKeyRef Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not have any public key on the chain. This is useful for KVAC.
signerDid Signer of the transaction payload
signingKeyRef Signer's keypair reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
waitForFinalization
params
Source:
Returns:
Type
Promise.<*>

addOwner(ownerDID)

Add a owner to the policy
Parameters:
Name Type Description
ownerDID string Owner's DID
Source:

(async) addParams(param, signerDid, keyPair, signingKeyRef, nonce, didModule, waitForFinalization, params) → {Promise.<*>}

Add new signature params.
Parameters:
Name Type Description
param The signature params to add.
signerDid Signer of the payload
keyPair Signer's keypair
signingKeyRef Reference to the keypair used by the signer. This will be used by the verifier (node) to fetch the public key for verification
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
waitForFinalization
params
Source:
Returns:
Type
Promise.<*>

(async) addPositiveAccumulator(id, accumulated, publicKeyRef, signerDid, signingKeyRef, nonce, didModule, waitForFinalization, params) → {Promise.<*>}

Add a positive (add-only) accumulator
Parameters:
Name Type Description
id Unique accumulator id
accumulated Current accumulated value.
publicKeyRef Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not have any public key on the chain. This is useful for KVAC.
signerDid Signer of the transaction payload
signingKeyRef Signer's keypair reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
waitForFinalization
params
Source:
Returns:
Type
Promise.<*>

addPrivateStatusListEntryToCredential(cred, statusListCredentialId, statusListCredentialIndex, purpose) → {Object}

For setting revocation type of credential to private status list 21
Parameters:
Name Type Description
cred
statusListCredentialId
statusListCredentialIndex
purpose
Source:
Returns:
Type
Object

(async) addPublicKey(publicKey, signerDid, signingKeyRef, nonce, didModule, waitForFinalization, params) → {Promise.<*>}

Add accumulator public key
Parameters:
Name Type Description
publicKey Accumulator public key
signerDid Signer of the transaction payload
signingKeyRef Signer's keypair reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
waitForFinalization
params
Source:
Returns:
Type
Promise.<*>

(async) addPublicKey(publicKey, targetDid, signerDid, signingKeyRef, nonce, didModule, waitForFinalization, params) → {Promise.<*>}

Add a public key
Parameters:
Name Type Description
publicKey public key to add.
targetDid The DID to which key is being added
signerDid The DID that is adding the key by signing the payload because it controls `targetDid`
signingKeyRef Signer's signingKeyRef
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
waitForFinalization
params
Source:
Returns:
Type
Promise.<*>

addRevRegIdToCredential(cred, regId) → {*}

Add revocation registry id to credential
Parameters:
Name Type Description
cred
regId
Source:
Returns:
Type
*

addStatusList21EntryToCredential(cred, statusListCredentialId, statusListCredentialIndex, purpose) → {Object}

For setting revocation type of credential to status list 21
Parameters:
Name Type Description
cred
statusListCredentialId
statusListCredentialIndex
purpose
Source:
Returns:
Type
Object

(async) addUniversalAccumulator(id, accumulated, publicKeyRef, maxSize, signerDid, signingKeyRef, nonce, didModule, waitForFinalization, params) → {Promise.<*>}

Add universal (supports add/remove) accumulator
Parameters:
Name Type Description
id Unique accumulator id
accumulated Current accumulated value.
publicKeyRef Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not have any public key on the chain. This is useful for KVAC.
maxSize Maximum size of the accumulator
signerDid Signer of the transaction payload
signingKeyRef Signer's keypair reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
waitForFinalization
params
Source:
Returns:
Type
Promise.<*>

asDockAddress(addr, network)

Convert address to Dock appropriate network address.
Parameters:
Name Type Description
addr address to convert
network the network to use, allowed values are `main`, `test` and `dev` corresponding to mainnet, testnet and dev node
Source:

batchDocumentsInMerkleTree(documents) → {Array}

Batch multiple documents in binary merkle tree and return the root and proofs for each document
Parameters:
Name Type Description
documents
Source:
Returns:
- An 2 element array where 1st element is root and 2nd is an array with proofs for each document.
Type
Array

blobHexIdToQualified(hexId) → {string}

Return a fully qualified Dock Blob id, i.e. "blob:dock:"
Parameters:
Name Type Description
hexId string The hex blob id (without the qualifier)
Source:
Returns:
- The fully qualified Blob id
Type
string

buildCreateStatusListCredentialTx(id, statusListCredential, policy) → {Promise.<object>}

Create a transaction to create a new status list credential on-chain.
Parameters:
Name Type Description
id is the unique id of the status list credential. The function will check whether `id` is already taken or not.
statusListCredential the credential to be associated with the given `id`
policy the credential policy
Source:
Returns:
- the extrinsic to sign and send.
Type
Promise.<object>

buildDockCredentialStatus(registryId) → {Object}

Return `credentialStatus` according to W3C spec when the revocation status is checked on Dock
Parameters:
Name Type Description
registryId Revocation registry id
Source:
Returns:
Type
Object

buildParams()

Builds module-specific params from the provided value.
Source:

buildParams()

Builds `BBS+` params from the provided value.
Source:

buildParams()

Builds `BBS` params from the provided value.
Source:

buildParams()

Builds `Pointcheval-Sanders` params from the provided value.
Source:

buildPublicKey()

Builds `BBS+` public key from the provided value.
Source:

buildPublicKey()

Builds `BBS` public key from the provided value.
Source:

buildPublicKey()

Builds module-specific public key from the provided value.
Source:

buildPublicKey()

Builds `Pointcheval-Sanders` public key from the provided value.
Source:

buildRemoveStatusListCredentialTx(statusListCredentialId, didSigs) → {Promise.<object>}

Create a transaction to remove an existing status list credential from the chain.
Parameters:
Name Type Description
statusListCredentialId is the unique id of the status list credential. The function will check whether `id` is already taken or not.
didSigs `DID` signatures over an action with a nonce authorizing this action according to the existing policy.
Source:
Returns:
- the extrinsic to sign and send.
Type
Promise.<object>

buildResolversMap(resolverList) → {Object.<string, Object.<string, Resolver.<T>>>}

Builds resolver map from the supplied list.
Parameters:
Name Type Description
resolverList Array.<Resolver.<T>>
Source:
Returns:
Type
Object.<string, Object.<string, Resolver.<T>>>

buildUpdateStatusListCredentialTx(statusListCredentialUpdate, didSigs) → {Promise.<object>}

Create a transaction to update an existing status list credential on-chain.
Parameters:
Name Type Description
statusListCredentialUpdate Update for the status list credential.
didSigs `DID` signatures over an action with a nonce authorizing this action according to the existing policy.
Source:
Returns:
- the extrinsic to sign and send.
Type
Promise.<object>

checkCredential(credential)

Parameters:
Name Type Description
credential object An object that could be a VerifiableCredential.
Source:
Throws:
Error

checkCredentialJSONLD(credential)

Parameters:
Name Type Description
credential object An object that could be a VerifiableCredential.
Source:
Throws:
Error

checkCredentialOptional(credential)

Parameters:
Name Type Description
credential object An object that could be a VerifiableCredential.
Source:
Throws:
Error

checkCredentialRequired(credential)

Parameters:
Name Type Description
credential object An object that could be a VerifiableCredential.
Source:
Throws:
Error

checkRevocationRegistryStatus(credential, documentLoader) → {Promise.<({verified: boolean}|{verified: boolean, error: string})>}

Check if the credential is revoked or not according to the revocation registry mechanism.
Parameters:
Name Type Description
credential
documentLoader
Source:
Returns:
The returned object will have a key `verified` which is true if the credential is not revoked and false otherwise. The `error` will describe the error if any.
Type
Promise.<({verified: boolean}|{verified: boolean, error: string})>

claimgraphToStore(claimgraph) → {Store}

Converts a claimgraph JSON representation into an N3 RDF store
Parameters:
Name Type Description
claimgraph object JSON-LD RDF object
Source:
Returns:
Type
Store

controllerIds() → {Array.<DockDidOrDidMethodKey>}

Returns list containing unique sorted owner DIDs.
Source:
Returns:
Type
Array.<DockDidOrDidMethodKey>

convertCredential(document, explicitProof, signingOptions) → {Array}

Convert given JSON-LD credential to TS-anoncred's credential. This would not have the signature.
Parameters:
Name Type Description
document JSON-LD credential
explicitProof
signingOptions
Source:
Returns:
- Returns [serialized cred object, cred schema]
Type
Array

convertCredentialForPresBuilding(document, explicitProof) → {Credential}

Convert given JSON-LD credential to TS-anoncred's credential for adding to a presentation. This would have the signature.
Parameters:
Name Type Description
document JSON-LD credential
explicitProof
Source:
Returns:
Type
Credential

convertCredentialForVerification(document, explicitProof) → {Array}

Convert given JSON-LD credential to TS-anoncred's credential. This would have the signature.
Parameters:
Name Type Description
document JSON-LD credential
explicitProof
Source:
Returns:
Type
Array

(async) convertCredentialToSerializedForSigning(document, explicitProof) → {Promise.<Array>}

Convert given JSON-LD credential to TS-anoncred's credential. This would not have the signature.
Parameters:
Name Type Description
document JSON-LD credential
explicitProof
Source:
Returns:
Type
Promise.<Array>

(async) create(keyDoc, id, paramsopt) → {Promise.<StatusList2021Credential>}

Creates new `StatusList2021Credential` with supplied `id` and option `statusPurpose` = `revocation` by default, `length` and `revokeIndices`. Note that credential with `statusPurpose` = `revocation` can't unsuspend its indices. To allow unrevoking indices in the future, use `statusPurpose` = `suspension`. The proof will be generated immediately using supplied `keyDoc`.
Parameters:
Name Type Attributes Default Description
keyDoc KeyDoc
id string on-chain hex identifier for the `StatusList2021Credential`.
params object <optional>
{}
Properties
Name Type Attributes Default Description
statusPurpose 'revocation' | 'suspension' <optional>
revocation `statusPurpose` of the `StatusList2021Credential`. Can be either `revocation` or `suspension`.
length number <optional>
1e4 length of the underlying `StatusList`.
revokeIndices Iterable.<number> <optional>
[] iterable producing indices to be revoked or suspended initially
Source:
Returns:
Type
Promise.<StatusList2021Credential>

(async) createAddKBUniversalAccumulatorTx(id, accumulated, publicKeyRef, signerDid, signingKeyRef, nonce, didModule) → {Promise.<*>}

Create a transaction to add KB universal (supports add/remove) accumulator
Parameters:
Name Type Description
id Unique accumulator id
accumulated Current accumulated value.
publicKeyRef Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not have any public key on the chain. This is useful for KVAC.
signerDid Signer of the transaction payload
signingKeyRef Signer's keypair reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
Source:
Returns:
Type
Promise.<*>

(async) createAddParamsTx(params, signerDid, keyPair, signingKeyRef, nonce, didModule) → {Promise.<*>}

Create transaction to add new BBS+ params.
Parameters:
Name Type Description
params The BBS+ params to add.
signerDid Signer of the payload
keyPair Signer's keypair
signingKeyRef Reference to the keypair used by the signer. This will be used by the verifier (node) to fetch the public key for verification
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
Source:
Returns:
Type
Promise.<*>

(async) createAddPositiveAccumulatorTx(id, accumulated, publicKeyRef, signerDid, signingKeyRef, nonce, didModule) → {Promise.<*>}

Create a transaction to add positive (add-only) accumulator
Parameters:
Name Type Description
id Unique accumulator id
accumulated Current accumulated value.
publicKeyRef Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not have any public key on the chain. This is useful for KVAC.
signerDid Signer of the transaction payload
signingKeyRef Signer's keypair reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
Source:
Returns:
Type
Promise.<*>

(async) createAddPublicKeyTx(publicKey, signerDid, signingKeyRef, nonce, didModule) → {Promise.<*>}

Create transaction to add accumulator public key
Parameters:
Name Type Description
publicKey Accumulator public key
signerDid Signer of the transaction payload
signingKeyRef Signer's keypair reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
Source:
Returns:
Type
Promise.<*>

(async) createAddPublicKeyTx(publicKey, targetDid, signerDid, signingKeyRef, nonce, didModule) → {Promise.<*>}

Create transaction to add a public key
Parameters:
Name Type Description
publicKey public key to add.
targetDid The DID to which key is being added
signerDid The DID that is adding the key by signing the payload because it controls `targetDid`
signingKeyRef Signer's signingKeyRef
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
Source:
Returns:
Type
Promise.<*>

(async) createAddUniversalAccumulatorTx(id, accumulated, publicKeyRef, maxSize, signerDid, signingKeyRef, nonce, didModule) → {Promise.<*>}

Create a transaction to add universal (supports add/remove) accumulator
Parameters:
Name Type Description
id Unique accumulator id
accumulated Current accumulated value.
publicKeyRef Reference to accumulator public key. If the reference contains the key id 0, it means the accumulator does not have any public key on the chain. This is useful for KVAC.
maxSize Maximum size of the accumulator
signerDid Signer of the transaction payload
signingKeyRef Signer's keypair reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
Source:
Returns:
Type
Promise.<*>

createDidKey(publicKey, verRel) → {object}

Returns a `DidKey` as expected by the Substrate node
Parameters:
Name Type Description
publicKey PublicKey The public key for the DID. The Keyring is intentionally avoided here as it may not be accessible always, like in case of hardware wallet
verRel VerificationRelationship
Source:
Returns:
- The object has structure and keys with same names as expected by the Substrate node
Type
object

createDidSig(did, keyId, rawSig, sig) → {object}

Parameters:
Name Type Description
did string | DockDidOrDidMethodKey DID as string or an object
keyId number -
rawSig
sig Signature
Source:
Returns:
Type
object

(async) createDidSignature(createSerializedTx, data, did, signingKeyRef, nonce, didModule, params)

Creates `DID` signature.
Parameters:
Name Type Description
createSerializedTx Function to create a serialized transaction using supplied payload.
data Payload data.
did Signer of the transaction payload
signingKeyRef Signer's signing key reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by
params parameters to be used
Source:

createNewDockBlobId() → {string}

Create and return a fully qualified Dock Blob id, i.e. "blob:dock:"
Source:
Returns:
- The Blob id
Type
string

createParamsObjFromChainResponse(params) → {Object}

Format an object received from the chain as a params object with keys `bytes`, `label` and `curveType`.
Parameters:
Name Type Description
params
Source:
Returns:
Type
Object

createPresentation(options) → {object}

Create a presentation
Parameters:
Name Type Description
options
Source:
Returns:
Type
object

createPublicKeyObjFromChainResponse(pk) → {Object}

Format an object received from the chain as a public key object with keys `bytes`, ` paramsRef` and `curveType`.
Parameters:
Name Type Description
pk
Source:
Returns:
Type
Object

createRandomRegistryId() → {string}

Generate a random revocation registry id.
Source:
Returns:
The id as a hex string
Type
string

(async) createRemovePublicKeyTx(removeKeyId, signerDid, signingKeyRef, nonce, didModule) → {Promise.<*>}

Create transaction to remove accumulator public key
Parameters:
Name Type Description
removeKeyId Index of the accumulator public key
signerDid Signer of the transaction payload
signingKeyRef Signer's keypair reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
Source:
Returns:
Type
Promise.<*>

(async) createRemovePublicKeyTx(removeKeyId, targetDid, signerDid, signingKeyRef, nonce, didModule) → {Promise.<*>}

Create transaction to remove public key
Parameters:
Name Type Description
removeKeyId The key index for key to remove.
targetDid The DID from which key is being removed
signerDid The DID that is removing the key by signing the payload because it controls `targetDid`
signingKeyRef Signer's signingKeyRef
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
Source:
Returns:
Type
Promise.<*>

(async) createSignedRemoveStatusListCredential(id, did, signingKeyRef, nonce, didModule)

Creates signed transaction to remove status list credential.
Parameters:
Name Type Description
id Unique identifier of the status list credential.
did Signer of the transaction payload
signingKeyRef Signer's signing key reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by
Source:

(async) createSignedUpdateStatusListCredential(id, statusListCredential, did, signingKeyRef, nonce, didModule, params)

Creates signed transaction to update status list credential.
Parameters:
Name Type Description
id Unique identifier of the status list credential.
statusListCredential Status list credential.
did Signer of the transaction payload
signingKeyRef Signer's signing key ref key reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by
params parameters to be used
Source:

createStatusListCredential(id, statusListCredential, policy, waitForFinalization, params) → {Promise.<*>}

Create a new status list credential on-chain.
Parameters:
Name Type Default Description
id is the unique id of the status list credential. The function will check whether `id` is already taken or not.
statusListCredential The status list credential to be associated with the given `id`.
policy The credential policy.
waitForFinalization true
params
Source:
Returns:
- Sent transaction.
Type
Promise.<*>

(async) createVerifyData(options) → {Promise.<Array.<Uint8Array>>}

Create serialized credential for signing and verification
Parameters:
Name Type Description
options object The options to use.
Properties
Name Type Description
document object The document to be signed/verified.
proof object The proof to be verified.
documentLoader function The document loader to use.
expansionMap function NOT SUPPORTED; do not use.
Source:
Returns:
.
Type
Promise.<Array.<Uint8Array>>

(async) credsToEEClaimGraph(expandedCredentials) → {Promise.<Array.<Object>>}

Convert a list of expanded credentials which have already been verified into an RDF claim graph. The resulting claimgraph is in Explicit Ethos form.
Parameters:
Name Type Description
expandedCredentials A list of expanded credentials, each is expected to be a separate
Source:
Returns:
Type
Promise.<Array.<Object>>

(async) credToEECG() → {Promise.<Array.<Object>>}

Convert a single expanded credential which has already been verified into an RDF claim graph.
Source:
Returns:
Type
Promise.<Array.<Object>>

(async) decodedStatusList() → {Promise.<StatusList>}

Returns a `Promise` resolving to the decoded `StatusList`.
Source:
Returns:
Type
Promise.<StatusList>

(async) deploy(anchor, waitForFinalization, params) → {Promise.<*>}

Write anchor on chain
Parameters:
Name Type Default Description
anchor
waitForFinalization true
params
Source:
Returns:
Type
Promise.<*>

deployTx(anchor) → {object}

Prepare transaction to write anchor on chain
Parameters:
Name Type Description
anchor Uint8Array | string
Source:
Returns:
The extrinsic to sign and send.
Type
object

derivedToAnoncredsPresentation(document)

Converts a derived proof credential to the native presentation format
Parameters:
Name Type Description
document
Source:

documentLoader(resolveropt) → {loadDocument}

Takes a resolver and returns a function that returns a document or throws an error when the document cannot be found.
Parameters:
Name Type Attributes Default Description
resolver Resolver <optional>
null The resolver is optional but should be passed when `DID`s / `StatusList2021Credential`s / `Blob`s / revocation registries and other documents need to be resolved.
Source:
Returns:
- the returned function
Type
loadDocument

encodeExtrinsicAsHash(api, tx) → {string}

Encodes an extrinsic as a blake2 hash
Parameters:
Name Type Description
api * API for creating Call type
tx * Extrinsic to encode
Source:
Returns:
Type
string

ensureArray(value)

Fail if the given value isn't an array
Parameters:
Name Type Description
value
Source:

ensureObject(value)

Fail if the given value isn't an object
Parameters:
Name Type Description
value
Source:

ensureObjectWithId(value, name)

Fail if the given value isn't an object with id property
Parameters:
Name Type Description
value
name string Name of the object. Used in constructing error.
Source:

ensureObjectWithKey(value, name, key)

Fail if the given value isn't an object with the given key as property
Parameters:
Name Type Description
value object object to check
name string Name of the object. Used in constructing error.
key string Property to look for
Source:

ensurePrivateStatusListId(statusListId)

Fail if the given string isn't a valid `PrivateStatusList2021Credential` id.
Parameters:
Name Type Description
statusListId
Source:

ensureStatusListId(statusListId)

Fail if the given string isn't a valid `StatusList2021Credential` id.
Parameters:
Name Type Description
statusListId
Source:

ensureString(value)

Fail if the given value isn't a string
Parameters:
Name Type Description
value
Source:

ensureURI(uri)

Fail if the given string isn't a URI
Parameters:
Name Type Description
uri
Source:

ensureValidDatetime(datetime)

Fail if the given datetime isn't valid.
Parameters:
Name Type Description
datetime
Source:

errorMsgFromEventData(api, data) → {string}

Extracts extrinsic error from the supplied event data.
Parameters:
Name Type Description
api *
data *
Source:
Returns:
Type
string

expandJSONLD(credential)

Helper method to ensure credential is valid according to the context
Parameters:
Name Type Description
credential
Source:

extractProof(expandedPresentation) → {Promise.<Array.<Object>>}

Extracts any included proofs of composite claims from a presentation. The presentation must be in expanded form. Returns the proofs, concatenated together.
Parameters:
Name Type Description
expandedPresentation a VCDM presentation as expanded json-ld
Source:
Returns:
Type
Promise.<Array.<Object>>

(async) extractSchemaForSigning(document, documentLoader) → {Promise.<Array>}

Extract schema from the document and load the schema from its id/reference if needed.
Parameters:
Name Type Description
document
documentLoader
Source:
Returns:
Type
Promise.<Array>

(async) fetchStatusList2021Credential(statusListCredentialId) → {Promise.<(StatusList2021Credential|null)>}

Fetches `StatusList2021Credential` with the supplied identifier.
Parameters:
Name Type Description
statusListCredentialId *
Source:
Returns:
Type
Promise.<(StatusList2021Credential|null)>

formatMandatoryFields(credJson, document)

To work with JSON-LD credentials/presentations, we must always reveal the context, type
Parameters:
Name Type Description
credJson
document
Source:

from(verificationMethod) → {EcdsaSecp256k1VerificationKey2019}

Construct the public key object from the verification method
Parameters:
Name Type Description
verificationMethod
Source:
Returns:
Type
EcdsaSecp256k1VerificationKey2019

from(verificationMethod) → {Ed25519VerificationKey2018}

Construct the public key object from the verification method
Parameters:
Name Type Description
verificationMethod
Source:
Returns:
Type
Ed25519VerificationKey2018

from(verificationMethod) → {Ed25519VerificationKey2020}

Construct the public key object from the verification method
Parameters:
Name Type Description
verificationMethod
Source:
Returns:
Type
Ed25519VerificationKey2020

from(verificationMethod) → {Sr25519VerificationKey2020}

Construct the public key object from the verification method
Parameters:
Name Type Description
verificationMethod
Source:
Returns:
Type
Sr25519VerificationKey2020

fromBytes(bytes)

Decodes `StatusList2021Credential` from provided bytes.
Parameters:
Name Type Description
bytes Uint8Array
Source:

fromHex(value) → {Signature}

Create SignatureEd25519 from given hex string
Parameters:
Name Type Description
value string Hex string
Source:
Returns:
Type
Signature

fromHex(value) → {Signature}

Create SignatureSecp256k1 from given hex string
Parameters:
Name Type Description
value string Hex string
Source:
Returns:
Type
Signature

fromHex(value) → {Signature}

Create SignatureSr25519 from given hex string
Parameters:
Name Type Description
value string Hex string
Source:
Returns:
Type
Signature

fromHex(value) → {Signature}

Creates a new DidSignature object. Validates the given value. Currently supported signature types only require validating the byte size.
Parameters:
Name Type Description
value string Value of the signature. This is validated
Source:
Returns:
The Signature object if the given value is valid.
Type
Signature

fromJsigProofValue(proofValue) → {*|string}

Json-ld signs prefix signatures with a specific character. Removes that character
Parameters:
Name Type Description
proofValue
Source:
Returns:
Type
* | string

fromJSON(json) → {StatusList2021Credential}

Instantiates `StatusList2021Credential` from the provided `JSON`.
Parameters:
Name Type Description
json object
Source:
Returns:
Type
StatusList2021Credential

fromKeypair(keypair) → {this}

Creates a new `DidMethodKey` from the supplied keypair.
Parameters:
Name Type Description
keypair DockKeypair
Source:
Returns:
Type
this

fromKeyringPair(pair) → {PublicKeySecp256k1}

Returns a compressed public key for Secp256k1 curve. The name is intentionally kept same with the base export class to keep the API uniform
Parameters:
Name Type Description
pair object A KeyPair from elliptic library
Source:
Returns:
Type
PublicKeySecp256k1

fromKeyringPair(pair) → {PublicKey}

Extracts the public key from a pair. Assumes the KeyringPair is of the correct type. The `type` is intentionally not inspected to follow dependency inversion principle. generate the instance correct subclass
Parameters:
Name Type Description
pair object A polkadot-js KeyringPair.
Source:
Returns:
Type
PublicKey

fromPolkadotJSKeyringPair(message, signingPair)

Signs the given message and wraps it in the Signature
Parameters:
Name Type Description
message array The message to sign as bytearray
signingPair object The pair from Polkadot-js containing the signing key
Source:

fromQualifiedString(did) → {this}

Instantiates `DidMethodKey` from a fully qualified did string.
Parameters:
Name Type Description
did string fully qualified `did:key:*` string
Source:
Returns:
Type
this

fromQualifiedString(did) → {this}

Instantiates `DockDid` from a fully qualified did string.
Parameters:
Name Type Description
did string fully qualified `did:dock:*` string
Source:
Returns:
Type
this

fromSubstrateValue(key) → {this}

Instantiates `DockDid` from a did method key object received from the substrate side.
Parameters:
Name Type Description
key object substrate did method key
Source:
Returns:
Type
this

fromSubstrateValue(did) → {this}

Instantiates `DockDid` from a did object received from the substrate side.
Parameters:
Name Type Description
did object substrate did
Source:
Returns:
Type
this

generate(options)

Generates new keypair using provided options.
Parameters:
Name Type Description
options
Properties
Name Type Description
seed
params
controller
id
msgCount
Source:

generateEcdsaSecp256k1Keypair(persopt, entropyopt) → {object}

Generate keypair for Ecdsa over Secp256k1. Explicitly denying other options to keep the API simple
Parameters:
Name Type Attributes Description
pers string <optional>
A string
entropy array | string <optional>
A byte array or hex string
Source:
Returns:
A keypair
Type
object

(async) get(anchor, preHashed) → {Promise.<*>}

Query anchor from chain
Parameters:
Name Type Default Description
anchor
preHashed Boolean false If the anchor has already been hashed.
Source:
Returns:
- The promise will either successfully resolve to the block number where anchor was created or reject with an error.
Type
Promise.<*>

(async) get(id, dockApi) → {Promise.<object>}

Get schema from the chain using the given id, by querying the blob storage. Accepts a full blob id like blob:dock:0x... or just the hex identifier and the `DockAPI` object. The returned schema would be formatted as specified in the RFC (including author DID, schema id) or an error is returned if schema is not found on the chain or in JSON format.
Parameters:
Name Type Description
id string The Schema ID
dockApi object The Dock API
Source:
Returns:
Type
Promise.<object>

getAccount() → {KeyringPair}

Gets the current account used to sign transactions
Source:
Returns:
PolkadotJS Keyring account
Type
KeyringPair

(async) getAccumulator(id, withKeyAndParams, withKeyOnly) → {Promise.<({created: *, lastModified: *}|null)>}

Get the accumulator as an object. The field `type` in object specifies whether it is "positive" or "universal". Fields `created` and `lastModified` are block nos where the accumulator was created and last updated respectively. Field `nonce` is the last accepted nonce by the chain, the next write to the accumulator should increment the nonce by 1. Field `accumulated` contains the current accumulated value.
Parameters:
Name Type Default Description
id
withKeyAndParams false Fetch both keys and params.
withKeyOnly false Fetch key only. This is useful when default params are used.
Source:
Returns:
Type
Promise.<({created: *, lastModified: *}|null)>

(async) getActorDidAndNonce(actorDid, nonce, didModule) → {Promise}

Get the DID doing the action and its corresponding nonce.
Parameters:
Name Type Description
actorDid
nonce
didModule
Source:
Returns:
Type
Promise

getAllEventsFromBlock(api, numberOrHash, formatted)

Given a block number or block hash, get all events.
Parameters:
Name Type Description
api *
numberOrHash *
formatted *
Source:

getAllExtrinsicsFromBlock(api, numberOrHash, includeAllExtrinsics)

Given a block number or block hash, get all extrinsics.
Parameters:
Name Type Description
api *
numberOrHash *
includeAllExtrinsics * If false, returns only successful extrinsics.
Source:

(async) getAllParamsByDid(did) → {Promise.<Array.<object>>}

Get all params written by a DID
Parameters:
Name Type Description
did
Source:
Returns:
Type
Promise.<Array.<object>>

(async) getAllParamsByDid(did) → {Promise.<Array.<object>>}

Get all params written by a DID
Parameters:
Name Type Description
did
Source:
Returns:
Type
Promise.<Array.<object>>

(async) getAllPublicKeysByDid(did, withParams) → {Promise.<Array.<object>>}

Get all public keys written by a DID
Parameters:
Name Type Default Description
did
withParams false
Source:
Returns:
Type
Promise.<Array.<object>>

getAndValidateSchemaIfPresent(credential, context, documentLoader) → {Promise.<void>}

Get schema and run validation on credential if it contains both a credentialSubject and credentialSchema
Parameters:
Name Type Description
credential object a verifiable credential JSON object
context object the context
documentLoader object the document loader
Source:
Returns:
Type
Promise.<void>

getBytesForStateChange(api, stateChange) → {array}

// TODO: Error handling when `stateChange` is not registered Helper function to return bytes of a `StateChange` enum. Updates like key change, DID removal, revocation, etc require the change to be wrapped in `StateChange` before serializing for signing.
Parameters:
Name Type Description
api object Promise API from polkadot-js
stateChange object A representation of a `StateChange` enum variant
Source:
Returns:
An array of Uint8
Type
array

getCredentialStatus(expanded)

Retrieves a value under the `credentialStatus` property and ensures it has the expected properties. Returns `null` if no value is found.
Parameters:
Name Type Description
expanded
Source:

getDidNonce(didOrDidMethodKey, nonce, didModule) → {Promise.<(undefined|*)>}

Get the nonce to be used for sending the next transaction if not provided already.
Parameters:
Name Type Description
didOrDidMethodKey DockDidOrDidMethodKey DID whose nonce is needed
nonce If provided, returned as it is.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
Source:
Returns:
Type
Promise.<(undefined|*)>

getDockRevIdFromCredential(credential) → {*}

Generate the revocation id of a credential usable by Dock. It hashes the credential id to get the revocation id
Parameters:
Name Type Description
credential
Source:
Returns:
Type
*

getHexIdentifier() → {string}

Gets the hexadecimal value of the given string.
Source:
Returns:
Returns the hexadecimal representation of the ID.
Type
string

getHexIdentifierFromBlobID(id) → {string}

Gets the hexadecimal value of the given ID.
Parameters:
Name Type Description
id string The ID can be passed as fully qualified ID like `blob:dock:` or a 32 byte hex string
Source:
Returns:
Returns the hexadecimal representation of the ID.
Type
string

getImplications(claimgraph, proof, rules) → {Array.<Object>}

Given a claimgraph of true assumptions, and the allowed logical rules, return the claims that are proven true by proof. If the proof is not applicable given the ruleset, or makes unverified assumptions, throw an error. The return value may contain duplicate claims.
Parameters:
Name Type Description
claimgraph known true assumptions (usually extracted from a presentation or a cred)
proof proof of composite claims (usually comes from calling proveh())
rules ordered list of axioms
Source:
Returns:
Type
Array.<Object>

getJsonSchemaFromCredential(credential, full) → {IEmbeddedJsonSchema|IJsonSchema}

Get JSON-schema from the credential.
Parameters:
Name Type Description
credential
full when set to true, returns the JSON schema with properties. This might be a fetched schema
Source:
Returns:
Type
IEmbeddedJsonSchema | IJsonSchema

getJsonSchemasFromPresentation(presentation, full) → {*}

Get JSON-schemas of all credentials in the presentation
Parameters:
Name Type Description
presentation
full when set to true, returns the JSON schema of each credential with properties. This might be a fetched schema
Source:
Returns:
Type
*

(async) getJSONSchemaSpec(json) → {Promise.<object>}

Gets the JSON schema spec from given JSON. Will either return the stored JSON schema or get it using HTTP or will throw error if cannot get.
Parameters:
Name Type Description
json object
Source:
Returns:
Type
Promise.<object>

getKeyDoc(did, keypair, type, id) → {KeyDoc}

Helper to get the key doc in a format needed for vc.js.
Parameters:
Name Type Description
did string DID in fully qualified form
keypair object Keypair is generated by either using polkadot-js's keyring for Sr25519 and Ed25519 or keypair generated with `generateEcdsaSecp256k1Keypair` for curve secp256k1.
type string the type of key, Sr25519VerificationKey2020 or Ed25519VerificationKey2018 or EcdsaSecp256k1VerificationKey2019 or Bls12381G2VerificationKeyDock2022
id string the ID of the key for future resolution
Source:
Returns:
Type
KeyDoc

getKeyedProofsFromVerifiedPresentation(presentation) → {Map.<number, KeyedProof>}

Get the keyed proofs from the given anoncreds presentation. This is supposed to be called by the verifier to get the keyed-proofs and send them for verification to the issuer or the entity having the corresponding secret key
Parameters:
Name Type Description
presentation
Source:
Returns:
Type
Map.<number, KeyedProof>

getKeyPairType(pair) → {string|*}

Return the type of signature from a given keypair
Parameters:
Name Type Description
pair object Can be a keypair from polkadot-js or elliptic library.
Source:
Returns:
Type
string | *

(async) getLastParamsWritten(did) → {Promise.<({bytes: string}|null)>}

Get last params written by this DID
Parameters:
Name Type Description
did
Source:
Returns:
Type
Promise.<({bytes: string}|null)>

(async) getLastParamsWritten(did) → {Promise.<({bytes: string}|null)>}

Get last params written by this DID
Parameters:
Name Type Description
did
Source:
Returns:
Type
Promise.<({bytes: string}|null)>

getPrivateStatus(credential) → {*|Object|undefined}

Get status of a credential issued with revocation type of private status list.
Parameters:
Name Type Description
credential
Source:
Returns:
Type
* | Object | undefined

getPrivateStatuses(presentation) → {Array.<Object>}

Get status of all credentials from the presentation with revocation type of private status list.
Parameters:
Name Type Description
presentation
Source:
Returns:
Type
Array.<Object>

(async) getPublicKey(did, keyId, withParams) → {Promise.<({bytes: string}|null)>}

Parameters:
Name Type Default Description
did
keyId
withParams false If true, return the params referenced by the public key. It will throw an error if paramsRef is null or params were not found on chain which can happen if they were deleted after this public key was added.
Source:
Returns:
Type
Promise.<({bytes: string}|null)>

getPublicKeyFromKeyringPair(pair) → {PublicKey}

Inspect the `type` of the `KeyringPair` to generate the correct kind of PublicKey.
Parameters:
Name Type Description
pair object A polkadot-js KeyringPair.
Source:
Returns:
An instance of the correct subclass of PublicKey
Type
PublicKey

getSerializedRemoveStatusListCredential(removal) → {Array}

Serializes a `RemoveStatusListCredential` for signing.
Parameters:
Name Type Description
removal object `RemoveStatusListCredential` as expected by the Substrate node
Source:
Returns:
An array of Uint8
Type
Array

getSerializedUpdateStatusListCredential(update) → {Array}

Serializes a `UpdateStatusListCredential` for signing.
Parameters:
Name Type Description
update object `UpdateStatusListCredential` as expected by the Substrate node
Source:
Returns:
An array of Uint8
Type
Array

getSignatureFromKeyringPair(pair, message) → {Signature}

Inspect the `type` of the `KeyringPair` to generate the correct kind of Signature.
Parameters:
Name Type Description
pair object A polkadot-js KeyringPair.
message array an array of bytes (Uint8)
Source:
Returns:
An instance of the correct subclass of Signature
Type
Signature

getSuiteFromKeyDoc(keyDoc) → {object}

Get signature suite from a keyDoc
Parameters:
Name Type Description
keyDoc object key document containing `id`, `controller`, `type`, `privateKeyBase58` and `publicKeyBase58`
Source:
Returns:
- signature suite.
Type
object

getTransferExtrinsicsFromBlock(api, numberOrHash, balanceFormatted, includeAllTransfers)

Given a block number or block hash, get all transfer extrinsics. Each returned extrinsic is in form `[sender, recipient, amount]`
Parameters:
Name Type Description
api *
numberOrHash *
balanceFormatted *
includeAllTransfers * If false, will only return successful transfer extrinsics
Source:

getTrimmedProofAndValue(document, explicitProof) → {Array}

Remove actual value of proof (signature) from the object and return the trimmed object and the proof value
Parameters:
Name Type Description
document
explicitProof
Source:
Returns:
Type
Array

getUniqueElementsFromArray(a, filterCallback) → {*}

Get unique elements from an array as seen by the filterCallback function.
Parameters:
Name Type Description
a array Array to check for duplicates.
filterCallback function Elements will be fed to this function before comparison.
Source:
Returns:
Type
*

(async) getUpdatesFromBlock(accumulatorId, blockNoOrBlockHash) → {Promise.<Array.<object>>}

Fetch a block and get all accumulator updates made in that block's extrinsics corresponding to accumulator id `accumulatorId`
Parameters:
Name Type Description
accumulatorId
blockNoOrBlockHash
Source:
Returns:
- Resolves to an array of `update`s where each `update` is an object with keys `newAccumulated`, `additions`, `removals` and `witnessUpdateInfo`. The last keys have value null if they were not provided in the extrinsic.
Type
Promise.<Array.<object>>

(async) getVerificationMethod(_) → {Promise.<void>}

Parameters:
Name Type Description
_
Source:
Returns:
- Public key isn't used for verifying KVACs
Type
Promise.<void>

(async) getVerificationMethod(document, proof, documentLoader)

Parameters:
Name Type Description
document object to be signed.
proof object
documentLoader function
Source:

(async) getVerificationMethod(document, proof, documentLoader)

Parameters:
Name Type Description
document object to be signed.
proof object
documentLoader function
Source:

(async) getVerificationMethod(document, proof, documentLoader)

Parameters:
Name Type Description
document object to be signed.
proof object
documentLoader function
Source:

(async) getVerificationMethod(document, proof, documentLoader, expansionMap)

Parameters:
Name Type Description
document object to be signed.
proof object
documentLoader function
expansionMap function
Source:

getVerKeyTypeForKeypair(pair) → {string|*}

Return the crypto type of the verification key for the given keypair.
Parameters:
Name Type Description
pair object Can be a keypair from polkadot-js or elliptic library.
Source:
Returns:
Type
string | *

hash(anchor) → {Uint8Array}

Hash given data using Blake2b
Parameters:
Name Type Description
anchor
Source:
Returns:
Type
Uint8Array

hasRegistryRevocationStatus(expanded) → {boolean}

Checks if a credential status has a registry revocation.
Parameters:
Name Type Description
expanded
Source:
Returns:
Type
boolean

(async) initOrUpdate(convenerDid, registryId, name, govFramework, signingKeyRef, nonceOrDidModule, waitForFinalization, params) → {Promise.<null>}

Initializes Trust Registry with the supplied parameters.
Parameters:
Name Type Default Description
convenerDid
registryId
name
govFramework
signingKeyRef
nonceOrDidModule
waitForFinalization true
params
Source:
Returns:
Type
Promise.<null>

(async) initOrUpdateTx(convenerDid, registryId, name, govFramework, signingKeyRef, nonceOrDidModule, waitForFinalization, params) → {Promise.<null>}

Initializes Trust Registry with the supplied parameters.
Parameters:
Name Type Description
convenerDid
registryId
name
govFramework
signingKeyRef
nonceOrDidModule
waitForFinalization
params
Source:
Returns:
Type
Promise.<null>

isHexWithGivenByteSize(value, byteSizeopt) → {Boolean}

Check if the given input is hexadecimal or not. Optionally checks for the byte size of the hex. Case-insensitive on hex chars
Parameters:
Name Type Attributes Description
value string Hexadecimal value
byteSize number <optional>
Expected byte size of the input.
Source:
Returns:
True if hex (with given size) else false
Type
Boolean

isObject(value) → {boolean}

Return true if a value is an object
Parameters:
Name Type Description
value
Source:
Returns:
Type
boolean

isString(value) → {boolean}

Return true if the given value is a string.
Parameters:
Name Type Description
value
Source:
Returns:
Type
boolean

issueCredential(keyDoc, credential, compactProofopt, documentLoader, purpose, expansionMap, issuerObjectopt, addSuiteContextopt, typeopt, resolver) → {Promise.<object>}

Issue a Verifiable credential
Parameters:
Name Type Attributes Description
keyDoc object key document containing `id`, `controller`, `type`, `privateKeyBase58` and `publicKeyBase58`
credential object Credential to be signed.
compactProof boolean <optional>
Whether to compact the JSON-LD or not.
documentLoader
purpose
expansionMap
issuerObject object <optional>
Optional issuer object to assign
addSuiteContext boolean <optional>
Toggles the default behavior of each signature suite enforcing the presence of its own `@context` (if it is not present, it's added to the context list).
type jsonld | jwt | proofValue <optional>
Optional format/type of the credential (JSON-LD, JWT, proofValue)
resolver
Source:
Returns:
The signed credential object.
Type
Promise.<object>

isVerifiedCredential(credentialopt, paramsopt) → {Promise.<boolean>}

Check that credential is verified, i.e. the credential has VCDM compliant structure and the `proof` (signature by issuer) is correct.
Parameters:
Name Type Attributes Description
credential object <optional>
The credential to verify
params object <optional>
Verify parameters (TODO: add type info for this object)
Source:
Returns:
Returns promise that resolves to true if credential is valid and not revoked and false otherwise
Type
Promise.<boolean>

isVerifiedPresentation(paramsopt) → {Promise.<boolean>}

Check that presentation is verified, i.e. the presentation and credentials have VCDM compliant structure and the `proof` (signature by holder) is correct.
Parameters:
Name Type Attributes Description
params object <optional>
Verify parameters (TODO: add type info for this object)
Source:
Returns:
- Returns promise that resolves to true if the presentation is valid and all the credentials are valid and not revoked and false otherwise. The `error` will describe the error if any.
Type
Promise.<boolean>

matchingResolver(id) → {Resolver.<T>|MultiResolver.<T>|null}

Resolves an entity with the provided identifier.
Parameters:
Name Type Description
id string fully qualified identifier.
Source:
Returns:
Type
Resolver.<T> | MultiResolver.<T> | null

normalizeToHex(data)

Normalizes the given input to hex. Expects a Uint8Array or a hex string
Parameters:
Name Type Description
data Uint8Array | string
Source:

parse(revRegId)

Parameters:
Name Type Description
revRegId string
Source:

parseDid(did)

Parameters:
Name Type Description
did string
Source:

parseEventAsAccumulatorUpdate(event) → {null|Array.<string>}

Accepts an event and returns the accumulator id and accumulated value if the event was `accumulator:AccumulatorUpdated`
Parameters:
Name Type Description
event The event. This is the `event` key in the `event` object, i.e. for the `event` object got in response of `api.query.system.events`, the argument to this function is `event.event`.
Source:
Returns:
- null if the event is not `accumulator:AccumulatorUpdated` else [accumulatorId, accumulated]
Type
null | Array.<string>

parseMapEntries(valueParser, regs) → {Object.<string, ParsedValue>}

Parses map entries by converting keys to `string`s and applying supplied parser to the value.
Parameters:
Name Type Description
valueParser function
regs Map.<RegId, Value>
Source:
Returns:
Type
Object.<string, ParsedValue>

parseRDFDocument(document, parserOptions) → {*}

Parses an RDF document string and formats it according to rify requirements
Parameters:
Name Type Description
document string RDF document in turtle or other form
parserOptions object N3 Parser configuration object
Source:
Returns:
Type
*

parseRef(ref) → {Array.<any>}

Parse a reference to a param or a public key. A reference uniquely identifies a param or a public key and is a pair of a DID and a positive number starting from 1.
Parameters:
Name Type Description
ref
Source:
Returns:
Type
Array.<any>

parseRegistryInfo(registryInfo)

Parses Trust Registry information received from the substrate side.
Parameters:
Name Type Description
registryInfo
Source:

parseSchemaIssuers(issuers) → {object}

Parses schema issuers.
Parameters:
Name Type Description
issuers Map
Source:
Returns:
Type
object

parseSchemaMetadata(metadata) → {Object}

Parses schema metadata.
Parameters:
Name Type Description
metadata Object
Source:
Returns:
Type
Object

parseSchemaVerifiers(verifiers) → {object}

Parses schema verifiers.
Parameters:
Name Type Description
verifiers Array
Source:
Returns:
Type
object

parseSingleEntry(parser) → {ParsedValue}

Parses a single entry.
Parameters:
Name Type Description
parser function
Source:
Returns:
Type
ParsedValue

prepareAddParameters(bytes, curveType, label) → {Object}

Create object to add new parameters on chain
Parameters:
Name Type Description
bytes
curveType
label
Source:
Returns:
Type
Object

prepareAddPublicKey(bytes, curveType, paramsRef) → {Object}

Create object to add new public key on chain
Parameters:
Name Type Description
bytes
curveType
paramsRef Provide if this public key was created using params present on chain.
Source:
Returns:
Type
Object

presentationToEEClaimGraph(expandedPresentation) → {Promise.<Array.<Object>>}

Returns a list of all RDF statements in the presentation. DOES NOT VERIFY THE PRESENTATION. Verification must be performed for the results of this function to be trustworthy.
Parameters:
Name Type Description
expandedPresentation a VCDM presentation as expanded json-ld
Source:
Returns:
Type
Promise.<Array.<Object>>

processIfKvac(credential) → {object|undefined}

For KVAC, public key is not present so the holder assumes that the given credential is valid. Secondly, these credentials are never shared as it is with the verifier so this function returns true if the credential is a KVAC, else returns undefined.
Parameters:
Name Type Description
credential
Source:
Returns:
Type
object | undefined

proveCompositeClaims(expandedPresentation, compositeClaims, rules) → {Promise.<Object>}

Given the assumptions encoded in the provided presentation, prove a list of composite claims. T return proof of composite claims as a jsonld json literal which can be attached directly to a presentation as {expandedLogicProperty} before [signing and ]submitting. This function throws an error if the requested composite claims are unprovable.
Parameters:
Name Type Description
expandedPresentation a VCDM presentation as expanded json-ld
compositeClaims claims to prove, provide in claimgraph format
rules ordered list of axioms which will be accepted within proofs of composite claims
Source:
Returns:
- proof is returned as a json literal
Type
Promise.<Object>

queryNextLookup(claimgraph, query, engine) → {array.<any>}

Queries a claimgraph object and returns all the bindings to the variable named `?lookupNext`
Parameters:
Name Type Description
claimgraph array.<object> A list of RDF quads
query string SPARQL query string
engine object RDF query engine
Source:
Returns:
Type
array.<any>

random() → {this}

Generates a random DID.
Source:
Returns:
Type
this

(async) registriesInfo(by)

Returns Trust Registries information according to the supplied `by` argument.
Parameters:
Name Type Description
by
Source:

(async) registrySchemasMetadata(by, regId) → {Promise.<object>}

Returns schemas metadata for the registry according to the supplied `by` argument.
Parameters:
Name Type Description
by
regId string
Source:
Returns:
Type
Promise.<object>

(async) removeAccumulator(id, signerDid, signingKeyRef, nonce, didModule, waitForFinalization, params) → {Promise.<*>}

Remove the accumulator from chain. This frees up the id for reuse.
Parameters:
Name Type Description
id id to remove
signerDid Signer of the transaction payload
signingKeyRef Signer's keypair reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
waitForFinalization
params
Source:
Returns:
Type
Promise.<*>

(async) removeAccumulatorTx(id, signerDid, signingKeyRef, nonce, didModule) → {Promise.<object>}

Create transaction to remove accumulator
Parameters:
Name Type Description
id id to remove
signerDid Signer of the transaction payload
signingKeyRef Signer's keypair reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
Source:
Returns:
Type
Promise.<object>

(async) removeParams(index, signerDid, keyPair, signingKeyRef, nonce, didModule, waitForFinalization, params) → {Promise.<*>}

Remove existing BBS+ params.
Parameters:
Name Type Description
index Index to uniquely identify BBS+ params
signerDid Signer of the blob
keyPair Signer's keypair
signingKeyRef Reference to the keypair used by the signer. This will be used by the verifier (node) to fetch the public key for verification
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
waitForFinalization
params
Source:
Returns:
Type
Promise.<*>

(async) removeParamsTx(index, signerDid, keyPair, signingKeyRef, nonce, didModule) → {Promise.<*>}

Create transaction to remove existing BBS+ params.
Parameters:
Name Type Description
index Index to uniquely identify BBS+ params
signerDid Signer of the payload
keyPair Signer's keypair
signingKeyRef Reference to the keypair used by the signer. This will be used by the verifier (node) to fetch the public key for verification
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
Source:
Returns:
Type
Promise.<*>

(async) removePublicKey(removeKeyId, signerDid, signingKeyRef, nonce, didModule, waitForFinalization, params) → {Promise.<*>}

Remove a public key
Parameters:
Name Type Description
removeKeyId Index of the accumulator public key
signerDid Signer of the transaction payload
signingKeyRef Signer's keypair reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
waitForFinalization
params
Source:
Returns:
Type
Promise.<*>

(async) removePublicKey(removeKeyId, targetDid, signerDid, signingKeyRef, nonce, didModule, waitForFinalization, params) → {Promise.<*>}

Remove public key
Parameters:
Name Type Description
removeKeyId The key index for key to remove.
targetDid The DID from which key is being removed
signerDid The DID that is removing the key by signing the payload because it controls `targetDid`
signingKeyRef Signer's signing key reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
waitForFinalization
params
Source:
Returns:
Type
Promise.<*>

removeStatusListCredential(id, didSigs, waitForFinalization, params)

Removes status list credential.
Parameters:
Name Type Default Description
id Unique identifier of the status list credential.
didSigs Array of pairs with each pair of the form `[DidSig, nonce]` where `nonce` is the nonce used while signing the payload
waitForFinalization true
params
Source:

(async) removeStatusListCredentialWithOneOfPolicy(id, did, signingKeyRef, nonce, didModule, waitForFinalization, params) → {Promise.<Object>}

Remove a single `StatusListCredential`. Works only with credentials having `OneOf` policy
Parameters:
Name Type Description
id Unique identifier of the status list credential.
did Signer of the transaction payload
signingKeyRef Signer's signing key reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
waitForFinalization
params
Source:
Returns:
Type
Promise.<Object>

(async) resolve(did) → {Promise.<object>}

Fetch the DID from the universal resolver.
Parameters:
Name Type Description
did string A full DID (with method, like did:uport:2nQtiQG....)
Source:
Returns:
Type
Promise.<object>

(async) resolve(id) → {Promise.<T>}

Resolves an entity with the provided identifier.
Parameters:
Name Type Description
id string fully qualified identifier.
Source:
Returns:
Type
Promise.<T>

(async) revoked(index) → {Promise.<boolean>}

Returns `true` if given index is revoked or suspended, `false` otherwise. Throws an error if the underlying status list can't be decoded or supplied index is out of range.
Parameters:
Name Type Description
index number
Source:
Returns:
Type
Promise.<boolean>

(async) revokedBatch(indices) → {Promise.<Array.<boolean>>}

Accepts an iterable of indices to be checked and returns an array containing `true` in the positions of revoked (suspended) indices and `false` for non-revoked (non-suspended) indices. Throws an error if the underlying status list can't be decoded or any of supplied indices is out of range.
Parameters:
Name Type Description
indices Iterable.<number>
Source:
Returns:
Type
Promise.<Array.<boolean>>

(async) schemaIssuers(schemaId) → {Promise.<object>}

Retrieves issuers for the supplied `schemaId` from all registries.
Parameters:
Name Type Description
schemaId string
Source:
Returns:
Type
Promise.<object>

(async) schemaIssuersInRegistry(schemaId, regId) → {Promise.<object>}

Retrieves issuers for the supplied `schemaId`/`regId` combination.
Parameters:
Name Type Description
schemaId string
regId string
Source:
Returns:
Type
Promise.<object>

(async) schemaMetadata(schemaId) → {Promise.<object>}

Retrieves metadata for the supplied `schemaId` from all registries.
Parameters:
Name Type Description
schemaId string
Source:
Returns:
Type
Promise.<object>

(async) schemaMetadataInRegistry(schemaId, regId) → {Promise.<object>}

Retrieves metadata for the supplied `schemaId`/`regId` combination.
Parameters:
Name Type Description
schemaId string
regId string
Source:
Returns:
Type
Promise.<object>

(async) schemaVerifiers(schemaId) → {Promise.<object>}

Retrieves verifiers for the supplied `schemaId` from all registries.
Parameters:
Name Type Description
schemaId string
Source:
Returns:
Type
Promise.<object>

(async) schemaVerifiersInRegistry(schemaId, regId) → {Promise.<object>}

Retrieves verifiers for the supplied `schemaId`/`regId` combination.
Parameters:
Name Type Description
schemaId string
regId string
Source:
Returns:
Type
Promise.<object>

(async) send(extrinsic, waitForFinalization) → {Promise.<SubmittableResult>}

Helper function to send with retries a transaction that has already been signed.
Parameters:
Name Type Default Description
extrinsic Extrinsic to send
waitForFinalization true If true, waits for extrinsic's block to be finalized, else only wait to be included in the block.
Source:
Returns:
Type
Promise.<SubmittableResult>

sendNoRetries(dock, extrinsic, waitForFinalization) → {Promise.<SubmittableResult>}

Helper function to send without retrying a transaction that has already been signed.
Parameters:
Name Type Description
dock DockAPI
extrinsic * Extrinsic to send
waitForFinalization boolean If true, waits for extrinsic's block to be finalized, else only wait to be included in the block.
Source:
Returns:
Type
Promise.<SubmittableResult>

setAccount(account)

TODO: Should probably use set/get and rename account to _account Sets the account used to sign transactions
Parameters:
Name Type Description
account KeyringPair PolkadotJS Keyring account
Source:

(async) setJSONSchema(json)

Add the JSON schema to this object after checking that `json` is a valid JSON schema. Check if JSON is valid.
Parameters:
Name Type Description
json object the schema JSON
Source:

(async) setSchemasMetadata(convenerOrIssuerOrVerifierDid, registryId, schemas, signingKeyRef, nonceOrDidModule, waitForFinalization, params) → {Promise.<null>}

Sets schema metadatas in the registry.
Parameters:
Name Type Default Description
convenerOrIssuerOrVerifierDid
registryId
schemas
signingKeyRef
nonceOrDidModule
waitForFinalization true
params
Source:
Returns:
Type
Promise.<null>

(async) setSchemasMetadataTx(convenerOrIssuerOrVerifierDid, registryId, schemas, signingKeyRef, nonce, didModule) → {Promise.<null>}

Creates a transaction to update schema metadatas in the registry.
Parameters:
Name Type Description
convenerOrIssuerOrVerifierDid
registryId
schemas
signingKeyRef
nonce
didModule
Source:
Returns:
Type
Promise.<null>

sign(pair, blobModule)

Serializes the object using `getSerializedBlob` and then signs it using the given polkadot-js pair. The object will be updated with key `signature`. Repeatedly calling it will keep resetting the `signature` key
Parameters:
Name Type Description
pair object Key pair to sign with
blobModule
Source:

(async) sign(options) → {Promise.<object>}

Adds a signature (proofValue) field to the proof object. Called by LinkedDataSignature.createProof().
Parameters:
Name Type Description
options object The options to use.
Properties
Name Type Description
verifyData Uint8Array Data to be signed (extracted from document, according to the suite's spec).
proof object Proof object (containing the proofPurpose, verificationMethod, etc).
Source:
Returns:
Resolves with the proof containing the signature value.
Type
Promise.<object>

(async) sign(options) → {Promise.<object>}

Adds a signature (proofValue) field to the proof object. Called by LinkedDataSignature.createProof().
Parameters:
Name Type Description
options object The options to use.
Properties
Name Type Description
verifyData Uint8Array Data to be signed (extracted from document, according to the suite's spec).
proof object Proof object (containing the proofPurpose, verificationMethod, etc).
Source:
Returns:
Resolves with the proof containing the signature value.
Type
Promise.<object>

signAddParams(signingKeyRef, params) → {Signature}

Parameters:
Name Type Description
signingKeyRef
params
Source:
Returns:
Type
Signature

signAddPublicKey(signingKeyRef, pk) → {Signature}

Parameters:
Name Type Description
signingKeyRef
pk
Source:
Returns:
Type
Signature

(async) signAndSend(extrinsic, waitForFinalization, params) → {Promise}

Helper function to sign and send transaction
Parameters:
Name Type Default Description
extrinsic object Extrinsic to sign and send
waitForFinalization Boolean true If true, waits for extrinsic's block to be finalized, else only wait to be included in block.
params object An object used to parameters like nonce, etc to the extrinsic
Source:
Returns:
Type
Promise

signer() → {Object}

Returns a signer object for use with jsonld-signatures.
Source:
Returns:
A signer for the json-ld block.
Type
Object

signerFactory(keypair, verificationMethod) → {object}

Generate object with `sign` method
Parameters:
Name Type Description
keypair
verificationMethod
Source:
Returns:
Type
object

signerFactory(keypair, verificationMethod) → {object}

Generate object with `sign` method
Parameters:
Name Type Description
keypair
verificationMethod
Source:
Returns:
Type
object

signerFactory(keypair, verificationMethod) → {object}

Generate object with `sign` method
Parameters:
Name Type Description
keypair
verificationMethod
Source:
Returns:
Type
object

signerFactory(keypair, verificationMethod) → {object}

Generate object with `sign` method
Parameters:
Name Type Description
keypair
verificationMethod
Source:
Returns:
Type
object

signerFactory(keypair) → {object}

Generate object with `sign` method
Parameters:
Name Type Description
keypair
Source:
Returns:
Type
object

signerFactory(keypair, verificationMethod) → {object}

Generate object with `sign` method
Parameters:
Name Type Description
keypair
verificationMethod
Source:
Returns:
Type
object

(async) signExtrinsic(extrinsic, params) → {Promise}

Signs an extrinsic with either the set account or a custom sign method (see constructor)
Parameters:
Name Type Description
extrinsic object Extrinsic to send
params object An object used to parameters like nonce, etc to the extrinsic
Source:
Returns:
Type
Promise

signPrehashed(messageHash, signingPair) → {string}

Sign an already hashed message
Parameters:
Name Type Description
messageHash Hash of the message
signingPair
Source:
Returns:
Type
string

signPresentation(presentation, keyDoc, challenge, domain, resolveropt, compactProofopt, presentationPurposeopt) → {Promise.<VerifiablePresentation>}

Sign a Verifiable Presentation
Parameters:
Name Type Attributes Description
presentation object the one to be signed
keyDoc object key document containing `id`, `controller`, `type`, `privateKeyBase58` and `publicKeyBase58`
challenge string proof challenge Required.
domain string proof domain (optional)
resolver DIDResolver <optional>
Resolver for DIDs.
compactProof Boolean <optional>
Whether to compact the JSON-LD or not.
presentationPurpose object <optional>
Optional presentation purpose to override default AuthenticationProofPurpose
Source:
Returns:
A VerifiablePresentation with a proof.
Type
Promise.<VerifiablePresentation>

signRemoveParams(signingKeyRef, ref) → {Signature}

Parameters:
Name Type Description
signingKeyRef
ref
Source:
Returns:
Type
Signature

signRemovePublicKey(signingKeyRef, ref) → {Signature}

Parameters:
Name Type Description
signingKeyRef
ref
Source:
Returns:
Type
Signature

supports(id) → {boolean}

Returns `true` if an entity with the provided identifier can be resolved using this resolver.
Parameters:
Name Type Description
id string fully qualified identifier.
Source:
Returns:
Type
boolean

(async) suspendIssuers(convenerDid, registryId, issuers, signingKeyRef, nonceOrDidModule, waitForFinalization, params) → {Promise.<null>}

Suspends issuers in the registry.
Parameters:
Name Type Default Description
convenerDid
registryId
issuers
signingKeyRef
nonceOrDidModule
waitForFinalization true
params
Source:
Returns:
Type
Promise.<null>

(async) suspendIssuersTx(convenerDid, registryId, issuers, signingKeyRef, nonceOrDidModule) → {Promise.<null>}

Suspends issuers in the registry.
Parameters:
Name Type Description
convenerDid
registryId
issuers
signingKeyRef
nonceOrDidModule
Source:
Returns:
Type
Promise.<null>

toBlob() → {object}

Serializes the schema to a blob object to send to the node
Source:
Returns:
Type
object

toBytes() → {Uint8Array}

Encodes `StatusList2021Credential` as bytes.
Source:
Returns:
Type
Uint8Array

toEncodedString()

Returns unqualified public key encoded in `BS58`.
Source:

toEncodedString()

Returns unqualified DID encoded as a `SS58` address.
Source:

toJSON() → {object}

Serializes schema object to JSON
Source:
Returns:
Type
object

toJSON() → {Object}

Source:
Returns:
The PublicKey JSON variant Ed25519.
Type
Object

toJSON() → {Object}

Source:
Returns:
The PublicKey JSON variant Secp256k1.
Type
Object

toJSON() → {Object}

Source:
Returns:
The PublicKey JSON variant Sr25519.
Type
Object

toJSON() → {Object}

Source:
Returns:
The PublicKey JSON variant X25519.
Type
Object

toJSON() → {Object}

Source:
Returns:
The correct PublicKey JSON variant. The extending export class should implement it.
Type
Object

toJSON() → {Object}

Source:
Returns:
The DidSignature JSON variant Ed25519.
Type
Object

toJSON() → {Object}

Source:
Returns:
The DidSignature JSON variant Secp256k1.
Type
Object

toJSON() → {Object}

Source:
Returns:
The DidSignature JSON variant Sr25519.
Type
Object

toJSON() → {Object}

Source:
Returns:
The correct DidSignature JSON variant. The extending export class should implement it.
Type
Object

toJSON() → {object}

Converts `StatusList2021Credential` to its JSON representation.
Source:
Returns:
Type
object

toJSON() → {object}

Converts policy to JSON object
Source:
Returns:
Type
object

toJSON() → {object}

Converts policy to JSON object
Source:
Returns:
Type
object

toJsonldjsNode(node) → {any}

Converts a a JSON-LD RDF object to N3 data type
Parameters:
Name Type Description
node object JSON-LD RDF representation object
Source:
Returns:
Type
any

toSubstrate() → {Object}

Converts given credentials to the substrate-compatible representation.
Source:
Returns:
Type
Object

transferDock(api, senderKeypair, recipAddr, amount, sendTxn) → {Promise.<*>}

Transfer tokens and return txn hash. Converts to mirco tokens first
Parameters:
Name Type Description
api
senderKeypair
recipAddr
amount Amount in tokens
sendTxn If true, will send the transaction and return transaction hash otherwise return the signed transaction
Source:
Returns:
Type
Promise.<*>

transferMicroDock(api, senderKeypair, recipAddr, amount, sendTxn) → {Promise.<*>}

Transfer micro tokens and return txn hash.
Parameters:
Name Type Description
api
senderKeypair
recipAddr
amount Amount in micro (10^-6) tokens
sendTxn If true, will send the transaction and return transaction hash otherwise return the signed transaction
Source:
Returns:
Type
Promise.<*>

typedHexDID(api, did) → {string|DockDid|DidMethodKey}

Takes a DID string, gets the hexadecimal value of that and returns either the `DockDid` or `DidMethodKey` object.
Parameters:
Name Type Description
api Object
did string | DockDid | DidMethodKey | object The DID can be passed as fully qualified DID like `did:dock:` or `did:key:` or a 32 byte hex string
Source:
Returns:
Returns a `string` or `DockDid` or `DidMethodKey` object.
Type
string | DockDid | DidMethodKey

(async) unsuspendIssuers(convenerDid, registryId, issuers, signingKeyRef, nonceOrDidModule, waitForFinalization, params) → {Promise.<null>}

Unsuspends issuers in the registry.
Parameters:
Name Type Default Description
convenerDid
registryId
issuers
signingKeyRef
nonceOrDidModule
waitForFinalization true
params
Source:
Returns:
Type
Promise.<null>

(async) unsuspendIssuersTx(convenerDid, registryId, issuers, signingKeyRef, nonceOrDidModule) → {Promise.<null>}

Unsuspends issuers in the registry.
Parameters:
Name Type Description
convenerDid
registryId
issuers
signingKeyRef
nonceOrDidModule
Source:
Returns:
Type
Promise.<null>

(async) update(keyDoc, updateopt) → {Promise.<this>}

Revokes indices and unsuspends other indices in the underlying status list, regenerating the proof. If `statusPurpose` = `revocation`, indices can't be unsuspended. The status list revoked (suspended)/unsuspended indices will be set atomically and in case of an error, the underlying value won't be modified. Throws an error if the underlying status list can't be decoded or any of the supplied indices is out of range.
Parameters:
Name Type Attributes Default Description
keyDoc KeyDoc
update object <optional>
{}
Properties
Name Type Description
revokeIndices Iterable.<number> indices to be revoked or suspended
unsuspendIndices Iterable.<number> indices to be unsuspended
Source:
Returns:
Type
Promise.<this>

(async) updateAccumulator(id, newAccumulated, additions, removals, witnessUpdateInfo, signerDid, signingKeyRef, nonce, didModule, waitForFinalization, params) → {Promise.<object>}

Update existing accumulator
Parameters:
Name Type Description
id
newAccumulated Accumulated value after the update
additions
removals
witnessUpdateInfo
signerDid Signer of the transaction payload
signingKeyRef Signer's keypair reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
waitForFinalization
params
Source:
Returns:
Type
Promise.<object>

(async) updateAccumulatorTx(id, newAccumulated, additions, removals, witnessUpdateInfo, signerDid, signingKeyRef, nonce, didModule) → {Promise.<object>}

Create a transaction to update accumulator
Parameters:
Name Type Description
id Unique accumulator id
newAccumulated Accumulated value after the update
additions
removals
witnessUpdateInfo
signerDid Signer of the transaction payload
signingKeyRef Signer's keypair reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
Source:
Returns:
Type
Promise.<object>

(async) updateDelegatedIssuers(issuerDid, registryId, issuers, delegated, signingKeyRef, params, waitForFinalization, params) → {Promise.<null>}

Sets delegated issuers for the caller DID.
Parameters:
Name Type Description
issuerDid
registryId
issuers
delegated
signingKeyRef
params
waitForFinalization
params
Source:
Returns:
Type
Promise.<null>

updateStatusList(statusPurpose, statusList, revokeIndices, unsuspendIndices)

Revokes (suspends) `revokeIndices` and unsuspends `unsuspendIndices` from the supplied `StatusList`. Throws an error if - non-empty `unsuspendIndices` passed along with `statusPurpose != suspension` - any index is present in both iterables - some index is out of bounds.
Parameters:
Name Type Description
statusPurpose 'revocation' | 'suspension'
statusList StatusList
revokeIndices Iterable.<number>
unsuspendIndices Iterable.<number>
Source:

updateStatusListCredential(updateStatusListCredential, didSigs, waitForFinalization, params)

Updates status list credential.
Parameters:
Name Type Default Description
updateStatusListCredential
didSigs Array of pairs with each pair of the form `[DidSig, nonce]` where `nonce` is the nonce used while signing the payload
waitForFinalization true
params
Source:

(async) updateStatusListCredentialWithOneOfPolicy(id, statusListCredential, did, signingKeyRef, nonce, didModule, waitForFinalization, params) → {Promise.<Object>}

Update a single `StatusListCredential`. Works only with credentials having `OneOf` policy
Parameters:
Name Type Description
id Unique identifier of the status list credential.
statusListCredential Status list credential.
did Signer of the transaction payload
signingKeyRef Signer's signing key reference
nonce The nonce to be used for sending this transaction. If not provided then `didModule` must be provided.
didModule Reference to the DID module. If nonce is not provided then the next nonce for the DID is fetched by using this
waitForFinalization
params
Source:
Returns:
Type
Promise.<Object>

validate()

Validates underlying `StatusList2021Credential`.
Source:

(async) validate(proof, options) → {Promise.<{valid: boolean, error: Error}>}

Validates the purpose of a proof. This method is called during proof verification, after the proof value has been checked against the given verification method (in the case of a digital signature, the signature has been cryptographically verified against the public key).
Parameters:
Name Type Description
proof object The proof to validate.
options object The options to use.
Properties
Name Type Attributes Description
document object The document whose signature is being verified.
suite object Signature suite used in the proof.
verificationMethod string Key id URL to the paired public key.
documentLoader object <optional>
A document loader.
expansionMap object <optional>
An expansion map.
Source:
Throws:
  • If verification method not authorized by controller.
    Type
    Error
  • If proof's created timestamp is out of range.
    Type
    Error
Returns:
Resolves on completion.
Type
Promise.<{valid: boolean, error: Error}>

validateAddress(address, network) → {boolean}

Return true if an address is valid according to the provided network, false otherwise.
Parameters:
Name Type Description
address string The address in SS58 format.
network string Address if from testnet or mainnet. Accepts only `test` and `main`.
Source:
Returns:
true if the address is valid, false otherwise.
Type
boolean

validateBlobIDHexIdentifier(identifier) → {void}

Check if the given identifier is 32 byte hex
Parameters:
Name Type Description
identifier string The identifier to check.
Source:
Returns:
Throws exception if invalid identifier
Type
void

validateByteSize()

Check that the given public key has the expected byte size. Assumes the public key is in hex.
Source:

validateByteSize()

Check that the given signature has the expected byte size. Assumes the signature is in hex.
Source:

validateCredentialSchema(credential, schema, context, documentLoader) → {Promise.<Boolean>}

The function uses `jsonschema` package to verify that the expanded `credential`'s subject `credentialSubject` has the JSON schema `schema`
Parameters:
Name Type Description
credential object The credential to use, must be expanded JSON-LD
schema object The schema to use
context
documentLoader
Source:
Returns:
- Returns promise to a boolean or throws error
Type
Promise.<Boolean>

validateDockDIDHexIdentifier(identifier) → {void}

Check if the given identifier is the hex representation of a Dock DID.
Parameters:
Name Type Description
identifier string The identifier to check.
Source:
Returns:
Throws exception if invalid identifier
Type
void

validateDockDIDSS58Identifier(identifier) → {void}

Check if the given identifier is 32 byte valid SS58 string
Parameters:
Name Type Description
identifier string The identifier to check.
Source:
Returns:
Throws exception if invalid identifier
Type
void

(async) validateSchema(json) → {Promise.<object>}

Check that the given JSON schema is compliant with JSON schema spec mentioned in RFC
Parameters:
Name Type Description
json object The JSON schema to validate
Source:
Returns:
- Returns promise to an object or throws error
Type
Promise.<object>

verifier() → {object}

Construct the verifier factory that has the verify method using the current public key
Source:
Returns:
Type
object

verifier() → {object}

Construct the verifier factory that has the verify method using the current public key
Source:
Returns:
Type
object

verifier() → {object}

Construct the verifier factory that has the verify method using the current public key
Source:
Returns:
Type
object

verifier() → {Object}

Returns a verifier object for use with jsonld-signatures.
Source:
Returns:
Used to verify jsonld-signatures.
Type
Object

verifierFactory(publicKey) → {object}

Verifier factory that returns the object with the verify method
Parameters:
Name Type Description
publicKey
Source:
Returns:
Type
object

verifierFactory(publicKey) → {object}

Verifier factory that returns the object with the verify method
Parameters:
Name Type Description
publicKey
Source:
Returns:
Type
object

verifierFactory(publicKey) → {object}

Verifier factory that returns the object with the verify method
Parameters:
Name Type Description
publicKey
Source:
Returns:
Type
object

verifierFactory(keypair) → {object}

Generate object with `verify` method
Parameters:
Name Type Description
keypair
Source:
Returns:
Type
object

verifyAnoncreds(presentation, options) → {Promise.<VerifyResult>}

Verify an anoncreds presentation given in JSON format
Parameters:
Name Type Description
presentation object
options Any accumulator public keys, predicate params, etc required to verify the presentation.
Source:
Returns:
Type
Promise.<VerifyResult>

verifyCredential(vcJSONorStringopt, options) → {Promise.<object>}

Verify a Verifiable Credential. Returns the verification status and error in an object
Parameters:
Name Type Attributes Description
vcJSONorString object <optional>
The VCDM Credential as JSON-LD or JWT string
options VerifiableParams Verify parameters, this object is passed down to jsonld-signatures calls
Source:
Returns:
verification result. The returned object will have a key `verified` which is true if the credential is valid and not revoked and false otherwise. The `error` will describe the error if any.
Type
Promise.<object>

verifyEcdsaSecp256k1Sig(message, signature, publicKey) → {boolean}

Verify a given signature on a given message
Parameters:
Name Type Description
message array Bytes of message. Its assumed that the message is not hashed already and hashed before verifying
signature SignatureSecp256k1 signature to verify
publicKey PublicKeySecp256k1 Secp256k1 public key for verification
Source:
Returns:
True when signature is valid, false otherwise
Type
boolean

verifyEcdsaSecp256k1SigPrehashed(messageHash, signature, publicKey) → {boolean}

Verify a given signature on a given message hash
Parameters:
Name Type Description
messageHash array Hash of the message. Its assumed that the message is hashed already
signature SignatureSecp256k1 signature to verify
publicKey PublicKeySecp256k1 Secp256k1 public key for verification
Source:
Returns:
True when signature is valid, false otherwise
Type
boolean

verifyID(id)

Fail if the given verifiable credential id isn't a valid `StatusList2021Credential` id.
Parameters:
Name Type Description
id *
Source:

verifyMerkleProofOfDocument(document, proof, root) → {boolean}

Verify inclusion proof of document in a merkle tree with given root. The document is hashed to form a leaf first
Parameters:
Name Type Description
document
proof
root
Source:
Returns:
Type
boolean

verifyMerkleProofOfLeaf(leaf, proof, root) → {boolean}

Verify inclusion proof of leaf in a merkle tree with given root.
Parameters:
Name Type Description
leaf
proof
root
Source:
Returns:
Type
boolean

verifyPresentation(presentation, options) → {Promise.<object>}

Verify a Verifiable Presentation. Returns the verification status and error in an object
Parameters:
Name Type Description
presentation object The verifiable presentation
options VerifiableParams Verify parameters, this object is passed down to jsonld-signatures calls
Source:
Returns:
verification result. The returned object will have a key `verified` which is true if the presentation is valid and all the credentials are valid and not revoked and false otherwise. The `error` will describe the error if any.
Type
Promise.<object>

verifyPrivateStatus(credentialStatus, privateStatusListCredential, documentLoader, suite, verifyStatusListCredential, expectedIssuer) → {Promise.<{verified: boolean}>}

Verify the credential status given the private status list credential
Parameters:
Name Type Description
credentialStatus `credentialStatus` field of the credential
privateStatusListCredential
documentLoader
suite
verifyStatusListCredential Whether to verify the status list credential. This isn't necessary when the caller of this function got the credential directly from the issuer.
expectedIssuer Checks whether the issuer of the private status list credential matches the given
Source:
Returns:
Type
Promise.<{verified: boolean}>

(async) verifySignature(options) → {Promise.<boolean>}

Verifies the proof signature against the given data.
Parameters:
Name Type Description
options object The options to use.
Properties
Name Type Description
verifyData Uint8Array Canonicalized hashed data.
verificationMethod object Key object.
proof object The proof to be verified.
Source:
Returns:
Resolves with the verification result.
Type
Promise.<boolean>

(async) verifySignature(options) → {Promise.<boolean>}

Verifies the proof signature against the given data.
Parameters:
Name Type Description
options object The options to use.
Properties
Name Type Description
verifyData Uint8Array Canonicalized hashed data.
verificationMethod object Key object.
proof object The proof to be verified.
Source:
Returns:
Resolves with the verification result.
Type
Promise.<boolean>

withExtendedStaticProperties(properties, parentClass) → {T}

Enhances the provided class with the given list of static properties to require in the inherited class. All properties will be checked for presence during the object constructor call. Each property on its own will be checked every time it is accessed. In case some property is missing, an error will be thrown.
Parameters:
Name Type Description
properties Array.<string>
parentClass T
Source:
Returns:
Type
T

wrapFnWithRetries(obj, prop, pathopt)

Recursively patches supplied object property and all underlying objects, so all functions will attempt to retry 2 times and will throw an error if there's no result within the `8 seconds` timeout.
Parameters:
Name Type Attributes Default Description
obj *
prop *
path Array.<string> <optional>
[]
Source:

(async) writeToChain(dock, signerDid, keyPair, nonce, waitForFinalization, params) → {Promise.<object>}

Prepares a transaction to write this schema object to the dock chain using the blob module
Parameters:
Name Type Description
dock object The dock API
signerDid
keyPair
nonce
waitForFinalization
params
Source:
Returns:
The extrinsic to sign and send.
Type
Promise.<object>

Type Definitions

KeyDoc

The Options to use in the function createUser.
Type:
  • object
Properties:
Name Type Description
id string The key's ID
controller any The key's controller ste
type any the type of key, Sr25519VerificationKey2020 or Ed25519VerificationKey2018 or EcdsaSecp256k1VerificationKey2019
keypair object Keypair is generated by either using polkadot-js's keyring or utils
publicKey object The key's public key taken from the keypair
Source:

Options

The Options to use in the function DockAPI.
Type:
  • object
Properties:
Name Type Attributes Description
address string <optional>
The node address to connect to.
keyring object <optional>
PolkadotJS keyring
chainTypes object <optional>
Types for the chain
chainRpc object <optional>
RPC definitions for the chain
loadPoaModules Boolean <optional>
Whether to load PoA modules or not. Defaults to true
Source:

RetryConfig

Type:
  • object
Properties:
Name Type Description
finalizedTimeoutBlocks number Amount of blocks to wait for the extrinsic to be finalized before retrying.
inBlockTimeoutBlocks number Amount of blocks to wait for the extrinsic to be included in the block before retrying.
retryDelayBlocks number Amount of blocks to wait before a retry attempt.
BLOCK_TIME_MS number Block time in ms.
maxAttempts number Max retry attempts (doesn't include initial request).
fetchGapBlocks number Amount of blocks to be fetched in addition to the strict amount of blocks. It will cover timing for fetching the block data.
Source:

VerifiableCredentialVerificationResult

The credential verification result
Type:
  • object
Properties:
Name Type Attributes Description
verified Boolean Is this credential verified or not
results array Verification results
error any <optional>
Optional error
Source:

VerifiableParams

The Options to verify credentials and presentations.
Type:
  • object
Properties:
Name Type Attributes Default Description
challenge string <optional>
proof challenge Required.
domain string <optional>
proof domain (optional)
controller string <optional>
controller (optional)
resolver Resolver <optional>
Resolver to resolve the `DID`s/`StatusList`s/`Blob`s/Revocation registries (optional)
unsignedPresentation boolean <optional>
Whether to verify the proof or not
compactProof boolean <optional>
Whether to compact the JSON-LD or not.
skipRevocationCheck boolean <optional>
false Disables revocation check. **Warning, setting `skipRevocationCheck` to `true` can allow false positives when verifying revocable credentials.**
skipSchemaCheck boolean <optional>
false Disables schema check. **Warning, setting `skipSchemaCheck` to `true` can allow false positives when verifying revocable credentials.**
verifyMatchingIssuersForRevocation boolean <optional>
true ensure that status list credential issuer is same as credential issuer. **Will be used only if credential doesn't have `StatusList2021Entry` in `credentialStatus`.**
purpose object <optional>
A purpose other than the default CredentialIssuancePurpose
documentLoader object <optional>
A document loader, can be null and use the default
Source:

VerifiableParams

The Options to verify credentials and presentations.
Type:
  • object
Properties:
Name Type Attributes Description
challenge string <optional>
proof challenge Required.
domain string <optional>
proof domain (optional)
controller string <optional>
controller (optional)
resolver DIDResolver <optional>
Resolver to resolve the issuer DID (optional)
unsignedPresentation Boolean <optional>
Whether to verify the proof or not
compactProof Boolean <optional>
Whether to compact the JSON-LD or not.
presentationPurpose object <optional>
A purpose other than the default AuthenticationProofPurpose
documentLoader object <optional>
A document loader, can be null and use the default
Source:

VerifiablePresentation

Representation of a Verifiable Presentation.
Type:
  • object
Source:

VerifiablePresentationVerificationResult

The presentation verification result
Type:
  • object
Properties:
Name Type Attributes Description
presentationResult object Is this presentqtion verified or not
credentialResults array Verification results
verified Boolean Is verified or not
error any <optional>
Optional error
Source: