MetaMask / MetaMask/metamask-extension

Encrypt/decrypt cleanup: change encrypt data type from hex string to eth-sig-util object

Open
#8,152 0 comments 0 reactions 1 assignee Claimed by @jennypollack View on GitHub
type-refactor
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

Currently, `eth_decrypt` expects the encrypted data to be a hex string. We believe this was done because the implementer copied the `normalizeMsgData` function from existing message controllers.

However, `eth_decrypt` ultimately calls the `decrypt` function of `eth-sig-util`, which expects an object of the following form:

```javascript
export interface EthEncryptedData {
version: string;
nonce: string;
ephemPublicKey: string;
ciphertext: string;
}
```

This is also what's output by `eth-sig-util`'s `encrypt` function. Currently, this output has to be turned into a hex string, only to be converted back to an `EthEncryptedData` somewhere in the extension. We should expect `EthEncryptedData` at every step of `eth_decrypt` message handling.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.