Persistence for the subscription Credential at ~/.pixir/auth.json (ADR 0002).
Only subscription credentials are written — an OPENAI_API_KEY lives in the
environment and is never persisted. Writes are atomic (temp + rename) and the file
is mode 0600. The on-disk shape is a flat JSON object with string keys; load/1
returns the in-memory credential map (atom keys).
Summary
Functions
Delete the stored credential (logout). Missing file is success.
Load the stored subscription credential, if any. Accepts :path (testing).
Path to auth.json. Accepts :path override (testing).
Persist a subscription credential atomically (mode 0600).
Types
@type credential() :: map()
Functions
@spec clear(keyword()) :: :ok
Delete the stored credential (logout). Missing file is success.
@spec load(keyword()) :: {:ok, credential()} | {:error, :not_found | map()}
Load the stored subscription credential, if any. Accepts :path (testing).
Path to auth.json. Accepts :path override (testing).
@spec save( credential(), keyword() ) :: :ok | {:error, map()}
Persist a subscription credential atomically (mode 0600).