GitHub

EventLogEncryptionService

API reference for EventLogEncryptionService.

What encryption does (Effect's EventLogEncryption service).

Attributes

AttributeTypeDescription
generate_identityEffect[IdentityService]

A new identity: a random UUID public key and 32 random bytes of root secret.

Functions

encrypt

encrypt(identity, store_id, entries) -> Effect[list[EncryptedBatch]]

entries in order, packed into batches and each batch sealed with identity's key, bound to store_id and its entry ids. Never fails; a crypto failure is a defect.

ParameterTypeDescription
identityIdentityService
store_idstr
entriesSequence[Entry]

Returns Effect[list[EncryptedBatch]]

@abstractmethod
def encrypt(
    self, identity: IdentityService, store_id: str, entries: Sequence[Entry], /
) -> Effect[list[EncryptedBatch]]:
    """``entries`` in order, packed into batches and each batch sealed
    with ``identity``'s key, bound to ``store_id`` and its entry ids.
    Never fails; a crypto failure is a defect."""

decrypt

decrypt(identity, store_id, batches) -> Effect[list[RemoteEntry]]

The entries of batches; a defect when a batch does not decrypt or its entries are not its entry ids.

ParameterTypeDescription
identityIdentityService
store_idstr
batchesSequence[EncryptedRemoteBatch]

Returns Effect[list[RemoteEntry]]

@abstractmethod
def decrypt(
    self, identity: IdentityService, store_id: str, batches: Sequence[EncryptedRemoteBatch], /
) -> Effect[list[RemoteEntry]]:
    """The entries of ``batches``; a defect when a batch does not
    decrypt or its entries are not its entry ids."""

sha256

sha256(data) -> Effect[bytes]

The SHA-256 digest of data. Never fails.

ParameterTypeDescription
databytes

Returns Effect[bytes]

@abstractmethod
def sha256(self, data: bytes, /) -> Effect[bytes]:
    """The SHA-256 digest of ``data``. Never fails."""