Files
craft-ai-integrations/docs
Jeremy 803473e7a0 feat(ai-native): encrypted-file fallback in the standard secret chain (#175)
* feat(ai-native): encrypted-file fallback in the standard secret chain

A machine with no OS keychain could not save a key through the standard
setup: AiClient::standard and ConnectionManager::standard layered only the
environment and the keychain, so every save failed with "no secret store".

standard_store(passphrase) now builds environment, keychain, then the
encrypted file at the default location. Without a passphrase the file
layer is a locked stand-in: no file reads as "no key", an existing file
is reported as locked rather than empty, and a save asks for a
passphrase. passphrase_need() tells a host when to ask (create or
unlock). Both standard constructors gain standard_with_passphrase.

Deliberate-bug group kf (7 cases, all caught). The real keychain round
trip passed by hand on Windows; Linux and macOS keychains, a bare Linux
session and a host prompting for the passphrase are not run.

* fix(ai-native): a failed file check counts as a locked file, not a missing one

Path::exists returns false when the check itself fails, such as an
ancestor folder that denies access. The locked stand-in then read a key as
absent, and both it and EncryptedFileStore::delete reported a delete as
done while the key could still be in the file.

Use try_exists. In the locked stand-in and passphrase_need, a failed
check counts as present, so it is reported as locked. In
EncryptedFileStore::delete, it is a storage error. Two new deliberate-bug
cases in kf, both caught (9 of 9).

* docs(ai-native): document the encrypted file store's set

* docs(ai-native): document the encrypted file store's name and get

* docs(ai-native): document the encrypted file store's error mapping and Debug

* fix(ai-client): show why a key save was refused when it needs a passphrase

ConnectionManager replaced every refused key save with the general
"keychain failed, set an environment variable" advice. On a machine with
no keychain, the person never saw that the secret file needs a
passphrase. A credentials refusal (Auth) from the store is now shown as
given; store errors never carry a secret. Other refusals keep the general
advice. New deliberate-bug case in kf, caught (10 of 10).
2026-11-10 16:58:39 -05:00
..