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
| Parameter | Type | Description |
|---|---|---|
store | Store | - |
keyRestoration | KeyRestoration | - |
Returns
Pluto
Deprecated
Use Pluto.create() instead
Overrides
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
BackupMgr | public | BackupManager | Manager for wallet backup and restore operations. | - | packages/lib/sdk/src/pluto/Pluto.ts:231 |
state | public | State | current status of the entity | Pluto.state Controller.state | packages/shared/domain/build/index.d.ts:2330 |
store | readonly | Store | - | - | 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
| Parameter | Type | Description |
|---|---|---|
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
deleteMessage()
deleteMessage(
id:string):Promise<void>
Defined in: packages/lib/sdk/src/pluto/Pluto.ts:334
Delete a message by its identifier.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The message id (not the uuid). |
Returns
Promise<void>
Implementation of
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
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
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
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
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
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
getCredentialMetadata()
getCredentialMetadata(
name:string):Promise<CredentialMetadata|null>
Defined in: packages/lib/sdk/src/pluto/Pluto.ts:391
Retrieve credential metadata by name.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The metadata name/key. |
Returns
Promise<CredentialMetadata | null>
The matching metadata or null.
Implementation of
getDIDByDIDOrAlias()
getDIDByDIDOrAlias(
didOrAlias:string):Promise<DID|null>
Defined in: packages/lib/sdk/src/pluto/Pluto.ts:513
Parameters
| Parameter | Type |
|---|---|
didOrAlias | string |
Returns
Promise<DID | null>
Implementation of
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
| Parameter | Type | Description |
|---|---|---|
did | DID | The DID whose keys should be retrieved. |
Returns
Promise<PrivateKey[]>
Array of Domain.PrivateKey instances.
Implementation of
getLinkSecret()
getLinkSecret(
name?:string):Promise<LinkSecret|null>
Defined in: packages/lib/sdk/src/pluto/Pluto.ts:411
Retrieve a link secret by name.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
name | string | Domain.LinkSecret.defaultName | Defaults to Domain.LinkSecret.defaultName. |
Returns
Promise<LinkSecret | null>
The matching link secret or null.
Implementation of
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
| Parameter | Type | Description |
|---|---|---|
id | string | The message id. |
Returns
Promise<Message | null>
The matching Domain.Message or null.
Implementation of
getPairByDID()
Defined in: packages/lib/sdk/src/pluto/Pluto.ts:669
Find the DID pair that includes the given DID.
Parameters
| Parameter | Type | Description |
|---|---|---|
did | DID | Either side of the pair. |
Returns
Promise<DIDPair | null>
The matching Domain.DIDPair or null.
Implementation of
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
| Parameter | Type | Description |
|---|---|---|
alias | string | The pair alias. |
Returns
Promise<DIDPair | null>
The matching Domain.DIDPair or null.
Implementation of
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
| Parameter | Type | Description |
|---|---|---|
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.messages | string[] | - |
backup.version? | "0.0.1" | - |
Returns
Promise<void>
Implementation of
revokeCredential()
revokeCredential(
credential:Credential):Promise<void>
Defined in: packages/lib/sdk/src/pluto/Pluto.ts:366
Mark a credential as revoked.
Parameters
| Parameter | Type | Description |
|---|---|---|
credential | Credential | The credential to revoke. Must be storable. |
Returns
Promise<void>
Throws
Error if the credential is null or not storable.
Implementation of
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
Inherited from
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
Inherited from
storeCredential()
storeCredential(
credential:Credential):Promise<void>
Defined in: packages/lib/sdk/src/pluto/Pluto.ts:348
Persist a credential.
Parameters
| Parameter | Type | Description |
|---|---|---|
credential | Credential | The Domain.Credential to store. |
Returns
Promise<void>
Implementation of
storeCredentialMetadata()
storeCredentialMetadata(
metadata:CredentialMetadata):Promise<void>
Defined in: packages/lib/sdk/src/pluto/Pluto.ts:382
Persist credential metadata (e.g. schema information).
Parameters
| Parameter | Type | Description |
|---|---|---|
metadata | CredentialMetadata | The Domain.CredentialMetadata to store. |
Returns
Promise<void>
Implementation of
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
| Parameter | Type | Description |
|---|---|---|
did | DID | The Domain.DID to persist. |
keys? | Arrayable<PrivateKey> | Optional private key(s) to link to the DID. |
alias? | string | Optional human-readable name. |
Returns
Promise<void>
Implementation of
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
| Parameter | Type | Description |
|---|---|---|
host | DID | The local/host DID. |
receiver | DID | The remote/target DID. |
alias | string | Human-readable name for this pair. |
Returns
Promise<void>
Implementation of
storeLinkSecret()
storeLinkSecret(
linkSecret:LinkSecret):Promise<void>
Defined in: packages/lib/sdk/src/pluto/Pluto.ts:402
Persist an AnonCreds link secret.
Parameters
| Parameter | Type | Description |
|---|---|---|
linkSecret | LinkSecret | The Domain.LinkSecret to store. |
Returns
Promise<void>
Implementation of
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
| Parameter | Type | Description |
|---|---|---|
mediator | Mediator | The Domain.Mediator to store. |
Returns
Promise<void>
Implementation of
storeMessage()
storeMessage(
message:Message):Promise<void>
Defined in: packages/lib/sdk/src/pluto/Pluto.ts:598
Persist a single DIDComm message.
Parameters
| Parameter | Type | Description |
|---|---|---|
message | Message | The Domain.Message to store. |
Returns
Promise<void>
Implementation of
storeMessages()
storeMessages(
messages:Message[]):Promise<void>
Defined in: packages/lib/sdk/src/pluto/Pluto.ts:606
Persist multiple DIDComm messages.
Parameters
| Parameter | Type | Description |
|---|---|---|
messages | Message[] | The messages to store. |
Returns
Promise<void>
Implementation of
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
| Parameter | Type | Description |
|---|---|---|
did | DID | The Peer Domain.DID. |
privateKeys | PrivateKey[] | The keys that constitute the Peer DID. |
Returns
Promise<void>
Implementation of
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
| Parameter | Type | Description |
|---|---|---|
did | DID | The Prism Domain.DID. |
privateKey | PrivateKey | The key used to control the DID. |
alias? | string | Optional human-readable name. |
Returns
Promise<void>
Implementation of
storePrivateKey()
storePrivateKey(
privateKey:PrivateKey):Promise<void>
Defined in: packages/lib/sdk/src/pluto/Pluto.ts:422
Persist a private key.
Parameters
| Parameter | Type | Description |
|---|---|---|
privateKey | PrivateKey | The Domain.PrivateKey to store. |
Returns
Promise<void>
Implementation of
create()
staticcreate(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
| Parameter | Type | Description |
|---|---|---|
options | CreateOptions | See 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,
});