Skip to content
This repository was archived by the owner on Oct 22, 2026. It is now read-only.

descriptor: Introduce SecretDescriptor for context-free secret descriptor parsing - #1073

Open
7-falseparfait wants to merge 2 commits into
rust-bitcoin:masterfrom
7-falseparfait:issue-716-secret-descriptor
Open

7-falseparfait wants to merge 2 commits into
rust-bitcoin:masterfrom
7-falseparfait:issue-716-secret-descriptor

Conversation

@7-falseparfait

@7-falseparfait 7-falseparfait commented Oct 16, 2026 •

Copy link
Copy Markdown

Description

closes #716
currently, parsing descriptors containing secret keys such as xprv and tprv into the existing public descriptor type requires a secp256k1 signing context. the parser derives public keys and stores the corresponding secrets in a keymap.
this pr introduces secretdescriptor, a wrapper around descriptor that provides:

  • context-free parsing and serialization: parse descriptors containing private or public keys without a secp256k1 context or key derivation.
  • typed key validation: preserve key metadata during parsing so descriptor rules are enforced, including rejecting uncompressed keys in segwit descriptors such as wpkh.
  • public and mixed-key conversions: convert to and from a public descriptor and keymap; keys absent from the map remain public. converting secret keys to public keys still requires a signing context.
    unit tests cover secret-key parsing, wif formatting and checksums, segwit key validation, and public-only and mixed-key conversions.

Add `SecretDescriptor` to allow parsing and working with descriptors containing
secret keys (`xprv`, WIF) without requiring a `secp256k1` context during parsing.
@7-falseparfait

Copy link
Copy Markdown
Author

fixed formatting, all ci checks should be passing now

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Descriptor::parse_descriptor is hard to discover

1 participant