Chronicle.ErasureKeyring behaviour (chronicle v0.1.1)

Copy Markdown

Behaviour and dispatcher for destroyable data-encryption keys.

The keyring owns the key lifecycle; Chronicle owns only ciphertext and an opaque identifier. Configure one implementation globally:

config :chronicle,
  erasure: [
    keyring: {MyApp.PrivacyKeys, vault: MyApp.Vault}
  ]

Implementations must return exactly 32 bytes from fetch/2. destroy/2 must return :ok only after future fetches of that identifier can no longer recover the key, including from replicas or provider-managed recovery windows. Backup and legal-hold policy remain the application's responsibility.

Key identifiers are signed into the ledger. They must be stable, opaque, and contain no personal data.

Summary

Functions

Returns whether an erasure keyring is configured.

Types

options()

@type options() :: keyword()

result()

@type result() :: {:ok, binary()} | {:error, term()}

Callbacks

destroy(t, options)

@callback destroy(String.t(), options()) :: :ok | {:error, term()}

fetch(t, options)

@callback fetch(String.t(), options()) :: result()

Functions

configured?()

@spec configured?() :: boolean()

Returns whether an erasure keyring is configured.