Gamend.Secrets.Secret (gamend_core v1.0.1296)

Copy Markdown View Source

One encrypted value, and the metadata a person needs to manage something they can never read back.

The struct is safe to hand to a template: it holds ciphertext, not a secret. Gamend.Secrets.fetch/3 is the only thing that opens one.

Summary

Functions

Whether this secret has passed the expiry it was given.

Types

t()

@type t() :: %Gamend.Secrets.Secret{
  __meta__: term(),
  byte_size: term(),
  ciphertext: term(),
  created_by_id: term(),
  expires_at: term(),
  fingerprint: term(),
  id: term(),
  inserted_at: term(),
  iv: term(),
  key_id: term(),
  kind: term(),
  last_used_at: term(),
  name: term(),
  scope: term(),
  scope_id: term(),
  tag: term(),
  updated_at: term()
}

Functions

expired?(secret, now \\ DateTime.utc_now())

@spec expired?(t(), DateTime.t()) :: boolean()

Whether this secret has passed the expiry it was given.

Nothing enforces it — a certificate that expired yesterday still decrypts, and the signer will fail with whatever the platform's tooling says. This is for telling somebody before that happens.