Skip to content

perf(mobile): verify signatures with native libsecp256k1 - #8657

Draft
brow wants to merge 1 commit into
mobile-native-ecdhfrom
mobile-native-verify
Draft

brow wants to merge 1 commit into
mobile-native-ecdhfrom
mobile-native-verify

Conversation

@brow

@brow brow commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #8656.

The app already verifies signatures in a few places: NIP-OA agent profiles and owner attestations, Solo me_* records (agent inventory, archived agents, assistants, sync), and pairing events. Each used nostr.Event.fromJson's pure-Dart BIP-340 verify, about 11.2 ms per event on an iPhone SE (2nd gen, Profile). This routes them through verifiedNostrEventFromJson and verifySchnorrHex, which keep the same checks (timestamp range, canonical id, Schnorr signature) and the same nostr exception types, with the signature check in libsecp256k1 (40 µs). NIP-OA owner authorizations are now signed with signSchnorrHex, which removes the last pure-Dart Schnorr call in lib.

Incoming relay events are still not verified; that stays a separate decision.

Validation

  • Added tests: the native verifier accepts a valid event and rejects tampered content, a wrong signature, a different pubkey, malformed and short signatures, and a zero timestamp, each also rejected by the pure-Dart verifier. Hex Schnorr helpers are checked in both directions against nostr.Schnorr.
  • Focused existing validation: crypto, NIP-OA, Solo/me, pairing and agent tests pass. The full mobile analyze and test suite pass.

🤖 Generated with Claude Code

Route the existing pure-Dart signature checks (NIP-OA profiles and owner
attestations, Solo me_* records, pairing events) through
verifiedNostrEventFromJson and verifySchnorrHex, and sign NIP-OA owner
authorizations with signSchnorrHex. Incoming relay events are still not
verified.

Co-authored-by: george <973be878edd6d4f79692a3827f20a6f7fe0ed0362f269ff6b6ba8867033d7d8e@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Tom Brow <tomb@block.xyz>
@brow

brow commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T21:02:20.602099Z e57e3ad Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: e57e3ad86e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

This branch has not been deployed

No deployments
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.

1 participant