Skip to content

fix(dg): wallet renewal is one obvious step - #764

Merged
PastaPastaPasta merged 7 commits into
masterfrom
fix/dg-wallet-renewal
Nov 27, 2026
Merged

PastaPastaPasta merged 7 commits into
masterfrom
fix/dg-wallet-renewal

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

Closes #664.

Problem

  • Renewal pinned the identity silently. Every dg auth login --wallet after a wallet sign-in names that identity (IDENTITY_HINT). A user who scans with another identity waits out the full 10 minutes, and the error never says why.
  • Every renewal re-asked about a kept master key. After an earlier --full-key sign-in on a machine with a keychain, each wallet renewal asked about the master-key file and refused under --yes. The wallet key goes to the keychain, so that file was never overwritten.

Fix

  • The code names whom it renews. A renewal's code screen prints This code renews alice.dash (ID); only that identity's answer is read. To sign in as another identity: dg auth login --wallet --any-identity.
    • The new --any-identity flag drops the hint, so any identity can answer.
    • The timeout error offers that flag first when the code was a renewal.
  • The guard checks only what this run overwrites. Storer::main_slot_replaced mirrors Storer::write: the keychain entry when the keychain takes the key, else the key file.
    • A --full-key file that only stops being the default is not asked about, including under --yes.
    • The success output says your master key stays in <file>, and --json reports it as masterKeyKeptAt.
    • A master key that would really be overwritten is still guarded.
  • Smaller items from the issue:
    • verify_grant reports the latest read, not an early failed one.
    • The not_stored note says the key "stays live on the identity until it expires, a wallet renewal replaces it, or you disconnect".
    • The app-connect.lock path creates the config directory 0700.
  • Docs: identity-and-keys.md describes the renewal line and --any-identity.

Compat

  • app-connect.toml and the key files and keychain entries keep their format and location.
  • The guard now looks at fewer sources. Every source it skips stays on disk untouched.
  • The new JSON field is additive.
  • Older dg versions read everything this version writes.
  • Nothing changes on chain.

Tests (boat, x86_64)

  • cargo fmt --check and cargo clippy -p dg --all-targets -D warnings: clean.
  • cargo test -p dg: 629 passed, plus the integration tests.
  • New tests:
    • a_master_key_the_wallet_key_does_not_overwrite_is_not_asked_about
    • a_renewal_says_how_to_sign_in_as_another_identity
    • --any-identity parsing, including its conflict with a file argument
    • the updated not_stored wording

🤖 Generated with Claude Code

… a kept master key

- A renewal's code prints "This code renews <name>" and how to sign in as
  someone else: the new --any-identity flag drops IDENTITY_HINT. Its
  timeout error names that flag first.
- The master-key guard looks only at what this run's store overwrites
  (Storer::main_slot_replaced). A --full-key file the wallet key only
  displaces as the default stays, is not asked about (also under --yes),
  and the success output names where the master key stays.
- verify_grant reports the latest read, not an early failed one.
- not_stored says the key stays live until it expires, a wallet renewal
  replaces it, or you disconnect.
- The app-connect lock creates the config directory 0700.

Closes #664

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 56031b63-e1ab-46b4-96d2-dbf9375af74d
Commits

Reviewing files that changed from the base of the PR and between 6e3e1a4 and fbd0014.

Files selected for processing: 8

  • .gitleaksignore
  • CHANGELOG.md
  • crates/dg/src/auth/mod.rs
  • crates/dg/src/auth/store.rs
  • crates/dg/src/auth/wallet.rs
  • docs/guides/identity-and-keys.md
  • docs/schemas/dg/auth-login.schema.json
  • docs/schemas/generate.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

PastaPastaPasta and others added 6 commits November 27, 2026 02:44
Review of #764: when the keychain refuses the wallet key, Storer::write
falls back to the main-slot file. The guard had not named that file, so
a --full-key master key there would have been overwritten unasked. The
storer now refuses that fallback. master_kept is computed after the store
and excludes what was stored (by real path), reports the raw key source
in masterKeyKeptAt (schema regenerated), and the human line mentions
that dg auth logout deletes dg's own key file.

Also: --any-identity routes to the wallet sign-in, a renewal's code drops
the "anyone who answers" warning, every note uses one "stays live" line,
and CHANGELOG entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… that won't open

Second review of #764: refusing every unnamed main-slot file broke
renewal where the keychain is present but locked (a Mac over SSH): the
first login fell back to the file, so every renewal then refused after
the wallet had disabled the old key. The fallback now judges the file
as the guard would: a limited key (plain, or sealed with this run's
passphrase) is replaced after a copy is kept; a master key or a file
that does not open is refused, naming how to unlock the keychain or move
the file aside. Restores the identity-and-keys.md renewal paragraph the
previous commit dropped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… WIFs out of key fields

61ee60c was committed from an index that `git checkout <base> -- <paths>`
had reset, so it reverted wallet.rs, mod.rs, the CHANGELOG and the schema
to master. This restores the tested tree (fmt, clippy -D warnings and
cargo test -p dg auth:: pass on boat). The store test names the public
0x11..11 WIF through a variable, so gitleaks' generic-api-key rule does
not see it in a privateKeyWif field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…assphrase seals the new one

Final review of #764: over SSH with a locked keychain, an earlier
fallback's sealed file opened with its old passphrase, but choosing a
new one for the new key made the fallback refuse with a misleading
message. Keys wallet login already opened without a master key are now
passed to the storer as replaceable; the refusal is checked before the
passphrase prompt unless only that passphrase can tell (a sealed file),
and says which case it is. The identity guide and CHANGELOG describe the
narrowed guard.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…passphrase

Pins the fix for the final #764 review's Medium, and the refusal only
says "another passphrase" when the sealed file did not open with it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@PastaPastaPasta
PastaPastaPasta merged commit 7a79bd6 into master Nov 27, 2026
21 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.

dg auth login --wallet: renewal pins the default identity; keychain + --full-key re-prompts

1 participant