EventLogServerEncrypted
Serves encrypted event-log replication.
Encrypted EventLogRemote clients use this module when they need a remote synchronization endpoint that never sees plaintext events. The server stores encrypted entries and replication metadata keyed by client public key and store id, then streams encrypted changes back to clients for local decryption. This module defines the RPC handlers, server layer, storage contract, and in-memory storage layer for that encrypted server path.
Constructors
makeStorageMemory
Signature
declare const makeStorageMemory: Effect.Effect<Storage["Service"], never, Scope.Scope>;Layers
Provides an encrypted event-log RPC server using EventLogRemoteRpcs and the encrypted server RPC handlers.
When to use
Use when you need an encrypted event-log RPC server for encrypted EventLogRemote replication over an existing RpcServer.Protocol.
Details
This layer installs EventLogRemoteRpcs on the provided RPC server protocol and wires those RPCs to layerRpcHandlers. Encrypted entries, session authentication bindings, remote ids, and change streams are delegated to Storage.
See
layerRpcHandlersfor the encrypted handler layer without installing an RPC server protocolStoragefor the storage service required by this layerlayerStorageMemoryfor the process-local in-memory storage layer
Signature
declare const layer: Layer.Layer<never, never, RpcServer.Protocol | Storage>;layerRpcHandlers
Provides RPC handlers for the encrypted event-log server.
Details
Incoming encrypted write payloads are decoded and persisted through Storage; change streams read encrypted entries from storage and encode them for the remote protocol.
Signature
declare const layerRpcHandlers: Layer<
| EventLogAuthentication
| Handler<"EventLog.Hello">
| Handler<"EventLog.Authenticate">
| Handler<"EventLog.WriteChunked">
| Handler<"EventLog.WriteSingle">
| Handler<"EventLog.Changes">,
never,
Storage
>;layerStorageMemory
Provides encrypted server Storage using the in-memory implementation.
Signature
declare const layerStorageMemory: Layer.Layer<Storage>;Models
PersistedEntry
Schema for encrypted entries persisted by the encrypted event-log server.
Signature
declare class PersistedEntry extends {
readonly encryptedEntry: Uint8Array<ArrayBuffer>;
readonly entryId: Uint8Array<ArrayBuffer> & Brand<"effect/eventlog/EventJournal/EntryId">;
readonly iv: Uint8Array<ArrayBuffer>;
} {
constructor(...args: [props: {
readonly encryptedEntry: Uint8Array<ArrayBuffer>;
readonly entryId: Uint8Array<ArrayBuffer> & Brand<"effect/eventlog/EventJournal/EntryId">;
readonly iv: Uint8Array<ArrayBuffer>;
}, options?: MakeOptions]);
entryIdString: string;
}Services
Defines the backing store service used by the encrypted event-log server.
When to use
Use to provide durable encrypted event-log persistence for an encrypted event-log server layer.
Details
It provides the server remote id, stores session authentication bindings, persists encrypted entries, and streams encrypted changes for a public key and store id.
Signature
declare class Storage extends Shape<"effect/eventlog/EventLogServer/Storage", {
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>>;
}, this> {
constructor(_: never);
}
Creates an in-memory encrypted server
Storage.Details
Data, session authentication bindings, and streams are process-local and are released with the surrounding scope.