Skip to content

Add BIP-322 signature variant prefixes - #71

Open
aagbotemi wants to merge 2 commits into
rust-bitcoin:masterfrom
aagbotemi:feat/signature-prefix
Open

Add BIP-322 signature variant prefixes#71
aagbotemi wants to merge 2 commits into
rust-bitcoin:masterfrom
aagbotemi:feat/signature-prefix

Conversation

@aagbotemi

@aagbotemi aagbotemi commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

The BIP-322 spec requires signers to prefix the base64 signature with a variant identifier (smp for simple, ful for full, or pof for proof of funds) and verifiers may only assume the simple variant when no prefix is present. The crate emitted bare base64 from all three sign_*_encoded functions and only accepted bare base64 on verification, so prefixed signatures from spec-compliant implementations failed to decode.

This prepends the variant prefix in sign_simple_encoded, sign_full_encoded, and sign_pof_encoded, and strips it in the corresponding verifiers, falling back to the unprefixed encoding when absent.

Rebased on #67.

Changes

  • Add SIMPLE_SIGNATURE_PREFIX, FULL_SIGNATURE_PREFIX, and POF_SIGNATURE_PREFIX constants

Closes #70

@aagbotemi
aagbotemi force-pushed the feat/signature-prefix branch from f94273d to 61c3565 Compare July 30, 2026 14:35
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.

Add prefixes to signature

1 participant