EIP-2844 · Stagnant · Interface · 2020-08-01
EIP-2844: Add DID related methods to the JSON-RPC
Proposed did_* JSON-RPC methods so wallets can authenticate a Decentralized Identifier, sign JWS and decrypt JWE, bringing standard DID and JOSE formats to Ethereum wallets.
What problem does it solve?
Wallets can sign Ethereum messages, but apps that want encryption or standard web tokens had no good wallet API. An earlier effort (the eth_decrypt style approach) used a custom format for x25519-xsalsa20-poly1305 ciphertexts and had a deeper flaw: knowing someone's Ethereum address does not let you find their encryption public key.
The W3C Decentralized Identifier (DID) standard solves discovery: a DID resolves to a DID document listing public keys. The IETF JOSE family (JWS for signatures, JWE for encryption) gives standard formats that existing tooling already understands. EIP-2844 proposes letting wallets speak both.
How it works
Three new JSON-RPC methods under a did_ prefix:
| Method | Params | Returns |
|---|---|---|
did_authenticate |
nonce, aud, paths[] |
A JWS (general serialization) containing nonce, did, paths, exp, optional aud |
did_createJWS |
payload, protected, did, revocable |
{ jws } |
did_decryptJWE |
jwe, did |
{ cleartext } (base64pad-encoded) |
Highlights:
- Authentication asks the user to grant the current connection access to their DID and a set of permission
pathssuch as/some/permission. - Signing: the protected header should carry a
kididentifying the DID and key fragment. Withrevocable: false, thekidpins a specific DID-document version so the signature survives key rotation. Recommended curves aresecp256k1ored25519. - Decryption: if the decrypted payload contains a
pathsarray matching a path already granted viadid_authenticate, the wallet may decrypt without prompting again. Recommended algorithms arexchacha20poly1305withx25519key agreement.
The EIP does not mandate any DID method or JOSE algorithm; wallets choose what to support.
Sample code
A did_authenticate request and a did_createJWS request over an EIP-1193 provider (illustrative: the EIP lists the parameter fields but not the exact JSON-RPC framing):
const auth = await provider.request({
method: "did_authenticate",
params: {
nonce: crypto.randomUUID(),
aud: "https://app.example",
paths: ["/notes"],
},
});
// auth is a general-serialization JWS; verify it and read `did`
const { jws } = await provider.request({
method: "did_createJWS",
params: {
payload: { hello: "world" },
protected: {},
did: "did:key:z6Mk...",
revocable: false,
},
});
Things to know
- Status: Stagnant. The methods never became a finalized standard; do not assume a provider supports
did_*. - The permission model is intentionally only a suggestion; how and when to prompt users is left to the wallet.
- JOSE and DID security are delegated to those standards and are not analysed in the EIP.
- For signing a user into an app with their Ethereum account, ERC-4361 (Sign-In with Ethereum) is the Final standard. On-chain DID registries such as ERC-1056 address the identity side.