fix(rewards): accept SIMD-0048 off-chain wrapped signatures (Ledger)#811
Merged
Conversation
Hardware wallets (e.g. Ledger via Phantom) refuse to sign arbitrary bytes and instead sign the SIMD-0048 off-chain message envelope (\xffsolana offchain | version | format | len | message). This caused authorized Ledger users to receive 403 Unauthorized when creating reward codes, since verification was only attempted against the raw message bytes. verifySignature now tries the raw message first (hot-wallet path) and falls back to the wrapped envelope across all three message formats. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
403 Unauthorizedwhen callingPOST /v1/rewards/code.\xffsolana offchain | version | format | len | message). The signature is valid, but valid for the wrapped bytes, not the raw timestamp string we were comparing against.verifySignaturenow tries the raw message first (hot-wallet path, unchanged) and falls back to the SIMD-0048 envelope across all three message formats (0=ASCII, 1=limited UTF-8, 2=extended UTF-8) since wallet implementations vary.Test plan
go test ./api/ -run 'TestVerifySignature'— new subtest verifies wrapped-signature acceptance for all three formats; existing negative tests still pass.🤖 Generated with Claude Code