Skip to content

docs: encrypt the 69-byte compact xpub in the contact-request guide - #5087

Merged
QuantumExplorer merged 1 commit into
v4.2-devfrom
claude/dashpay-doc-fixes
Sep 27, 2026
Merged

QuantumExplorer merged 1 commit into
v4.2-devfrom
claude/dashpay-doc-fixes

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

What this does: fixes the book page that shows how to build a DashPay contact request. It told apps to encrypt the full 78-byte form of the sender's contact key. DashPay (DIP-15) and every wallet that reads these requests expect a shorter 69-byte form. A request built from the old page is accepted on chain, but the recipient's wallet cannot use it and drops it, so the contact never forms. The page now builds the 69-byte form.

It also corrects doc comments in the wallet crates that no longer match the code.

Example:

  • Before: the guide decoded the xpub and encrypted all 78 bytes (version, depth, parent fingerprint, child number, chain code, public key).
  • After: it encrypts only the parent fingerprint, chain code and public key (4 + 32 + 33 = 69 bytes), which is what platform_encryption::COMPACT_XPUB_LEN and the mobile wallets require.

Both lengths pad to the same 80-byte AES-CBC ciphertext, which is why the contract's 96-byte encryptedPublicKey check cannot catch the mistake.

Value: apps that follow the book can now create contact requests that other wallets accept.

Risks: None. Documentation and comments only.

Issue being fixed or feature implemented

Found while checking the committed DashPay specs removed in #5060 against the code. book/src/evo-sdk/dashpay-contact-requests.md (#3787) says "the sender's 78-byte serialized contact xpub", while packages/rs-platform-encryption/src/compact_xpub.rs defines the plaintext as parentFingerprint(4) ‖ chainCode(32) ‖ publicKey(33) and refuses any other length on receive.

What was done?

  • book/src/evo-sdk/dashpay-contact-requests.md: explain the 69-byte compact layout and why the contract cannot detect a 78-byte plaintext; serializedXpubPayload becomes compactXpubPayload, which slices bytes 5..9 and 13..78 out of the decoded BIP32 xpub.
  • rs-platform-wallet:
    • build_contact_accounts described an older synchronous build; it now only queues work for the signer-backed drain, and the doc says so.
    • ContactInfoPrivateData::display_hidden is not "the cross-device ignore signal"; ignore is a separate, device-local feature.
    • DashPayState::pending_contact_crypto said cold-load restore was "blocked upstream"; the storage crate's reader says nothing blocks it any more.
    • SpvEventForwarder (now LockNotifyHandler) and TokenWallet (now IdentitySyncManager) mentions updated; the latter was also a broken intra-doc link.
    • The shielded paloma example and decrypt bench no longer claim to mirror an iOS raw-seed bind or a drive-abci seeder that no longer exist.
  • rs-platform-encryption: encrypt_private_data said the plaintext is CBOR; it is the DIP-15 var-int encoding.

How Has This Been Tested?

Checked the new slice against BIP32 test vector 1 (xpub68Gmy5Edvgib..., chain m/0H): bytes 5..9 are the parent fingerprint 3442193e, 13..45 the chain code, 45..78 the public key, 69 bytes total. rustfmt --check on every touched Rust file. No code changes.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed
  • If I added or changed GroveDB structure, I described it in the area's structure.rs, regenerated grovedb-structure.json, and checked the structure viewer link posted on this pull request

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · bc7e3cf

  • Bots — coderabbitai not yet · thepastaclaw not yet — /skip-bots proceeds without the ones not yet reported
  • Self-review — post /self-reviewed once the bots are done
  • Within your 5 open PRs — this one is beyond the limit; it waits until one merges
  • Build running
  • Approvals
    • files with no dedicated owner — you own it
    • rs-platform-wallet (packages/rs-platform-wallet/examples/shielded_sync_paloma.rs, packages/rs-platform-wallet/src/wallet/asset_lock/manager.rs, packages/rs-platform-wallet/src/wallet/asset_lock/sync/proof.rs and 6 more) — HashEngineering or ZocoLini or llbartekll or romchornyi

When every box is checked the PR Hygiene check passes and this can merge.

The book's contact-request guide encrypted the full 78-byte BIP32 xpub.
DIP-15 and every receiver (the reference mobile wallets and our Rust,
Swift and Kotlin SDKs) use the 69-byte compact form: parent fingerprint,
chain code and public key. Both lengths pad to the same 80-byte
ciphertext, so the contract accepts the document and the recipient's
wallet then drops it. The helper now slices the compact form out of the
decoded xpub.

Also corrects doc comments that no longer match the code:
- build_contact_accounts only queues work for the signer-backed drain
- displayHidden hides a contact; it is not the ignore feature
- contactInfo privateData plaintext is the DIP-15 var-int encoding, not
  CBOR
- the pending contact-crypto queue is not restored on load, and nothing
  blocks that any more
- SpvEventForwarder and TokenWallet were replaced by LockNotifyHandler
  and IdentitySyncManager
- the shielded example and bench no longer mirror an iOS raw-seed bind
  or a drive-abci seeder

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 43 minutes.

Check out review usage here.

View limit details

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

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: dashpay/platform/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 967211d0-9a29-4ab8-bb31-e85418d1167b

📥 Commits

Reviewing files that changed from the base of the PR and between b23a06b and bc7e3cf.

📒 Files selected for processing (11)
  • book/src/evo-sdk/dashpay-contact-requests.md
  • packages/rs-platform-encryption/src/contact_info.rs
  • packages/rs-platform-wallet/examples/shielded_sync_paloma.rs
  • packages/rs-platform-wallet/src/wallet/asset_lock/manager.rs
  • packages/rs-platform-wallet/src/wallet/asset_lock/sync/proof.rs
  • packages/rs-platform-wallet/src/wallet/asset_lock/sync/recovery.rs
  • packages/rs-platform-wallet/src/wallet/identity/crypto/contact_info.rs
  • packages/rs-platform-wallet/src/wallet/identity/network/contact_requests.rs
  • packages/rs-platform-wallet/src/wallet/identity/network/tokens/mod.rs
  • packages/rs-platform-wallet/src/wallet/identity/state/managed_identity/dashpay.rs
  • packages/rs-platform-wallet/tests/shielded_decrypt_bench.rs

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.

@github-actions github-actions Bot added this to the v4.2.0 milestone Sep 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📖 Book Preview built successfully.

Download the preview from the workflow artifacts.
To view locally: download the artifact, unzip, and open index.html.

Updated at 2026-09-27T23:06:16.756Z

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Sep 27, 2026
@thepastaclaw

thepastaclaw commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

🕓 Queued for automated review — 1st in line, estimated start in ~10 min (commit bc7e3cf)
Estimated review time once started: ~1.1 h (two-phase automated review; median of recent runs).

  • Request priority review — click to move this review to the front of the queue.

@QuantumExplorer
QuantumExplorer merged commit c4125c9 into v4.2-dev Sep 27, 2026
22 of 23 checks passed
@QuantumExplorer
QuantumExplorer deleted the claude/dashpay-doc-fixes branch September 27, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-bots Waiting for the review bots to report on this head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants