yera.creds.backends.memory

In-memory secret-store backend.

Symbols

class InMemorySecretStore — Store opaque secrets in process memory.

InMemorySecretStore

Inherits: SecretStore

Store opaque secrets in process memory.

Methods

get — Return one stored secret.
set — Create or replace one secret.
compare_and_set — Conditionally create or replace one secret.
delete — Delete one secret.
exists — Return whether one secret exists.
list_info — List non-sensitive information about matching secrets.

InMemorySecretStore.get

get(
    identity: SecretIdentity,
) → SecretValue

Return one stored secret.

Parameters

identity
type: SecretIdentity

Durable identity of the requested secret.

Returns

type: SecretValue

The opaque stored value.

Raises

SecretNotFoundError

If the secret does not exist.

InMemorySecretStore.set

set(
    identity: SecretIdentity,
    value: SecretValue,
) → SecretInfo

Create or replace one secret.

Parameters

identity
type: SecretIdentity

Durable identity of the secret.

value
type: SecretValue

Opaque serialized value to store.

Returns

type: SecretInfo

Non-sensitive information about the stored secret.

InMemorySecretStore.compare_and_set

compare_and_set(
    identity: SecretIdentity,
    expected_updated_at: datetime | None,
    value: SecretValue,
) → SecretInfo

Conditionally create or replace one secret.

Parameters

identity
type: SecretIdentity

Durable identity of the secret.

expected_updated_at
type: datetime | None

Expected update time, or None when the secret is expected not to exist.

value
type: SecretValue

Opaque serialized replacement value.

Returns

type: SecretInfo

Non-sensitive information about the stored secret.

Raises

SecretConflictError

If current state differs from the expectation.

InMemorySecretStore.delete

delete(
    identity: SecretIdentity,
) → None

Delete one secret.

Parameters

identity
type: SecretIdentity

Durable identity of the secret.

Raises

SecretNotFoundError

If the secret does not exist.

InMemorySecretStore.exists

exists(
    identity: SecretIdentity,
) → bool

Return whether one secret exists.

Parameters

identity
type: SecretIdentity

Durable identity to test.

Returns

type: bool

Whether the secret exists.

InMemorySecretStore.list_info

list_info(
    namespace: str | None = None,
    owner_id: str | None = None,
) → tuple[SecretInfo, ...]

List non-sensitive information about matching secrets.

Parameters

namespace
type: str | None = None

Optional namespace filter.

owner_id
type: str | None = None

Optional owning identifier filter.

Returns

type: tuple[SecretInfo, ...]

Matching secret information in stable identity order.