core icon indicating copy to clipboard operation
core copied to clipboard

Migrate cryptography to noble

Open danfinlay opened this issue 3 years ago • 2 comments

https://medium.com/nomic-labs-blog/a-safer-smaller-and-faster-ethereum-cryptography-stack-5eeb47f62d79

This would be for our key management, and could also be used for our hashing. Has fantastically reduced dependency load and bundle size, it's looking like the new gold standard in JS Eth crypto.

danfinlay avatar Jan 26 '22 19:01 danfinlay

@mcmire Pinging for you to take a look and post an update on this issue.

desi avatar Apr 22 '24 18:04 desi

It appears that ethereum-cryptography v1 started using the noble and scure packages (that's what the linked article is about), and v2 switched from noble-secp256k1 to noble-curves.

That said, of course, we don't need to use ethereum-cryptography, we can just use the noble and scure packages directly.

Many of our packages do this already. As of this writing, these packages are:

  • @metamask/key-tree
  • @metamask/message-signing-snaps
  • @metamask/rpc-methods
  • @metamask/snaps-registry
  • @metamask/snaps-rpc-methods
  • @metamask/snaps-utils
  • @metamask/utils

Packages that still use ethereum-cryptography directly are:

  • @metamask/accounts-controller
  • @metamask/eth-hd-keyring
  • @metamask/eth-sig-util
  • @metamask/eth-simple-keyring

We should probably make separate tickets for the last three, but @metamask/accounts-controller is in this repo (core), so it definitely applies.

Here are some related tickets in other repos:

  • Extension
    • https://github.com/MetaMask/metamask-extension/issues/14928
    • https://github.com/MetaMask/metamask-extension/issues/15904

mcmire avatar Apr 25 '24 22:04 mcmire