Skip to content

EventLogEncryption.ts

Cryptographic service for encrypted event-log replication.

EventLogEncryption turns local journal entries into encrypted remote payloads and decrypts encrypted changes received from a server. It also hashes byte data and creates event-log identities, so remote replication can use storage or transport that should not see plaintext event data.

Since v4.0.0



Provides EventLogEncryption using globalThis.crypto.

Signature

declare const layerSubtle: Layer.Layer<EventLogEncryption, never, never>

Source

Since v4.0.0

Creates an EventLogEncryption service backed by the Web Crypto SubtleCrypto APIs from the supplied Crypto implementation.

Signature

declare const makeEncryptionSubtle: (crypto: Crypto) => Effect.Effect<EventLogEncryption["Service"]>

Source

Since v4.0.0

Schema for an encrypted journal entry paired with the id of the original entry.

Signature

declare const EncryptedEntry: Schema.Struct<{
readonly entryId: Schema.brand<
Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>,
"effect/eventlog/EventJournal/EntryId"
>
readonly encryptedEntry: Transferable.Transferable<
Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>
>
}>

Source

Since v4.0.0

Schema for encrypted entries exchanged with a remote event-log server.

Signature

declare const EncryptedRemoteEntry: Schema.Struct<{
readonly sequence: Schema.Number
readonly iv: Transferable.Transferable<Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>
readonly entryId: Schema.brand<
Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>,
"effect/eventlog/EventJournal/EntryId"
>
readonly encryptedEntry: Transferable.Transferable<
Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>
>
}>

Source

Since v4.0.0

Type of an encrypted remote entry, including its remote sequence number, initialization vector, entry id, and encrypted entry bytes.

Signature

export interface EncryptedRemoteEntry extends Schema.Schema.Type<typeof EncryptedRemoteEntry> {}

Source

Since v4.0.0

Service that provides identity generation, entry encryption and decryption, and SHA-256 hashing for event-log replication.

When to use

Use to provide cryptographic operations required by encrypted event-log replication.

Signature

declare class EventLogEncryption

Source

Since v4.0.0