Skip to content

AsyncNoKeyStorageStrategy

Bases: AsyncEncryptionKeyStorageStrategy

Default async key storage strategy rejecting all key operations.

Async counterpart of NoKeyStorageStrategy.

Source code in event_sourcery/_event_store/_async/encryption.py
class AsyncNoKeyStorageStrategy(AsyncEncryptionKeyStorageStrategy):
    """
    Default async key storage strategy rejecting all key operations.

    Async counterpart of `NoKeyStorageStrategy`.
    """

    async def get(self, subject_id: str) -> bytes | None:
        raise NotImplementedError(
            "AsyncNoKeyStorageStrategy does not support key retrieval."
        )

    async def store(self, subject_id: str, key: bytes) -> None:
        raise NotImplementedError(
            "AsyncNoKeyStorageStrategy does not support key storage."
        )

    async def delete(self, subject_id: str) -> None:
        raise NotImplementedError(
            "AsyncNoKeyStorageStrategy does not support key deletion."
        )

    def scoped_for_tenant(self, tenant_id: TenantId) -> Self:
        return self