CreatePeerDID
@hyperledger/identus-sdk v8.0.0
@hyperledger/identus-sdk / overview / CreatePeerDID
Class: CreatePeerDID
Defined in: packages/lib/sdk/src/edge-agent/didFunctions/CreatePeerDID.ts:24
Task class for creating and storing new peer DIDs.
This class generates a new peer DID with authentication and key agreement keys, optionally includes mediator services, and stores the DID with its private keys in the agent's storage. It can also update the mediator's key list if specified.
Extends
Task<DID,CreatePeerDIDArgs>
Constructors
Constructor
new CreatePeerDID(...
args: [CreatePeerDIDArgs]):CreatePeerDID
Defined in: packages/lib/sdk/src/utils/tasks.ts:18
Parameters
| Parameter | Type | Description |
|---|---|---|
...args | [CreatePeerDIDArgs] | - |
Returns
CreatePeerDID
Inherited from
Task<Domain.DID, Args>.constructor
Methods
log()
log():
unknown
Defined in: packages/lib/sdk/src/utils/tasks.ts:27
Returns
unknown
Inherited from
Task.log
run()
run(
ctx:AgentContext):Promise<DID>
Defined in: packages/lib/sdk/src/edge-agent/didFunctions/CreatePeerDID.ts:38
Executes the task to create and store a new peer DID.
This method:
- Creates key agreement and authentication private keys
- Adds mediator service if available and not already present
- Creates the peer DID using Castor
- Optionally updates the mediator's key list
- Stores the DID and its private keys in Pluto
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | AgentContext | The agent context containing Apollo, Castor, Pluto, and Connections |
Returns
Promise<DID>
A Promise that resolves to the created DID
Overrides
Task.run
updateKeyListWithDID()
updateKeyListWithDID(
ctx:AgentContext,did:DID):Promise<void>
Defined in: packages/lib/sdk/src/edge-agent/didFunctions/CreatePeerDID.ts:106
Asynchronously updates the mediator with the new key list.
This method is used during the mediation process or during DID rotation to inform the mediator about new keys that should be included in the mediation key list for message routing.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | AgentContext | The agent context containing connections and messaging capabilities |
did | DID | The DID to add to the mediator's key list |
Returns
Promise<void>
A Promise that resolves when the key list update is sent
Throws
When no mediator is available