Skip to main content

createStore()

@hyperledger/identus-sdk v8.0.0


@hyperledger/identus-sdk / overview / createStore

Function: createStore()

createStore(dbName: string, options?: StartOptions): Promise<Store>

Defined in: packages/lib/sdk/src/pluto/store/index.ts:45

Create a default Pluto.Store backed by RIDB.

The returned store registers all built-in collection schemas and migrations, and can optionally be encrypted or use a custom storage backend.

Parameters

ParameterTypeDescription
dbNamestringLogical database name (e.g. "identus-pluto").
optionsStartOptionsControl how the database is initialised. - Pass WithOptions to configure encryption or a custom storageType. - Pass WithStart to take full control of the startup sequence.

Returns

Promise<Store>

A Pluto.Store instance ready to be passed to Pluto.create.

Examples

Create a store with default settings

import { createStore, Pluto } from "@hyperledger/identus-sdk";

const store = await createStore("my-db");
const pluto = await Pluto.create({ store, keyRestoration: apollo });

Create an encrypted store

const store = await createStore("my-db", { password: "super-secret" });