Add BIP-322 signature variant prefixes - #71
Open
aagbotemi wants to merge 11 commits into
Open
Conversation
aagbotemi
force-pushed
the
feat/signature-prefix
branch
from
July 18, 2026 01:58
7be8f34 to
afcfb4e
Compare
aagbotemi
force-pushed
the
feat/signature-prefix
branch
from
July 27, 2026 08:29
afcfb4e to
970f440
Compare
aagbotemi
force-pushed
the
feat/signature-prefix
branch
from
July 27, 2026 08:34
970f440 to
ada0f1b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The BIP-322 spec requires signers to prefix the base64 signature with a variant identifier (
smpfor simple,fulfor full, orpoffor proof of funds) and verifiers may only assume the simple variant when no prefix is present. The crate emitted bare base64 from all threesign_*_encodedfunctions 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, andsign_pof_encoded, and strips it in the corresponding verifiers, falling back to the unprefixed encoding when absent.Rebased on #67.
Changes
SIMPLE_SIGNATURE_PREFIX, FULL_SIGNATURE_PREFIX, and POF_SIGNATURE_PREFIX constantsCloses #70