Skip to main content

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

Constructors

Constructor

new CreatePeerDID(...args: [CreatePeerDIDArgs]): CreatePeerDID

Defined in: packages/lib/sdk/src/utils/tasks.ts:18

Parameters

ParameterTypeDescription
...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:

  1. Creates key agreement and authentication private keys
  2. Adds mediator service if available and not already present
  3. Creates the peer DID using Castor
  4. Optionally updates the mediator's key list
  5. Stores the DID and its private keys in Pluto

Parameters

ParameterTypeDescription
ctxAgentContextThe 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

ParameterTypeDescription
ctxAgentContextThe agent context containing connections and messaging capabilities
didDIDThe 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