EventLogServerEncrypted.ts
EventLogServerEncrypted.ts overview
Section titled “EventLogServerEncrypted.ts overview”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.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”layers
Section titled “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>Since v4.0.0
layerRpcHandlers
Section titled “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.Layer< | EventLogAuthentication | Handler<"EventLog.Hello"> | Handler<"EventLog.Authenticate"> | Handler<"EventLog.WriteChunked"> | Handler<"EventLog.WriteSingle"> | Handler<"EventLog.Changes">, never, Storage>Since v4.0.0
storage
Section titled “storage”PersistedEntry (class)
Section titled “PersistedEntry (class)”Schema for encrypted entries persisted by the encrypted event-log server.
Signature
declare class PersistedEntrySince v4.0.0
Storage (class)
Section titled “Storage (class)”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 StorageSince v4.0.0
layerStorageMemory
Section titled “layerStorageMemory”Provides encrypted server Storage using the in-memory implementation.
Signature
declare const layerStorageMemory: Layer.Layer<Storage, never, never>Since v4.0.0
makeStorageMemory
Section titled “makeStorageMemory”Creates an in-memory encrypted server Storage.
Details
Data, session authentication bindings, and streams are process-local and are released with the surrounding scope.
Signature
declare const makeStorageMemory: Effect.Effect< { readonly getId: Effect.Effect<RemoteId> readonly getOrCreateSessionAuthBinding: ( publicKey: string, signingPublicKey: Uint8Array<ArrayBuffer> ) => Effect.Effect<Uint8Array<ArrayBuffer>> readonly write: ( publicKey: string, storeId: StoreId, entries: ReadonlyArray<PersistedEntry> ) => Effect.Effect<ReadonlyArray<EncryptedRemoteEntry>> readonly changes: ( publicKey: string, storeId: StoreId, startSequence: number ) => Stream.Stream<EncryptedRemoteEntry> }, never, Scope.Scope>Since v4.0.0