Class: RevocationModule

RevocationModule(api, signAndSend)

Class to create, update and destroy revocations

Constructor

new RevocationModule(api, signAndSend)

Creates a new instance of RevocationModule and sets the api
Parameters:
Name Type Description
api object PolkadotJS API Reference
signAndSend
Source:

Methods

createNewRegistryTx(id, policy, addOnly) → {Promise.<object>}

Creating a revocation registry
Parameters:
Name Type Description
id string is the unique id of the registry. The function will check whether `id` is already taken or not.
policy Policy The registry policy
addOnly Boolean true: credentials can be revoked, but not un-revoked, false: credentials can be revoked and un-revoked
Source:
Returns:
The extrinsic to sign and send.
Type
Promise.<object>

createRemoveRegistryTx(removal, didSigs) → {Promise.<object>}

Create a transaction to remove a revocation registry
Parameters:
Name Type Description
removal The payload to remove the registry
didSigs Array of pairs with each pair of the form `[DidSig, nonce]` where `nonce` is the nonce used while signing the payload
Source:
Returns:
The extrinsic to sign and send.
Type
Promise.<object>

createRevokeTx(revoke, didSigs) → {Promise.<object>}

Create transaction to revoke credentials
Parameters:
Name Type Description
revoke
didSigs Array of pairs with each pair of the form `[DidSig, nonce]` where `nonce` is the nonce used while signing the payload
Source:
Returns:
The extrinsic to sign and send.
Type
Promise.<object>

createUnrevokeTx(unrevoke, didSigs) → {Promise.<object>}

Create transaction to unrevoke credentials
Parameters:
Name Type Description
unrevoke
didSigs Array of pairs with each pair of the form `[DidSig, nonce]` where `nonce` is the nonce used while signing the payload
Source:
Returns:
The extrinsic to sign and send.
Type
Promise.<object>

(async) getIsRevoked(registryId, revokeId) → {Promise.<Boolean>}

The read-only call get_revocation_status is used to check whether a credential is revoked or not and does not consume any tokens. If
Parameters:
Name Type Description
registryId string Revocation registry ID
revokeId string Revocation id. This is set as the hash of the credential id.
Source:
Returns:
Returns a promise to true if credential is revoked else to false.
Type
Promise.<Boolean>

(async) getRevocationRegistry(registryID) → {Promise}

Get data of the revocation registry like controllers, policy and type. If the registry is not present, error is thrown.
Parameters:
Name Type Description
registryID string Revocation registry ID
Source:
Returns:
A promise to registry data
Type
Promise

getSerializedRemoveRegistry(removeReg) → {Array}

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

getSerializedRevoke(revoke) → {Array}

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

getSerializedUnrevoke(unrevoke) → {Array}

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

(async) newRegistry(id, policy, addOnly, waitForFinalization, params) → {Promise.<object>}

Creating a revocation registry
Parameters:
Name Type Default Description
id string is the unique id of the registry. The function will check whether `id` is already taken or not.
policy Policy The registry policy
addOnly Boolean true: credentials can be revoked, but not un-revoked, false: credentials can be revoked and un-revoked
waitForFinalization true
params
Source:
Returns:
Promise to the pending transaction
Type
Promise.<object>

(async) removeRegistry(removal, didSigs, waitForFinalization, params) → {Promise.<object>}

Remove a revocation registry
Parameters:
Name Type Default Description
removal
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:
Returns:
Promise to the pending transaction
Type
Promise.<object>

(async) revoke(revoke, didSigs, waitForFinalization, params) → {Promise.<object>}

Revoke credentials
Parameters:
Name Type Default Description
revoke
didSigs
waitForFinalization true
params
Source:
Returns:
Promise to the pending transaction
Type
Promise.<object>

(async) revokeCredentialWithOneOfPolicy(registryId, revId, did, keyPair, keyId, nonce, didModule, waitForFinalization, params) → {Promise.<void>}

TODO: Use the spread operator to accept multiple revocation ids Revoke a single credential. Works only with registries having `OneOf` policy
Parameters:
Name Type Description
registryId The registry id being updated
revId The revocation id that is being revoked
did
keyPair
keyId
nonce
didModule
waitForFinalization
params
Source:
Returns:
Type
Promise.<void>

(async) unrevoke(unrevoke, didSigs, waitForFinalization, params) → {Promise.<object>}

Unrevoke credentials
Parameters:
Name Type Default Description
unrevoke
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:
Returns:
Promise to the pending transaction
Type
Promise.<object>

(async) unrevokeCredentialWithOneOfPolicy(registryId, revId, did, keyPair, keyId, nonce, didModule, waitForFinalization, params) → {Promise.<Object>}

Unrevoke a single credential. Works only with registries having `OneOf` policy
Parameters:
Name Type Description
registryId
revId
did
keyPair
keyId
nonce
didModule
waitForFinalization
params
Source:
Returns:
Type
Promise.<Object>