snapcap
API ReferenceFunctions

idbGet

Function: idbGet()

function idbGet<T>(
   sandbox: Sandbox, 
   dbName: string, 
   storeName: string, 
key: string): Promise<T | undefined>;

Defined in: storage/idb-utils.ts:168

Read a value from the given Sandbox's IndexedDB at (dbName, storeName, key).

Type Parameters

Type ParameterDefault typeDescription
TunknownThe value type stored at this key.

Parameters

ParameterTypeDescription
sandboxSandboxThe Sandbox whose IDB shim handles the read.
dbNamestringIndexedDB database name.
storeNamestringObject store name within the database. Created on first use if absent.
keystringRecord key within the object store.

Returns

Promise<T | undefined>

The stored value, or undefined if absent.

Example

const identity = await idbGet<{ pub: Uint8Array }>(sandbox, "snapcap", "fidelius", "identity");

See

On this page