MetaMask / MetaMask/eth-sig-util

Additional `version` options for `encrypt` and `decrypt` possible?

Open
#259 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
583
Forks
228
Avg merge
11h 22m
Merged PRs (30d)
7

Description

MetaMask had reached out to GridPlus a few months ago about support for eth_getEncryptionPublicKey and eth_decrypt. We had done some preliminary work but it was deprioritized.

I just looked into this again and we (GridPlus) are unfortunately missing the hardware accelerated crypto that would be needed. Specifically, we only have access to `xchacha20`, whereas NaCl uses `xsalsa20` in the default `box` API, which is what gets used in this code base. Theoretically we could add `libsodium` to our build but I can’t say if, in the end, it will be worth the extra code size (I haven’t tried so idk what the code size would be). Being on a small secure microcontroller, we are always battling against code size limits and we have to be strategic about features, especially if they bring in new libs.

It appears that `libsodium` (and therefore `tweetnacl`, which is used here) is the only crypto lib that uses `salsa` algos and most others use `chacha`. Of course it *also* supports `chacha`, but that is not the **default** algo for box (for legacy reasons). [Here is a post](https://github.com/jedisct1/libsodium/issues/554) asking `libsodium` nicely if they would switch box to use chacha by default, but since it would be a breaking change it got a hard no.

I was wondering if there has been any thought to adding more version options for the `encrypt`/`decrypt` functions in `eth-sig-util`. And if so, is MetaMask able to drive decisions around `eth_decrypt` or would any additional crypto options need to be approved by EIP (or whatever the analog is here — I’m not sure what process formed the standard)?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the existing encrypt and decrypt entry points and how their current version options use tweetnacl's box API. Compare the requested xsalsa20 and chacha-based alternatives, then clarify whether an additional option is technically feasible and what Ethereum standard or approval process would define completion.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cryptography, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.