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
Implements
Section titled “Implements”CredentialStorage<ECDSAKeyIdentity>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SharedMemoryCredentialStorage(
options?):SharedMemoryCredentialStorage
Defined in: src/client/shared-memory-credential-storage.ts:117
Parameters
Section titled “Parameters”options?
Section titled “options?”The channel and lock prefix the tabs of this origin share.
string
Returns
Section titled “Returns”SharedMemoryCredentialStorage
Properties
Section titled “Properties”durable
Section titled “durable”
readonlydurable:false=false
Defined in: src/client/shared-memory-credential-storage.ts:80
Whether what this writes survives the document being torn down.
Implementation of
Section titled “Implementation of”shared
Section titled “shared”
readonlyshared:true=true
Defined in: src/client/shared-memory-credential-storage.ts:79
Whether another tab of this origin reads what this writes.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”close()
Section titled “close()”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.
Returns
Section titled “Returns”void
create()
Section titled “create()”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.
Returns
Section titled “Returns”Promise<ECDSAKeyIdentity>
Implementation of
Section titled “Implementation of”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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Credential<ECDSAKeyIdentity> | null>
Implementation of
Section titled “Implementation of”remove()
Section titled “remove()”remove(
slot):Promise<void>
Defined in: src/client/shared-memory-credential-storage.ts:155
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”set(
slot,credential):Promise<void>
Defined in: src/client/shared-memory-credential-storage.ts:150
Parameters
Section titled “Parameters”string
credential
Section titled “credential”Credential<ECDSAKeyIdentity>
Returns
Section titled “Returns”Promise<void>