Skip to main content

DIDCommSecretsResolver

@hyperledger/identus-sdk v8.0.0


@hyperledger/identus-sdk / overview / DIDCommSecretsResolver

Class: DIDCommSecretsResolver

Defined in: packages/lib/sdk/src/mercury/DIDCommSecretsResolver.ts:12

Bridges the SDK's key storage (Pluto) to the DIDComm library's SecretsResolver interface.

Looks up Peer DID private keys stored in Pluto and converts them into JWK-based Secret objects consumable by the DIDComm WASM layer.

Implements

  • SecretsResolver

Constructors

Constructor

new DIDCommSecretsResolver(apollo: Apollo, castor: Castor, pluto: Pluto): DIDCommSecretsResolver

Defined in: packages/lib/sdk/src/mercury/DIDCommSecretsResolver.ts:13

Parameters

ParameterType
apolloApollo
castorCastor
plutoPluto

Returns

DIDCommSecretsResolver

Methods

find_secrets()

find_secrets(secret_ids: string[]): Promise<string[]>

Defined in: packages/lib/sdk/src/mercury/DIDCommSecretsResolver.ts:46

Find all secrets that have one of the given IDs. Return secrets only for key IDs for which a secret is present.

Parameters

ParameterType
secret_idsstring[]

Returns

Promise<string[]>

possible empty list of all secrets that have one of the given IDs.

Throws

DIDCommIoError - IO error in resolving process

Throws

DIDCommInvalidState - Code error or unexpected state was detected

Note to throw compatible error use code like this

let e = Error("Unble perform io operation");
e.name = "DIDCommIoError"
throw e

Implementation of

DIDComm.SecretsResolver.find_secrets


get_secret()

get_secret(secret_id: string): Promise<Secret | null>

Defined in: packages/lib/sdk/src/mercury/DIDCommSecretsResolver.ts:57

Finds secret (usually private key) identified by the given key ID.

Parameters

ParameterType
secret_idstring

Returns

Promise<Secret | null>

A secret (usually private key) or None of there is no secret for the given ID

Throws

DIDCommIoError - IO error in resolving process

Throws

DIDCommInvalidState - Code error or unexpected state was detected

let e = Error("Unble perform io operation");
e.name = "DIDCommIoError"
throw e

Implementation of

DIDComm.SecretsResolver.get_secret