Skip to content

LocalCredentialStorage

Defined in: src/client/local-credential-storage.ts:19

Credentials in localStorage, for where IndexedDB is unavailable.

localStorage holds strings, so the key has to be one: this generates an Ed25519 identity, whose private bytes serialise, rather than the non-extractable key IdbCredentialStorage uses. That is the trade the medium imposes, and it is why generation belongs to the store.

implements CredentialStorage

new LocalCredentialStorage(prefix?): LocalCredentialStorage

Defined in: src/client/local-credential-storage.ts:27

string = 'ic-'

Prepended to every slot, so two clients under one origin can be kept apart.

LocalCredentialStorage

readonly durable: true = true

Defined in: src/client/local-credential-storage.ts:21

Whether what this writes survives the document being torn down.

CredentialStorage.durable


readonly prefix: string = 'ic-'

Defined in: src/client/local-credential-storage.ts:27

Prepended to every slot, so two clients under one origin can be kept apart.


readonly shared: true = true

Defined in: src/client/local-credential-storage.ts:20

Whether another tab of this origin reads what this writes.

CredentialStorage.shared

create(): Promise<Ed25519KeyIdentity>

Defined in: src/client/local-credential-storage.ts:29

A fresh identity of this store’s own type, not persisted.

Generation belongs to the store because the medium decides the key type: one that has to serialise needs a key whose private bytes are readable, and one that does not should not have them. Kept together so an application cannot pair a non-extractable key with a store that cannot hold one and find out at runtime.

Promise<Ed25519KeyIdentity>

CredentialStorage.create


get(slot): Promise<Credential<Ed25519KeyIdentity> | null>

Defined in: src/client/local-credential-storage.ts:33

The credential stored under slot, or null where there is none.

string

Promise<Credential<Ed25519KeyIdentity> | null>

CredentialStorage.get


remove(slot): Promise<void>

Defined in: src/client/local-credential-storage.ts:56

string

Promise<void>

CredentialStorage.remove


set(slot, credential): Promise<void>

Defined in: src/client/local-credential-storage.ts:47

string

Credential<Ed25519KeyIdentity>

Promise<void>

CredentialStorage.set