Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

SqlEventLogServerEncrypted unstable

Stores encrypted event-log server state in SQL.

This module provides the durable Storage implementation used by EventLogServerEncrypted when entries should be stored without exposing plaintext event data to the database. It persists the server remote id, session authentication bindings, and encrypted entry tables, assigns stable sequence numbers, and streams changes. Clients remain responsible for encrypting writes and decrypting reads.

3 exports Since v4.0.0 Source

Constructors

makeStorage

unstable
Since v4.0.0

Creates encrypted event-log server Storage backed by SQL.

Details

It persists the server remote id, session authentication bindings, and encrypted entries in dialect-specific tables, creating per-identity/store entry tables as needed.

Signature

declare function makeStorage(options?: {
readonly entryTablePrefix?: string;
readonly insertBatchSize?: number;
readonly remoteIdTable?: string;
}): Effect<{
readonly changes: (publicKey: string, storeId: StoreId, startSequence: number) => Stream<EncryptedRemoteEntry>;
readonly getId: Effect<RemoteId>;
readonly getOrCreateSessionAuthBinding: (publicKey: string, signingPublicKey: Uint8Array<ArrayBuffer>) => Effect<Uint8Array<ArrayBuffer>>;
readonly write: (publicKey: string, storeId: StoreId, entries: readonly Array<PersistedEntry>) => Effect<readonly Array<EncryptedRemoteEntry>>;
}, SqlError, Scope | SqlClient | EventLogEncryption>

Layers

Since v4.0.0

Provides encrypted server Storage using the SQL-backed implementation.

Signature

declare function layerStorage(options?: {
readonly entryTablePrefix?: string;
readonly insertBatchSize?: number;
readonly remoteIdTable?: string;
}): Layer<Storage, SqlError, SqlClient | EventLogEncryption>
Since v4.0.0

Provides SQL-backed encrypted server Storage and supplies the default Web Crypto EventLogEncryption layer.

Signature

declare function layerStorageSubtle(options?: {
readonly entryTablePrefix?: string;
readonly insertBatchSize?: number;
readonly remoteIdTable?: string;
}): Layer<Storage, SqlError, SqlClient>