Skip to content

perf(mobile): derive public keys with native libsecp256k1 - #8655

Open
brow wants to merge 1 commit into
mainfrom
mobile-native-pubkey-derivation
Open

brow wants to merge 1 commit into
mainfrom
mobile-native-pubkey-derivation

Conversation

@brow

@brow brow commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Follows #8654.

Deriving an x-only public key from a secret key with nostr.Keys(secret).public costs about 5.6 ms in pure Dart on an iPhone SE (2nd gen, Profile). The app does it in 10 places, including relay config, the signed-event relay's pubkey getter, push lease checks, status updates, and the settings identity row's build method. This routes all of them through derivePublicKeyHex from #8654, which takes 16.5 µs on the same device.

Behavior is unchanged for valid keys: output is the same lowercase hex. For a malformed or out-of-range key the thrown type changes from nostr's InvalidKeyException to ArgumentError; every affected site either catches all errors or rethrows its own FormatException/StateError, and nothing in lib or test matches on the old type.

Sites that need a full nostr.Keys object (key generation, AccountIdentityStore) are unchanged.

Validation

buzz-review-completed (agent review, Codex and security review clean; device validation above; human app test not applicable under the mobile testing exception)

🤖 Generated with Claude Code

@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-28T23:33:32.186814Z 4f36965 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. 🚀

Reviewed commit: 58bf4c40f1

ℹ️ 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".

Base automatically changed from mobile-native-secp256k1 to main October 28, 2026 23:28
Replace the pure-Dart nostr.Keys(secret).public derivations (about 5.6 ms
each on an iPhone SE) with derivePublicKeyHex, including the one in the
settings identity row's build method.

Co-authored-by: george <973be878edd6d4f79692a3827f20a6f7fe0ed0362f269ff6b6ba8867033d7d8e@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Tom Brow <tomb@block.xyz>
@brow
brow force-pushed the mobile-native-pubkey-derivation branch from 58bf4c4 to 4f36965 Compare October 28, 2026 23:30
@brow
brow marked this pull request as ready for review October 28, 2026 23:30
@brow

brow commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@brow
brow requested a review from a team as a code owner October 28, 2026 23:30
@brow
brow deployed to codex-review October 28, 2026 23:31 — with GitHub Actions Active
@github-actions github-actions Bot added the codex-security-review-current The posted Codex security review matches its recorded range. label Oct 28, 2026
@github-actions

Copy link
Copy Markdown

🔐 Codex Security Review

Note: This is an automated, security-focused review generated by Codex.
Use it as a supplement to human review; false positives are possible.

Scope

  • Exact PR diff: 4ff02bf03b73b6e07ac45beca833652e0272478a...4f369657c48fee342fe79a656e3631421d59002b
  • Model: gpt-6.1-sol

💡 Click "edited" above to see earlier reviews for this PR.


Review Summary

Overall Risk: NONE

No concrete security, correctness, or reliability regressions identified in the authorized PR range.

Findings

No concrete security, correctness, or reliability findings were identified.

Notes

  • Review used read-only source, history, and test inspection. Builds and tests were not executed, as requested.

Generated by Codex Security Review |
Requested by: @brow |
Workflow run

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 4f369657c4

ℹ️ 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 was successfully deployed

1 active deployment
codex-review — 4f369657 Deployed Oct 28, 2026 by brow via Run Codex Security Review #10340
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex-security-review-current The posted Codex security review matches its recorded range.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant