PrismDIDMethod
@hyperledger/identus-sdk v8.0.0
@hyperledger/identus-sdk / overview / PrismDIDMethod
Class: PrismDIDMethod
Defined in: packages/lib/sdk/src/castor/methods/prism/index.ts:182
DID method implementation for did:prism.
Handles creation of long-form Prism DIDs, publishing them as signed Atala operations, and verifying signatures against resolved DID Documents.
Example
const prism = new PrismDIDMethod();
const did = await prism.create({
keys: { MASTER_KEY: masterSK, ISSUING_KEY: [issuingSK] },
services: [service],
});
Implements
Constructors
Constructor
new PrismDIDMethod(
prismResolverEndpoint:string):PrismDIDMethod
Defined in: packages/lib/sdk/src/castor/methods/prism/index.ts:190
Parameters
| Parameter | Type | Description |
|---|---|---|
prismResolverEndpoint | string | custom VDR endpoint for short-form resolution |
Returns
PrismDIDMethod
Properties
| Property | Type | Defined in |
|---|---|---|
method | "prism" | packages/lib/sdk/src/castor/methods/prism/index.ts:184 |
resolver | PrismDIDResolver | packages/lib/sdk/src/castor/methods/prism/index.ts:185 |
Methods
create()
create(
opts:CreatePayload):Promise<DID>
Defined in: packages/lib/sdk/src/castor/methods/prism/index.ts:387
Create a new long-form Prism DID from the provided keys and services.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | CreatePayload | creation options containing keys and optional services |
Returns
Promise<DID>
the newly created did:prism:... DID
Throws
if MASTER_KEY is missing
Implementation of
DIDMethod.create
deactivate()
deactivate(
opts:DeactivatePayload):Promise<Metadata>
Defined in: packages/lib/sdk/src/castor/methods/prism/index.ts:198
The previous operation hash is the hash of the last operation, create, update, deactivate We can use the neoprism API to get the last operation hash for a specific did and TX
Parameters
| Parameter | Type |
|---|---|
opts | DeactivatePayload |
Returns
Promise<Metadata>
Implementation of
DIDMethod.deactivate
publish()
publish(
opts:PublishPayload):Promise<Metadata>
Defined in: packages/lib/sdk/src/castor/methods/prism/index.ts:439
Publish a Prism DID by building and signing an Atala operation.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | PublishPayload | the master key and DID to publish |
Returns
Promise<Metadata>
serialised AtalaObject bytes
Throws
if the key cannot sign
Implementation of
DIDMethod.publish
update()
update(
opts:UpdatePayload):Promise<Metadata>
Defined in: packages/lib/sdk/src/castor/methods/prism/index.ts:220
Update a published Prism DID by building and signing an Atala operation.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | UpdatePayload | the master key, DID, ordered actions and (optionally) the previous operation hash |
Returns
Promise<Metadata>
serialised AtalaObject bytes
Throws
if the key cannot sign the operation
Implementation of
DIDMethod.update
verifySignature()
verifySignature(
did:DID,challenge:Uint8Array,signature:Uint8Array):Promise<boolean>
Defined in: packages/lib/sdk/src/castor/methods/prism/index.ts:597
Verify a signature against a Prism DID's verification methods.
Resolves the DID Document and tries each verification method until
one successfully validates the signature, or returns false.
Parameters
| Parameter | Type |
|---|---|
did | DID |
challenge | Uint8Array |
signature | Uint8Array |
Returns
Promise<boolean>
Implementation of
DIDMethod.verifySignature