Skip to main content

Pluto

@hyperledger/identus-sdk v8.0.0


@hyperledger/identus-sdk / overview / Pluto

Class: Pluto

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:48

Orchestration layer for SDK persistence.

Pluto translates between Domain classes (e.g. Domain.DID, Domain.Credential) and the underlying Pluto.Store, managing relationships and business logic.

Preferred instantiation is via the static Pluto.create factory.

Example

const pluto = await Pluto.create({
dbName: "my-wallet",
keyRestoration: apollo,
});

Extends

Implements

Constructors

Constructor

new Pluto(store: Store, keyRestoration: KeyRestoration): Pluto

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:285

Parameters

ParameterTypeDescription
storeStore-
keyRestorationKeyRestoration-

Returns

Pluto

Deprecated

Use Pluto.create() instead

Overrides

Controller.constructor

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
BackupMgrpublicBackupManagerManager for wallet backup and restore operations.-packages/lib/sdk/src/pluto/Pluto.ts:231
statepublicStatecurrent status of the entityPluto.state Controller.statepackages/shared/domain/build/index.d.ts:2330
storereadonlyStore--packages/lib/sdk/src/pluto/Pluto.ts:286

Methods

backup()

backup(version?: "0.0.1"): Promise<{ credentials: { data: string; recovery_id: string; }[]; did_pairs: { alias: string; holder: string; recipient: string; }[]; dids: { alias?: string; did: string; }[]; keys: { did?: string; index?: number; key: string; recovery_id: string; }[]; link_secret?: string; mediators: { holder_did: string; mediator_did: string; routing_did: string; }[]; messages: string[]; version?: "0.0.1"; }>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:316

Create a full backup of the wallet.

Parameters

ParameterTypeDescription
version?"0.0.1"Optional backup format version.

Returns

Promise<{ credentials: { data: string; recovery_id: string; }[]; did_pairs: { alias: string; holder: string; recipient: string; }[]; dids: { alias?: string; did: string; }[]; keys: { did?: string; index?: number; key: string; recovery_id: string; }[]; link_secret?: string; mediators: { holder_did: string; mediator_did: string; routing_did: string; }[]; messages: string[]; version?: "0.0.1"; }>

Serialised backup payload.

Implementation of

Pluto.backup


deleteMessage()

deleteMessage(id: string): Promise<void>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:334

Delete a message by its identifier.

Parameters

ParameterTypeDescription
idstringThe message id (not the uuid).

Returns

Promise<void>

Implementation of

Pluto.deleteMessage


getAllCredentials()

getAllCredentials(): Promise<Credential[]>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:356

Retrieve all stored credentials.

Returns

Promise<Credential[]>

Array of Domain.Credential instances.

Implementation of

Pluto.getAllCredentials


getAllDidPairs()

getAllDidPairs(): Promise<DIDPair[]>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:655

Retrieve all stored DID pairs.

Returns

Promise<DIDPair[]>

Array of Domain.DIDPair instances.

Implementation of

Pluto.getAllDidPairs


getAllMediators()

getAllMediators(): Promise<Mediator[]>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:726

Retrieve all stored mediator configurations.

Each mediator consists of a host DID, a mediator DID, and a routing DID.

Returns

Promise<Mediator[]>

Array of Domain.Mediator objects.

Implementation of

Pluto.getAllMediators


getAllMessages()

getAllMessages(): Promise<Message[]>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:625

Retrieve all stored messages.

Returns

Promise<Message[]>

Array of Domain.Message instances.

Implementation of

Pluto.getAllMessages


getAllPeerDIDs()

getAllPeerDIDs(): Promise<PeerDID[]>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:550

Retrieve all stored Peer DIDs with their key material.

Returns

Promise<PeerDID[]>

Array of PeerDID instances.

Implementation of

Pluto.getAllPeerDIDs


getAllPrismDIDs()

getAllPrismDIDs(): Promise<PrismDID[]>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:485

Retrieve all stored Prism DIDs with their keys.

Returns

Promise<PrismDID[]>

Array of Domain.PrismDID instances.

Implementation of

Pluto.getAllPrismDIDs


getCredentialMetadata()

getCredentialMetadata(name: string): Promise<CredentialMetadata | null>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:391

Retrieve credential metadata by name.

Parameters

ParameterTypeDescription
namestringThe metadata name/key.

Returns

Promise<CredentialMetadata | null>

The matching metadata or null.

Implementation of

Pluto.getCredentialMetadata


getDIDByDIDOrAlias()

getDIDByDIDOrAlias(didOrAlias: string): Promise<DID | null>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:513

Parameters

ParameterType
didOrAliasstring

Returns

Promise<DID | null>

Implementation of

Pluto.getDIDByDIDOrAlias


getDIDPrivateKeysByDID()

getDIDPrivateKeysByDID(did: DID): Promise<PrivateKey[]>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:432

Get all private keys linked to a DID.

Parameters

ParameterTypeDescription
didDIDThe DID whose keys should be retrieved.

Returns

Promise<PrivateKey[]>

Array of Domain.PrivateKey instances.

Implementation of

Pluto.getDIDPrivateKeysByDID


getLinkSecret()

getLinkSecret(name?: string): Promise<LinkSecret | null>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:411

Retrieve a link secret by name.

Parameters

ParameterTypeDefault valueDescription
namestringDomain.LinkSecret.defaultNameDefaults to Domain.LinkSecret.defaultName.

Returns

Promise<LinkSecret | null>

The matching link secret or null.

Implementation of

Pluto.getLinkSecret


getMessage()

getMessage(id: string): Promise<Message | null>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:617

Retrieve a single message by its protocol-level id.

Parameters

ParameterTypeDescription
idstringThe message id.

Returns

Promise<Message | null>

The matching Domain.Message or null.

Implementation of

Pluto.getMessage


getPairByDID()

getPairByDID(did: DID): Promise<DIDPair | null>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:669

Find the DID pair that includes the given DID.

Parameters

ParameterTypeDescription
didDIDEither side of the pair.

Returns

Promise<DIDPair | null>

The matching Domain.DIDPair or null.

Implementation of

Pluto.getPairByDID


getPairByName()

getPairByName(alias: string): Promise<DIDPair | null>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:692

Find a DID pair by its alias.

Parameters

ParameterTypeDescription
aliasstringThe pair alias.

Returns

Promise<DIDPair | null>

The matching Domain.DIDPair or null.

Implementation of

Pluto.getPairByName


restore()

restore(backup: { credentials: { data: string; recovery_id: string; }[]; did_pairs: { alias: string; holder: string; recipient: string; }[]; dids: { alias?: string; did: string; }[]; keys: { did?: string; index?: number; key: string; recovery_id: string; }[]; link_secret?: string; mediators: { holder_did: string; mediator_did: string; routing_did: string; }[]; messages: string[]; version?: "0.0.1"; }): Promise<void>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:325

Restore wallet data from a backup.

Parameters

ParameterTypeDescription
backup{ credentials: { data: string; recovery_id: string; }[]; did_pairs: { alias: string; holder: string; recipient: string; }[]; dids: { alias?: string; did: string; }[]; keys: { did?: string; index?: number; key: string; recovery_id: string; }[]; link_secret?: string; mediators: { holder_did: string; mediator_did: string; routing_did: string; }[]; messages: string[]; version?: "0.0.1"; }A backup payload previously created by backup.
backup.credentials{ data: string; recovery_id: string; }[]-
backup.did_pairs{ alias: string; holder: string; recipient: string; }[]-
backup.dids{ alias?: string; did: string; }[]-
backup.keys{ did?: string; index?: number; key: string; recovery_id: string; }[]-
backup.link_secret?string-
backup.mediators{ holder_did: string; mediator_did: string; routing_did: string; }[]-
backup.messagesstring[]-
backup.version?"0.0.1"-

Returns

Promise<void>

Implementation of

Pluto.restore


revokeCredential()

revokeCredential(credential: Credential): Promise<void>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:366

Mark a credential as revoked.

Parameters

ParameterTypeDescription
credentialCredentialThe credential to revoke. Must be storable.

Returns

Promise<void>

Throws

Error if the credential is null or not storable.

Implementation of

Pluto.revokeCredential


start()

start(): Promise<State>

Defined in: packages/shared/domain/build/index.d.ts:2347

handle the startup of an entity

updates state according to lifecycle

Returns

Promise<State>

Implementation of

Pluto.start

Inherited from

Controller.start


stop()

stop(): Promise<State>

Defined in: packages/shared/domain/build/index.d.ts:2348

handle the teardown of an entity

updates state according to lifecycle

Returns

Promise<State>

Implementation of

Pluto.stop

Inherited from

Controller.stop


storeCredential()

storeCredential(credential: Credential): Promise<void>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:348

Persist a credential.

Parameters

ParameterTypeDescription
credentialCredentialThe Domain.Credential to store.

Returns

Promise<void>

Implementation of

Pluto.storeCredential


storeCredentialMetadata()

storeCredentialMetadata(metadata: CredentialMetadata): Promise<void>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:382

Persist credential metadata (e.g. schema information).

Parameters

ParameterTypeDescription
metadataCredentialMetadataThe Domain.CredentialMetadata to store.

Returns

Promise<void>

Implementation of

Pluto.storeCredentialMetadata


storeDID()

storeDID(did: DID, keys?: Arrayable<PrivateKey>, alias?: string): Promise<void>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:449

Store a DID with optional associated keys and alias.

Parameters

ParameterTypeDescription
didDIDThe Domain.DID to persist.
keys?Arrayable<PrivateKey>Optional private key(s) to link to the DID.
alias?stringOptional human-readable name.

Returns

Promise<void>

Implementation of

Pluto.storeDID


storeDIDPair()

storeDIDPair(host: DID, receiver: DID, alias: string): Promise<void>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:639

Store a DID pair relationship.

Parameters

ParameterTypeDescription
hostDIDThe local/host DID.
receiverDIDThe remote/target DID.
aliasstringHuman-readable name for this pair.

Returns

Promise<void>

Implementation of

Pluto.storeDIDPair


storeLinkSecret()

storeLinkSecret(linkSecret: LinkSecret): Promise<void>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:402

Persist an AnonCreds link secret.

Parameters

ParameterTypeDescription
linkSecretLinkSecretThe Domain.LinkSecret to store.

Returns

Promise<void>

Implementation of

Pluto.storeLinkSecret


storeMediator()

storeMediator(mediator: Mediator): Promise<void>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:770

Persist a mediator configuration.

Stores the three DIDs involved (host, mediator, routing) and creates the internal DID-link relationships.

Parameters

ParameterTypeDescription
mediatorMediatorThe Domain.Mediator to store.

Returns

Promise<void>

Implementation of

Pluto.storeMediator


storeMessage()

storeMessage(message: Message): Promise<void>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:598

Persist a single DIDComm message.

Parameters

ParameterTypeDescription
messageMessageThe Domain.Message to store.

Returns

Promise<void>

Implementation of

Pluto.storeMessage


storeMessages()

storeMessages(messages: Message[]): Promise<void>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:606

Persist multiple DIDComm messages.

Parameters

ParameterTypeDescription
messagesMessage[]The messages to store.

Returns

Promise<void>

Implementation of

Pluto.storeMessages


storePeerDID()

storePeerDID(did: DID, privateKeys: PrivateKey[]): Promise<void>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:538

Store a Peer DID and its associated private keys.

Parameters

ParameterTypeDescription
didDIDThe Peer Domain.DID.
privateKeysPrivateKey[]The keys that constitute the Peer DID.

Returns

Promise<void>

Implementation of

Pluto.storePeerDID


storePrismDID()

storePrismDID(did: DID, privateKey: PrivateKey, alias?: string): Promise<void>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:470

Store a Prism DID and its associated private key.

Parameters

ParameterTypeDescription
didDIDThe Prism Domain.DID.
privateKeyPrivateKeyThe key used to control the DID.
alias?stringOptional human-readable name.

Returns

Promise<void>

Implementation of

Pluto.storePrismDID


storePrivateKey()

storePrivateKey(privateKey: PrivateKey): Promise<void>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:422

Persist a private key.

Parameters

ParameterTypeDescription
privateKeyPrivateKeyThe Domain.PrivateKey to store.

Returns

Promise<void>

Implementation of

Pluto.storePrivateKey


create()

static create(options: CreateOptions): Promise<Pluto>

Defined in: packages/lib/sdk/src/pluto/Pluto.ts:267

Create and start a new Pluto instance.

When a dbName is provided (instead of a pre-built store), the default RIDB-backed store is created automatically.

Parameters

ParameterTypeDescription
optionsCreateOptionsSee CreateOptions.

Returns

Promise<Pluto>

A started Pluto instance ready for use.

Examples

Using the default store

const pluto = await Pluto.create({
dbName: "identus-wallet",
keyRestoration: apollo,
});

Using a custom store

const pluto = await Pluto.create({
store: myCustomStore,
keyRestoration: apollo,
});