End-to-end encryption of the entries an event log sends to a remote
(Effect's eventlog/EventLogEncryption).
Entries go in batches of at most 100 entries or 256 KiB of payload (a
larger entry is a batch alone), each encrypted with AES-256-GCM under the
key derived from the identity's root secret. The additional data binds a
batch to its store and entry ids, so a server cannot move it to another
store or relabel it. layer runs on the pyfect.crypto services in
context; layer_subtle (Effect's name, for WebCrypto's crypto.subtle)
on their Web Crypto layers. Both need the extra pyfect-dev[eventlog].
Values#
| Attribute | Type | Description |
|---|---|---|
make | Effect[EventLogEncryptionService, Never, aead.Aead | digest.Digest | secure_random.SecureRandom] | An |
layer | Layer[EventLogEncryption, Never, aead.Aead | digest.Digest | secure_random.SecureRandom] |
|
layer_subtle | Layer[EventLogEncryption] |
|
Classes#
Functions#
remote_batch#
remote_batch(sequence, batch) -> EncryptedRemoteBatch| Parameter | Type | Description |
|---|---|---|
sequence | int | |
batch | EncryptedBatch |
Returns EncryptedRemoteBatch
def remote_batch(sequence: int, batch: EncryptedBatch) -> EncryptedRemoteBatch:
return EncryptedRemoteBatch(
sequence=sequence,
entry_ids=batch.entry_ids,
iv=batch.iv,
encrypted_batch=batch.encrypted_batch,
)make_encryption_subtle#
make_encryption_subtle(crypto) -> Effect[EventLogEncryptionService]make on the Web Crypto layers of Aead, Digest and
SecureRandom, running on crypto.
| Parameter | Type | Description |
|---|---|---|
crypto | web.Crypto |
Returns Effect[EventLogEncryptionService]
def make_encryption_subtle(crypto: web.Crypto) -> Effect[EventLogEncryptionService]:
"""``make`` on the Web Crypto layers of ``Aead``, ``Digest`` and
``SecureRandom``, running on ``crypto``."""
# ``local`` keeps enclosing Web Crypto layers, built on another
# ``Crypto``, from being reused.
return make.pipe(
provide_layer(_layer_web_crypto.pipe(provide_layer(web.layer(crypto))), local=True)
)