What encryption does (Effect's EventLogEncryption service).
Attributes#
| Attribute | Type | Description |
|---|---|---|
generate_identity | Effect[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.
| Parameter | Type | Description |
|---|---|---|
identity | IdentityService | |
store_id | str | |
entries | Sequence[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.
| Parameter | Type | Description |
|---|---|---|
identity | IdentityService | |
store_id | str | |
batches | Sequence[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.
| Parameter | Type | Description |
|---|---|---|
data | bytes |
Returns Effect[bytes]
@abstractmethod
def sha256(self, data: bytes, /) -> Effect[bytes]:
"""The SHA-256 digest of ``data``. Never fails."""