MetaMask / MetaMask/metamask-extension

[Bug]: when rejecting the `eth_getEncryptionPublicKey` JSON-RPC method it does not return 4001

Open
#24,227 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

INVALID-ISSUE-TEMPLATE Sev2-normal stale team-wallet-api-platform-deprecated type-bug
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

### Describe the bug

I wrote a rule for the API Spec Test that expects all the confirmations to reject with 4001 and this method fails.

### Expected behavior

When rejecting I should see the response:

```json
{
"id": 10,
"jsonrpc": "2.0",
"error": {
"code": 4001,
"message": "User rejected the request."
}
}
```

### Screenshots/Recordings

![image](https://github.com/MetaMask/metamask-extension/assets/364566/a3c060c9-4216-4cec-9eb1-643d2f8c092f)

### Steps to reproduce

1. send a request to `eth_getEncryptionPublicKey`
2. hit reject
3. see the error below

### Error messages or log output

```json
{
"id": 10,
"jsonrpc": "2.0",
"error": {
"code": -32603,
"data": {
"originalError": {}
},
"message": "MetaMask EncryptionPublicKey: User denied message EncryptionPublicKey."
}
}
```

### Version

sj/api-spec-tests

### Build type

Other (please specify exactly where you obtained this build in "Additional Context" section)

### Browser

Chrome

### Operating system

MacOS

### Additional context

test build

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the API Spec Test rule for eth_getEncryptionPublicKey and trace the rejection handling for this JSON-RPC method. Compare its response with the expected 4001 error and the observed -32603 error. Done means a rejected request returns code 4001 with the specified message.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.