Repository navigation
Conversation
Keys are created with kSecAttrAccessibleWhenUnlockedThisDeviceOnly, so even a key with --access-control none is refused while the screen is locked (OSStatus -25308). That blocks unattended jobs, such as a launchd agent that decrypts at start. Add --accessibility when-unlocked|after-first-unlock. The default keeps the current class and the current identity file output. With after-first-unlock the key uses kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly, and the identity file gets an "# accessibility: after first unlock" header line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
piersdd
marked this pull request as ready for review
November 23, 2026 01:59
This branch has not been deployed
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.
Add
keygen --accessibility after-first-unlock, so a key with access controlnonekeeps working while the screen is locked. The default stayswhen-unlocked, and existing keys and identity files do not change.Summary
--accessibility when-unlocked|after-first-unlock, parsed like--access-control. The help text and README are updated.--accessibilityis akeygenoption only.CLITestsparses the new value and refuses an unknown one.PluginTests.testGenerate_AfterFirstUnlockchecks the header line. The existing header tests are unchanged, which shows the default output keeps its exact shape.Why: a background job (launchd agent, sops decrypt at service start) on an unattended Mac cannot use an enclave key today while the screen is locked, even with
--access-control none.Evidence
Before (v0.2.1, macOS 26, Apple Silicon,
--access-control none, screen locked with the user logged in; a decrypt every 5 s throughage -dand throughsops decrypt):age -dsops decryptThe refusal:
age: se plugin: The operation couldn’t be completed. (OSStatus error -25308.)(errSecInteractionNotAllowed).keygenis also refused while locked, with the same error.After:
swift teston macOS 26 (Swift 6.4.2): 110 tests, 0 failures. That includestestGenerate_AfterFirstUnlock,testParse_Keygen_AfterFirstUnlockandtestParse_KeyGen_InvalidAccessibility.On an unlocked Apple Silicon Mac,
keygen --access-control none --accessibility after-first-unlockmakes a key, and anageencrypt and decrypt round trip with it succeeds. The Secure Enclave accepts the class.Locked-screen probe with that key (a second Apple Silicon Mac, macOS 26, same probe, same versions plus this branch):
age -dsops decryptThe locked samples run for about 2 minutes, well past the ~10 s grace window seen with the default class.
Not yet run: a reboot without an unlock, to check that the key is still refused before the first unlock (the after-first-unlock contract).
Merge Danger
Door: two-way
A new opt-in flag with the old default. Reverting it removes the flag. Keys made with it stay usable while locked until the user deletes them, because the class lives in the key.
Blast Radius: opt-in
Default
keygenoutput and every existing key are unchanged. A user who opts in trades screen-lock protection for unattended use, so a process that runs as that user can use the key while the screen is locked. The help text names that trade-off.🤖 Generated with Claude Code