Skip to content

refactor(identity): choose and check signing keys with platform-wallet's selector - #1133

Draft
Claudius-Maginificent wants to merge 10 commits into
fix/protocol14-signing-key-selectionfrom
refactor/key-selection-via-platform-wallet
Draft

Claudius-Maginificent wants to merge 10 commits into
fix/protocol14-signing-key-selectionfrom
refactor/key-selection-via-platform-wallet

Conversation

@Claudius-Maginificent

@Claudius-Maginificent Claudius-Maginificent commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR: The app now chooses and checks identity signing keys with Platform's own wallet library instead of its own copy of the rules. Key choice stays the same as #1117, with two exceptions. A username registration refuses an expired key the user picked before anything is paid. And a key bound to a contract group is left to the network to accept or refuse.

User story

As a user, I want the app to pick signing keys exactly as Platform's wallet library does, so that this app and other Dash wallets agree on which key signs, and a fix in one reaches the other (IDN-024).

Scenario

An identity has an expired HIGH key. The user picks it under Advanced on the username screen and confirms.

  • Before: the app sent the registration. The network refused it after the user had confirmed the fee.
  • Now: the app refuses the key before anything is paid and says that the key has expired.

Detailed discussion

Blocked by dashpay/platform#5588. Stacked atop #1117.

What moves upstream

  • Automatic choice: platform_wallet::usable_signing_key picks the key for every action: documents, usernames, DashPay, tokens, contracts, key updates, credit transfers and withdrawals. It ranks every unlimited key at any accepted level before any limited one, then key id. It skips disabled, expired, out-of-scope and contract-group keys, and keys this device cannot sign with.
  • A key the user picked: platform_wallet::check_signing_key checks it, with the refusal Platform itself would return.
  • Contract bounds: platform-wallet's SigningScope::bounds_check (over dpp's ContractBounds::check_scope) gives the verdict, including the rule that bounds limit only AUTHENTICATION keys.
  • Accepted security levels: SecurityLevel::accepted_for_requirement gives the levels a document type accepts.
  • Scope type: the scope a signature authorizes is platform-wallet's SigningScope.

What stays in DET

Behaviour changes

  • Expired key picked for a username: refused before payment, with the expired-key message. Before, it was sent and the network refused it.
  • Contract-group key picked for a username: accepted, and the network decides. Before, it was refused.
  • A contract-bound key whose purpose is not AUTHENTICATION: no longer flagged as out of bounds, as consensus applies bounds only to AUTHENTICATION keys.

Dependencies

Testing

  • Library tests for the touched modules pass: qualified_identity, identity_key_usability, dashpay, dpns, document_action_screen, helpers, tokens, contracts_documents, identity::keys, and the transfer and withdrawal screens (859 passed).
  • cargo clippy --all-features --all-targets -- -D warnings and cargo fmt --all pass.
  • New tests cover:
    • a chosen registration key: expired, contract-group, wrong level, wrong purpose, disabled and unknown;
    • automatic choice skipping expired and contract-group keys;
    • bounds applying only to AUTHENTICATION keys;
    • contract-group warnings in and outside a batch.
  • Tests that duplicated upstream's selector and bounds tests were removed.
  • No live network or GUI flows were run.

🤖 Co-authored by Claudius the Magnificent AI Agent

🤖 Generated with Claude Code

https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

lklimek and others added 2 commits October 26, 2026 16:32
Pins every dashpay/platform crate to 6bb7927a (dashpay/platform#5588,
branch feat/platform-wallet-public-signing-key-selection, on v5.1-dev
575d961fe), which makes platform-wallet's protocol 14 key selector,
explicit-key check, SigningScope bounds check and own encryption key
selector public. The revision is not yet on v1.0-dev's pinned ancestry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…t's selector

Upstream platform-wallet now exposes the protocol 14 key selector
(usable_signing_key), the explicit-key check (check_signing_key), the
SigningScope they share with its bounds check, and its own encryption
key selector; dpp exposes the accepted security levels for a
requirement. DET's copies of those rules go: select_signing_key,
select_identity_signing_key, is_auto_selectable, bounds_permit,
document_security_levels, DET's own SigningScope, the DPNS chosen-key
predicate, the auto-accept encryption key mirror, and the tests that
duplicated upstream's.

What is left is DET's own: KeyRequirements as the argument bundle,
KeyLookupOnly for informational lookups that ignore what the device
holds, and the key chooser's caveats, which take the bounds verdict
from upstream.

Two choices change to follow upstream:
- A username registration refuses a chosen key that has expired before
  anything is paid, with the expired-key message, and accepts a chosen
  key bound to a contract group (Platform decides membership).
- Contract bounds limit only AUTHENTICATION keys, as in consensus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

Comment @coderabbitai help to get the list of available commands.

@Claudius-Maginificent Claudius-Maginificent added the blocked Blocked by something external to this issue label Oct 26, 2026
@thepastaclaw

thepastaclaw commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

🕓 Review not started yet because this PR is a draft.

  • Request normal review — click when the PR is ready for review.
  • Request priority review — click to move this review to the front of the queue.

Commit 0c7a9c1. Normal review starts when eligible; priority review starts as soon as a slot is available.

lklimek and others added 2 commits October 26, 2026 17:07
… key selection branch

Conflict: QualifiedIdentity::auto_accept_proof_key, which this branch
routed through platform-wallet's select_own_encryption_key and #1117
removed with DET's own auto-accept code; it stays removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
@Claudius-Maginificent

Copy link
Copy Markdown
Collaborator Author

Next steps: still blocked by dashpay/platform#5588. The updated #1117 head is merged in locally and verified; it will be pushed after #1117. Once #5588 merges, the Platform pin moves to the merged revision and this PR leaves draft.

🤖 Co-authored by Claudius the Magnificent AI Agent

lklimek and others added 6 commits October 26, 2026 20:35
…let key selection branch

Conflicts:
- src/model/qualified_identity/mod.rs: signing_key_now keeps upstream's
  selector and hands it ObtainableKeys, a signer view whose can_sign_with
  admits only keys whose private half this device can obtain (#1117's
  holds_obtainable_key fix).
- src/model/identity_key_usability.rs: this branch's removal of
  document_security_levels stays (dpp's accepted_for_requirement already
  returns exactly MASTER for MASTER); the MASTER test moves to
  qualified_identity, through document_signing_key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…-wallet key selection branch

Conflicts in Cargo.toml and Cargo.lock: v1.0-dev moves Platform to
575d961f; this branch keeps its pin at 6bb7927a (dashpay/platform#5588),
which already contains v5.1-dev up to 575d961f.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…gner requires

The view names only the identity id, so key material never reaches a
debug print.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Its sign methods forward to the identity without re-checking
holds_obtainable_key, so an unobtainable key keeps failing with the
identity's typed signing errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…n-via-platform-wallet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WunYYhY7P2FJqHVgkHiXtT
…n-via-platform-wallet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WunYYhY7P2FJqHVgkHiXtT
@Claudius-Maginificent Claudius-Maginificent added priority: low Low priority — nice to have priority: medium Medium priority and removed priority: low Low priority — nice to have labels Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Blocked by something external to this issue priority: medium Medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants