Status: built 2026-11-23 (owner's choice: options A and C, with E's sources that need no terminal).
Tier: core (cred.c: the recorded source, pic_cred_quiet, pic_cred_rekey, the offer) over the
platform seam (platform.h: secret_key, secret_keep, secret_drop); the host's sources live in
platform.c alone. Clock: os (the security and secret-tool command lines, tmutil). Record:
picu_credential_key.source (keychain, file or passphrase; a raw key's kdf is none), the
setting cred.offer. Default: a new store's random key in the login Keychain (or keyring), else
~/.pic/master.key; a passphrase only when chosen.
The threat model
A copied pic.sqlite, a backup or an exported journal on its own reveals nothing. Malware or a
person acting in the user's unlocked session can read the key, as with the keys other tools keep.
So a passphrase stops being the default: it guarded against the second case at the cost of a prompt
in every process, and against the first case no better than a key kept apart from the database.
Decisions
- The sealing (ChaCha20-Poly1305 under a 32-byte master key, the verifier) is unchanged; only where the master key comes from changes, with no stretching for a raw key.
- The keystore runs as a child process (
/usr/bin/security -i, the command on its stdin;secret-tool store, the secret on its stdin), so the key is never in argv and pic links no framework. A keep is read back before it counts, since a locked Keychain can seem to take one. - The keystore is used only for the store under the account's own home directory; any other
HOMEgets the key file. Tests run under a privateHOME, so a test that forgets the stand-in (PIC_TEST_KEYCHAIN) still cannot reach the real Keychain. - A rekey reseals every sealed row (credentials, remote control's keys and devices) in one transaction; the old source is cleared only after the commit, and a new source that the commit did not take is cleared again. A row that did not open under the old key is left as it was.
- An OS-free build supplies its own
secret_key(andsecret_keepwhen it can keep a key; when it keeps a fixed boot key,secret_keepnames that source and keeps nothing).