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
Implements
Section titled “Implements”CredentialStorage<Ed25519KeyIdentity>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new LocalCredentialStorage(
prefix?):LocalCredentialStorage
Defined in: src/client/local-credential-storage.ts:27
Parameters
Section titled “Parameters”prefix?
Section titled “prefix?”string = 'ic-'
Prepended to every slot, so two clients under one origin can be kept apart.
Returns
Section titled “Returns”LocalCredentialStorage
Properties
Section titled “Properties”durable
Section titled “durable”
readonlydurable:true=true
Defined in: src/client/local-credential-storage.ts:21
Whether what this writes survives the document being torn down.
Implementation of
Section titled “Implementation of”prefix
Section titled “prefix”
readonlyprefix: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.
shared
Section titled “shared”
readonlyshared:true=true
Defined in: src/client/local-credential-storage.ts:20
Whether another tab of this origin reads what this writes.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”create()
Section titled “create()”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.
Returns
Section titled “Returns”Promise<Ed25519KeyIdentity>
Implementation of
Section titled “Implementation of”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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Credential<Ed25519KeyIdentity> | null>
Implementation of
Section titled “Implementation of”remove()
Section titled “remove()”remove(
slot):Promise<void>
Defined in: src/client/local-credential-storage.ts:56
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/local-credential-storage.ts:47
Parameters
Section titled “Parameters”string
credential
Section titled “credential”Credential<Ed25519KeyIdentity>
Returns
Section titled “Returns”Promise<void>