API reference › @evolu/web

Interfaces

InterfaceDescription
CreatePasskeyKeyProviderOptionsLabels the browser or passkey provider shows when it creates a passkey.
FailedPasskeyAuthStateThe last unlock failed. The user can try again, and when canStartOver is true, the app can offer to start over. startedOver tells whether the user started over before: an unlock that still fails then points to the passkey provider, such as one that refuses PRF, so the app can suggest another one.
LockedPasskeyAuthStateNothing is unlocked yet. hasDeviceSecret tells whether a wrapped DeviceSecret is stored, such as to label a button "Unlock" or "Create account".
NotPersistedPasskeyAuthStateThe browser keeps nothing, as in Safari's Private Browsing or a Firefox private window, so every start would create another passkey. The app starts without one, with InstantStart, in memory. It's final.
OpfsRootWithRemoveEntryAn OpfsRoot whose directory can also look up a directory without creating it and remove an entry, which navigator.storage provides in a dedicated worker.
OpfsRootWithRemoveEntryDepDependency wrapper for OpfsRootWithRemoveEntry.
PasskeyAuthUnlocks the app's DeviceSecret with a passkey; see createPasskeyAuth.
SharedWorkerUnsupported-
SharedWorkerUnsupportedDep-
SqliteWasmLoadDepDependency wrapper for SQLite as loadSqliteWasm loads it.
StartingOverPasskeyAuthStateA start over is in progress.
UnlockedPasskeyAuthStateThe DeviceSecret is unlocked, so pass it to createEvoluApp as { type: "DeviceSecret", secret }. It's final.
UnlockingPasskeyAuthStateAn unlock is in progress, with its passkey prompts.

Type Aliases

Type AliasDescription
PasskeyAuthErrorWhy an unlock of a PasskeyAuth failed.
PasskeyAuthStateThe state of a PasskeyAuth.
WasmSqliteDriverDepsDependencies of createWasmSqliteDriver.

Variables

VariableDescription
createBroadcastChannelCreates an Evolu BroadcastChannel from a Web BroadcastChannel.
createMessagePortCreates an Evolu MessagePort from a Web MessagePort.
loadSqliteWasmLoads SQLite from the sqliteWasmUrl of @evolu/sqlite-wasm for createWasmSqliteDriver. It passes the fetch to createSqliteWasm, which compiles the binary while it downloads when the server sends it as application/wasm, and from its bytes otherwise.

Functions

FunctionDescription
addUncaughtErrorListenerPasses each uncaught error and unhandled rejection of a worker global scope to listener as an Error from defectToError.
availableParallelismReturns the amount of logical processors available to the browser.
createDeleteDatabaseFilesCreates the DeleteDatabaseFiles of Evolu for the web. It opens the pool createWasmSqliteDriver opens for the database, waiting for held files as createWaitForDatabaseRelease does, deletes /evolu1.db with its journal, disposes the pool, and removes the pool's directory .<name> with every slot of the pool. A missing file counts as deleted, and so does a missing directory, which it then doesn't create.
createEvoluDepsCreates Evolu dependencies for the web platform.
createMessageChannelCreates a MessageChannel from a Web MessageChannel.
createOneTabSharedWorkerSelfPolyfillCreates a one-tab SharedWorkerSelf polyfill for browsers without native SharedWorker support.
createPasskeyAuthUnlocks the app's DeviceSecret with a passkey, for createEvoluApp's DeviceSecret auth on the web, and decides when the app can offer to start over. It reads, without a prompt, whether the browser keeps anything and whether a wrapped DeviceSecret is stored, so the app can label its first screen, such as "Unlock" or "Create account". Where the browser keeps nothing, as in Safari's Private Browsing or a Firefox private window, its state is NotPersisted, and the app starts without a passkey, with InstantStart, in memory.
createPasskeyKeyProviderCreates a DeviceSecretKeyProvider whose keys are passkeys of the current site and their WebAuthn PRF outputs. Pass it to unlockWrappedDeviceSecret.
createRunCreates a root Run for the browser.
createSharedWorkerCreates a SharedWorker from a Web SharedWorker.
createSharedWorkerSelfCreates an Evolu SharedWorkerSelf from a Web SharedWorkerGlobalScope (self inside a shared worker).
createWaitForDatabaseReleaseCreates the WaitForDatabaseRelease of Evolu for the web. It opens the pool createWasmSqliteDriver opens for the database, and disposes it once it opens.
createWasmSqliteDriverCreates the CreateSqliteDriver of Evolu for the web.
createWorkerCreates a Worker from a Web Worker.
createWorkerDepsCreates deps shared by web worker entry points.
createWorkerSelfCreates an Evolu WorkerSelf from a Web DedicatedWorkerGlobalScope (self inside a dedicated worker).
installOneTabSharedWorkerPolyfillInstalls a one-tab SharedWorker polyfill backed by a Web Worker.
isApplePlatformReturns true when the browser runs on an Apple platform.