AsyncEncryptionKeyStorageStrategy
Interface for async key management strategies used in event encryption.
Async counterpart of EncryptionKeyStorageStrategy. Operations that
perform I/O are coroutines. Implementations are responsible for storing,
retrieving, and deleting encryption keys for data subjects. Supports
multi-tenancy via scoped_for_tenant.
Source code in event_sourcery/_event_store/_async/encryption.py
delete(subject_id)
async
Deletes the encryption key for the given subject identifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subject_id
|
str
|
The subject identifier whose key should be deleted. |
required |
Source code in event_sourcery/_event_store/_async/encryption.py
get(subject_id)
async
Retrieves the encryption key for the given subject identifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subject_id
|
str
|
The subject identifier. |
required |
Returns:
| Type | Description |
|---|---|
bytes | None
|
bytes | None: The encryption key, or None if not found. |
Source code in event_sourcery/_event_store/_async/encryption.py
scoped_for_tenant(tenant_id)
Returns a key storage strategy instance scoped for the given tenant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tenant_id
|
TenantId
|
The tenant identifier. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The key storage strategy instance for the tenant. |
Source code in event_sourcery/_event_store/_async/encryption.py
store(subject_id, key)
async
Stores the encryption key for the given subject identifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subject_id
|
str
|
The subject identifier. |
required |
key
|
bytes
|
The encryption key to store. |
required |