Skip to content

SharedMemoryCredentialStorage

Defined in: src/client/shared-memory-credential-storage.ts:78

Credentials in memory, replicated to the other tabs of this origin.

For an environment with no durable medium — a browser with IndexedDB and localStorage both unavailable, or an application that has decided nothing may reach disk — where every tab minting for itself is still worth avoiding.

Every write is broadcast and every instance applies what it receives, so a steady-state read is local and immediate: the medium is a Map, and the channel is what keeps the Maps agreeing. A CryptoKeyPair survives a structured clone as a handle that signs and cannot be exported, so what crosses is usable without key material having been sent.

Nothing survives the document, which is what durable says. What that costs is the last tab of an origin closing: the credentials go with it, and the next load signs in again.

implements CredentialStorage

new SharedMemoryCredentialStorage(options?): SharedMemoryCredentialStorage

Defined in: src/client/shared-memory-credential-storage.ts:117

The channel and lock prefix the tabs of this origin share.

string

SharedMemoryCredentialStorage

readonly durable: false = false

Defined in: src/client/shared-memory-credential-storage.ts:80

Whether what this writes survives the document being torn down.

CredentialStorage.durable


readonly shared: true = true

Defined in: src/client/shared-memory-credential-storage.ts:79

Whether another tab of this origin reads what this writes.

CredentialStorage.shared

close(): void

Defined in: src/client/shared-memory-credential-storage.ts:131

Stops replicating and lets go of the name a peer waits on.

Only needed when you replace a store while the page lives; the document going away does the same thing.

void


create(): Promise<ECDSAKeyIdentity>

Defined in: src/client/shared-memory-credential-storage.ts:137

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<ECDSAKeyIdentity>

CredentialStorage.create


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

Defined in: src/client/shared-memory-credential-storage.ts:141

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

string

Promise<Credential<ECDSAKeyIdentity> | null>

CredentialStorage.get


remove(slot): Promise<void>

Defined in: src/client/shared-memory-credential-storage.ts:155

string

Promise<void>

CredentialStorage.remove


set(slot, credential): Promise<void>

Defined in: src/client/shared-memory-credential-storage.ts:150

string

Credential<ECDSAKeyIdentity>

Promise<void>

CredentialStorage.set