Skip to content

fix(tui): unlock with X25519 recipients added via add-recipient - #116

Merged
VirtualMachinist merged 3 commits into
mainfrom
jupi/geode-tui-x25519-unlock
Oct 26, 2026
Merged

VirtualMachinist merged 3 commits into
mainfrom
jupi/geode-tui-x25519-unlock

Conversation

@VirtualMachinist

@VirtualMachinist VirtualMachinist commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

F-2: TUI unlock for X25519 identities

geode_tui::vault::open built its session with Session::unlock, which re-derives the epoch key from the operator's ISK. That only matches the vault's original symmetric identity. These identities could not open the vault in the TUI:

  • an identity added with vault add-recipient --gpub;
  • an identity left as the only recipient after a rotate dropped the original key.

Fix: one shared unwrap path

  • geode-grotto recipients:
    • X25519_IDENTITY_DOMAIN, x25519_identity_secret / x25519_identity_public (the .gpub derivation) and x25519_public_matches (constant time).
    • unwrap_for_identity(recs, isk, vault_id, epoch): matches the symmetric entry by key_id, or the X25519 entry by public key, and unwraps it. No matching entry is AuthFail.
  • geode-grotto session: Session::unlock_recipients(isk, &recs, vault_id, epoch, idle) unwraps the epoch key through that path, then zeroizes the ISK.
  • CLI: load_recipients_for now calls unwrap_for_identity, which is the X25519 path from fix(vault): x25519 recipients can open their vault; rotate fails closed #114 moved into core. The CLI's X25519 domain constant is imported from core, so the two can't drift apart.
  • TUI: vault::open reads recipients.json and unlocks with Session::unlock_recipients. Header and manifest MAC checks are unchanged.

Tests

  • geode-grotto unit tests:
    • recipients::identity_unwrap_tests: symmetric and X25519 identities unwrap the same epoch key; a stranger key or the wrong epoch fails; the public key derivation matches .gpub.
    • session::unlock_recipients_tests: an X25519 identity unlocks a session; the owner with no entry gets AuthFail.
  • geode-tui/tests/x25519_unlock.rs (fixture built with the CLI, dummy keys, HOME/XDG isolated; assertions call geode_tui::vault::open / verify(full) / preview in-process):
    • tui_unlock_x25519_recipient: both the added key and the owner key open; key_id matches the .gpub.
    • tui_unlock_after_owner_dropped: after rotate --drop-recipient <owner> --reseal, the added key opens and the owner key gets AuthFail.
    • tui_unlock_stranger_is_auth_fail

CHANGELOG Unreleased entry added. No version bump.

Refresh after #115

  • main (with fix(vault): refuse no-reseal rotate that would hide entries; strict restore #115) brought in by a true merge, no rebase; the CHANGELOG Unreleased conflict kept both sides.
  • Review nits as a new commit: the CLI's duplicate X25519 derivation removed (core's x25519_identity_* is the only one); the debug-only key_id check in cmd/mod.rs is now a real AuthFail check; the new recipients helpers sit below the imports; secret temporaries are zeroized; the wrong-epoch test asserts AuthFail specifically.

The TUI unlock re-derived the epoch key from the operator's ISK, which
only matches the vault's original symmetric identity. An identity added
with `vault add-recipient --gpub` (or one left after a rotate dropped the
original key) could not open the vault in the TUI.

The recipient-matching unwrap now lives in geode-grotto
(`recipients::unwrap_for_identity`, plus the shared X25519 identity
derivation) and `Session::unlock_recipients` builds a session from it. The
CLI's `load_recipients_for` and the TUI's `vault::open` both use it.

Tests: core unit tests for symmetric/X25519/stranger unwrap and the
session constructor; TUI integration tests for an added identity, an
identity left after the original key was dropped, and a stranger key.
- The CLI no longer carries its own copy of the X25519 identity
  derivation; `.gpub` generation and rotate use geode-grotto's
  `x25519_identity_secret` / `x25519_identity_public`.
- `load_recipients_for` checks the caller's key_id against the identity in
  every build (was a debug-only assertion); a mismatch is an auth failure.
- recipients.rs: the identity helpers now sit below the imports.
- The by-value copy of the X25519 secret used to build the static secret
  is zeroized after use.
- The wrong-epoch unwrap test asserts an authentication failure
  specifically.
@VirtualMachinist
VirtualMachinist marked this pull request as ready for review October 26, 2026 21:25
@VirtualMachinist
VirtualMachinist merged commit 500d555 into main Oct 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant