Skip to content

Make cryptography browser/mobile ready - #12

Merged
mattgle merged 3 commits into
devfrom
feat/aes-browser-mobile
Jun 25, 2026
Merged

mattgle merged 3 commits into
devfrom
feat/aes-browser-mobile

Conversation

@mattgle

@mattgle mattgle commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Removes the two hard browser/mobile blockers so the package runs in browsers and React Native with no Node polyfills (no node:crypto, no Buffer).

  • AES: node:crypto@noble/ciphers
  • Poseidon: circomlibjs WASM backend → pure-JS poseidon-lite
  • EdDSA (BabyJubJub + Poseidon): circomlibjs buildEddsa@iden3/js-crypto
  • @noble/hashes bumped to v2; circomlibjs removed entirely

Wire formats and byte representations are unchanged and verified byte-identical to the previous implementation: AES ciphertext still decrypts, and Poseidon/EdDSA match the canonical circomlibjs reference vectors, so existing wallet keys and signatures continue to verify.

Poseidon and EdDSA are now synchronous, so the async init API (initPoseidon, initializeEddsa, initCircomlib, poseidonBuild) is removed.

@mattgle mattgle self-assigned this Jun 22, 2026
@mattgle
mattgle requested a review from bhflm June 22, 2026 13:31
@mattgle mattgle changed the title Replace node:crypto AES with @noble/ciphers Make cryptography browser- and mobile-ready Jun 23, 2026
@mattgle
mattgle marked this pull request as ready for review June 23, 2026 21:11
@mattgle mattgle changed the title Make cryptography browser- and mobile-ready Make cryptography browser/mobile ready Jun 23, 2026
@simonmasson

Copy link
Copy Markdown
Collaborator

Had a quick review and it seems to be OK. Would be better with noble/curves, but that's for later.

@bhflm bhflm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good but I've found smth else

CryptographyErrorCode has two codes that we might need to removed bc they're not used anymore (```` 'EddsaNotInitialized' | 'PoseidonNotLoaded'```)

also there're a couple of functions that we might need to update from wallet-node?

Image

I think README is outdated too

@mattgle
mattgle force-pushed the feat/aes-browser-mobile branch from 58c5818 to 412c448 Compare June 24, 2026 17:00
@mattgle
mattgle requested a review from bhflm June 24, 2026 17:00
@mattgle

mattgle commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

looks good but I've found smth else

CryptographyErrorCode has two codes that we might need to removed bc they're not used anymore (```` 'EddsaNotInitialized' | 'PoseidonNotLoaded'```)

also there're a couple of functions that we might need to update from wallet-node?

Image I think README is outdated too

Yes we will need to make changes to wallet-node after this PR gets merged. Here's the PR for those changes railgun-reloaded/wallet-node#26

@mattgle
mattgle merged commit 412c448 into dev Jun 25, 2026
1 check passed
@mattgle
mattgle deleted the feat/aes-browser-mobile branch June 25, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants