API reference › @evolu/common › local‑first/Auth › DeviceSecretKeyProvider

Defined in: packages/common/src/local-first/Auth.ts:175

A source of the key that wraps an app's DeviceSecret, such as a passkey's PRF output, which @evolu/web provides. Creating or getting a key may prompt the user, which some browsers allow only in a user gesture. Its Tasks must end when their Run aborts them, such as by passing its signal to the prompt, because a setup holds the app's lock while it creates or gets a key, so a Task that keeps waiting holds up every tab's unlock. See unlockWrappedDeviceSecret.

Properties

createKey

readonly createKey: Task<Uint8Array<ArrayBufferLike> & Brand<"MaxLength1023"> & Brand<"MinLength1"> & Brand<"DeviceSecretKeyId">, DeviceSecretKeyError>;

Defined in: packages/common/src/local-first/Auth.ts:177

Creates a key and returns its id, which Evolu stores.


getKey

readonly getKey: (id: Uint8Array<ArrayBufferLike> & Brand<"MaxLength1023"> & Brand<"MinLength1"> & Brand<"DeviceSecretKeyId">) => Task<Uint8Array<ArrayBufferLike> & Brand<"Entropy"> & Brand<"Length32">, DeviceSecretKeyError>;

Defined in: packages/common/src/local-first/Auth.ts:180

Gets the key with the id. The same id always gives the same key.