feat(local-encrypt): multiple keys with per-key biometric opt-in/out#867
Open
theoephraim wants to merge 1 commit into
Open
feat(local-encrypt): multiple keys with per-key biometric opt-in/out#867theoephraim wants to merge 1 commit into
theoephraim wants to merge 1 commit into
Conversation
Adds support for multiple device-local encryption keys, each with its own
presence-gate behavior, and lets projects/values choose which key to use.
- `varlock keys` (list/create) — create named keys; `--no-auth` opts a key
out of presence verification for unattended use (servers/CI)
- Per-key `requireAuth` recorded in key metadata across all backends
(Rust StoredKey field, Swift SE sidecar since the ACL can't be read back);
legacy keys normalize to "requires auth"
- decrypt routing honors the per-key flag: a no-auth key takes the one-shot
path and never warms the biometric session for auth-required keys
- `@defaultLocalKey` root decorator sets the project default key; per-value
override via `varlock("local:...", key="...")`; `varlock encrypt --key-id`
emits the key= arg only when it differs from the default
- the default key also encrypts the disk cache (per-project cache file +
inherited presence behavior)
- device-bound decrypt errors now hint when a referenced key is missing
Docs: local-encryption guide "Choosing a key", @defaultLocalKey reference,
`varlock keys` + `encrypt --key-id` in the CLI reference.
Contributor
|
The changes in this PR will be included in the next version bump.
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
varlock-website | bcf1393 | Commit Preview URL Branch Preview URL |
Jul 07 2026, 06:43 PM |
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What & why
Follows up the local-encryption threat-model work (#852) and Windows TPM support (#854): makes device-local encryption support multiple keys, each with its own presence-gate behavior, and lets a project or an individual value choose which key to use.
Previously
keyIdexisted at the crypto/storage layer but wasn't usable end-to-end — thevarlock("local:...")reference didn't encode a key, and the resolver always decrypted withvarlock-default(soencrypt --key-idwas hidden). This wires it up and adds the per-key biometric opt-in/out we'd discussed.What you can do now
Design
requireAuthat creation; decrypt prompts when intent(key) AND a gate exists on the machine. This is the durable half of the earlier opt-in/out discussion — availability stays a per-machine property, so no staleness trap.varlock-default→@defaultLocalKey(project) →key=(per value). Single-key projects keep bare references; only a non-default key writes akey=arg.CacheStorewas already keyed by keyId) — per-project cache file, and the cache inherits the key's presence behavior.Implementation
StoredKey.require_auth(back-compat: missing → prompts),--no-authon generate-key,keyDetailsinstatus/list-keys, daemon skips the gate for no-auth keys without warming the session for auth-required keys.{keyId}.meta.jsonsidecar recordsrequireAuth; daemon skips the LAContext prompt for no-auth keys;keyDetailsin status/list-keys.generateKey({ requireAuth }),listKeyDetails(), key-id validation;key=arg +@defaultLocalKeyin the resolver;CacheStorethreading; newvarlock keyscommand;encrypt --key-idunhidden.Tests
key=round-trip, wrong-key failure, invalid key id, missing-key device-bound hint,@defaultLocalKeyvalidation, key metadata listing (950 unit tests pass).Notes / follow-ups