{"eip":2844,"title":"Add DID related methods to the JSON-RPC","description":"Add new methods to the JSON-RPC for signing and decrypting JOSE objects under a new did prefix.","authors":["Joel Thorstensson (@oed)"],"status":"Stagnant","type":"Standards Track","category":"Interface","created":"2020-08-01","discussionsTo":"https://github.com/ethereum/EIPs/issues/2845","repo":"EIPs","label":"EIP-2844","officialUrl":"https://eips.ethereum.org/EIPS/eip-2844","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2844.md","url":"https://eips.huatuo.xyz/eip-2844/","tldr":{"en":"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.","ja":"did_* JSON-RPC メソッドの提案。ウォレットが分散型識別子（DID）の認証、JWS の署名、JWE の復号を行えるようにし、標準的な DID と JOSE の形式を Ethereum ウォレットにもたらす。","ko":"지갑이 탈중앙화 식별자(DID)를 인증하고 JWS에 서명하며 JWE를 복호화할 수 있도록 did_* JSON-RPC 메서드를 제안해, 표준 DID와 JOSE 형식을 이더리움 지갑에 가져온다.","zh":"提议新增 did_* JSON-RPC 方法，让钱包能够认证去中心化标识符（DID）、签署 JWS 并解密 JWE，把标准的 DID 和 JOSE 格式带入以太坊钱包。"},"tags":["json-rpc","identity","did","wallet","encryption"],"explainers":{"en":{"lang":"en","tldr":"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.","tags":["json-rpc","identity","did","wallet","encryption"],"related":[1193,1056,4361,1474],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-2844/","markdown":"## What problem does it solve?\n\nWallets 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.\n\nThe 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.\n\n## How it works\n\nThree new JSON-RPC methods under a `did_` prefix:\n\n| Method | Params | Returns |\n| --- | --- | --- |\n| `did_authenticate` | `nonce`, `aud`, `paths[]` | A JWS (general serialization) containing `nonce`, `did`, `paths`, `exp`, optional `aud` |\n| `did_createJWS` | `payload`, `protected`, `did`, `revocable` | `{ jws }` |\n| `did_decryptJWE` | `jwe`, `did` | `{ cleartext }` (base64pad-encoded) |\n\nHighlights:\n\n- **Authentication** asks the user to grant the current connection access to their DID and a set of permission `paths` such as `/some/permission`.\n- **Signing**: the protected header should carry a `kid` identifying the DID and key fragment. With `revocable: false`, the `kid` pins a specific DID-document version so the signature survives key rotation. Recommended curves are `secp256k1` or `ed25519`.\n- **Decryption**: if the decrypted payload contains a `paths` array matching a path already granted via `did_authenticate`, the wallet may decrypt without prompting again. Recommended algorithms are `xchacha20poly1305` with `x25519` key agreement.\n\nThe EIP does not mandate any DID method or JOSE algorithm; wallets choose what to support.\n\n## Sample code\n\nA `did_authenticate` request and a `did_createJWS` request over an [EIP-1193](/eip-1193/) provider (illustrative: the EIP lists the parameter fields but not the exact JSON-RPC framing):\n\n```ts\nconst auth = await provider.request({\n  method: \"did_authenticate\",\n  params: {\n    nonce: crypto.randomUUID(),\n    aud: \"https://app.example\",\n    paths: [\"/notes\"],\n  },\n});\n// auth is a general-serialization JWS; verify it and read `did`\n\nconst { jws } = await provider.request({\n  method: \"did_createJWS\",\n  params: {\n    payload: { hello: \"world\" },\n    protected: {},\n    did: \"did:key:z6Mk...\",\n    revocable: false,\n  },\n});\n```\n\n## Things to know\n\n- **Status: Stagnant.** The methods never became a finalized standard; do not assume a provider supports `did_*`.\n- The permission model is intentionally only a suggestion; how and when to prompt users is left to the wallet.\n- JOSE and DID security are delegated to those standards and are not analysed in the EIP.\n- For signing a user into an app with their Ethereum account, [ERC-4361](/eip-4361/) (Sign-In with Ethereum) is the Final standard. On-chain DID registries such as [ERC-1056](/eip-1056/) address the identity side.\n"},"ja":{"lang":"ja","tldr":"did_* JSON-RPC メソッドの提案。ウォレットが分散型識別子（DID）の認証、JWS の署名、JWE の復号を行えるようにし、標準的な DID と JOSE の形式を Ethereum ウォレットにもたらす。","tags":["json-rpc","identity","did","wallet","encryption"],"related":[1193,1056,4361,1474],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-2844/","markdown":"## 何を解決するのか\n\nウォレットは Ethereum のメッセージに署名できますが、**暗号化**や**標準的な Web トークン**を求めるアプリには、使いやすいウォレット API がありませんでした。以前の取り組み（`eth_decrypt` 型のアプローチ）は、`x25519-xsalsa20-poly1305` の暗号文に独自の形式を使っており、さらに根本的な欠陥がありました。誰かの Ethereum アドレスを知っていても、その人の暗号化用公開鍵を見つけることはできないのです。\n\nW3C の**分散型識別子（DID）**標準は、この発見の問題を解決します。DID は、公開鍵を列挙した DID ドキュメントに解決されます。IETF の **JOSE** ファミリー（署名の JWS、暗号化の JWE）は、既存のツールがすでに理解している標準形式を提供します。EIP-2844 は、ウォレットがその両方を扱えるようにすることを提案します。\n\n## 仕組み\n\n`did_` プレフィックスの付いた JSON-RPC メソッドが 3 つ新設されます。\n\n| メソッド | パラメーター | 戻り値 |\n| --- | --- | --- |\n| `did_authenticate` | `nonce`, `aud`, `paths[]` | `nonce`、`did`、`paths`、`exp`、任意の `aud` を含む JWS（general serialization） |\n| `did_createJWS` | `payload`, `protected`, `did`, `revocable` | `{ jws }` |\n| `did_decryptJWE` | `jwe`, `did` | `{ cleartext }`（base64pad エンコード） |\n\nポイント:\n\n- **認証**では、現在の接続に対して、ユーザーの DID と、`/some/permission` のような権限 `paths` の集合へのアクセスを許可するようユーザーに求めます。\n- **署名**: protected ヘッダーには、DID と鍵のフラグメントを示す `kid` を含めるべきです。`revocable: false` の場合、`kid` は特定の DID ドキュメントのバージョンを固定するため、鍵がローテーションされても署名は有効なままです。推奨される曲線は `secp256k1` または `ed25519` です。\n- **復号**: 復号されたペイロードに、`did_authenticate` ですでに許可された path と一致する `paths` 配列が含まれていれば、ウォレットは再度確認を求めずに復号してもかまいません。推奨されるアルゴリズムは、`x25519` の鍵共有による `xchacha20poly1305` です。\n\nこの EIP は、特定の DID メソッドや JOSE アルゴリズムを義務付けていません。ウォレットが対応するものを選びます。\n\n## サンプルコード\n\n[EIP-1193](/eip-1193/) プロバイダー経由の `did_authenticate` リクエストと `did_createJWS` リクエスト（説明用: EIP はパラメーターのフィールドを列挙していますが、JSON-RPC の正確なフレーミングは示していません）:\n\n```ts\nconst auth = await provider.request({\n  method: \"did_authenticate\",\n  params: {\n    nonce: crypto.randomUUID(),\n    aud: \"https://app.example\",\n    paths: [\"/notes\"],\n  },\n});\n// auth is a general-serialization JWS; verify it and read `did`\n\nconst { jws } = await provider.request({\n  method: \"did_createJWS\",\n  params: {\n    payload: { hello: \"world\" },\n    protected: {},\n    did: \"did:key:z6Mk...\",\n    revocable: false,\n  },\n});\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant（停滞）。** これらのメソッドは確定した標準にはなりませんでした。プロバイダーが `did_*` に対応していると仮定しないでください。\n- 権限モデルは意図的に提案にとどまっています。いつ、どのようにユーザーに確認するかはウォレットに委ねられています。\n- JOSE と DID のセキュリティはそれらの標準に委ねられており、この EIP では分析されていません。\n- ユーザーを Ethereum アカウントでアプリにサインインさせる用途には、[ERC-4361](/eip-4361/)（Sign-In with Ethereum）が Final の標準です。[ERC-1056](/eip-1056/) のようなオンチェーン DID レジストリは、アイデンティティの側面を扱います。\n"},"ko":{"lang":"ko","tldr":"지갑이 탈중앙화 식별자(DID)를 인증하고 JWS에 서명하며 JWE를 복호화할 수 있도록 did_* JSON-RPC 메서드를 제안해, 표준 DID와 JOSE 형식을 이더리움 지갑에 가져온다.","tags":["json-rpc","identity","did","wallet","encryption"],"related":[1193,1056,4361,1474],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-2844/","markdown":"## 어떤 문제를 해결하나요?\n\n지갑은 이더리움 메시지에 서명할 수 있지만, **암호화**나 **표준 웹 토큰**을 원하는 앱에는 쓸 만한 지갑 API가 없었습니다. 이전의 시도(`eth_decrypt` 방식)는 `x25519-xsalsa20-poly1305` 암호문에 독자적인 형식을 썼고, 더 근본적인 결함도 있었습니다. 누군가의 이더리움 주소를 안다고 해서 그 사람의 암호화용 공개 키를 찾을 수는 없다는 점입니다.\n\nW3C의 **탈중앙화 식별자(DID)** 표준은 이 탐색 문제를 해결합니다. DID는 공개 키를 나열한 DID 문서로 확인(resolve)됩니다. IETF의 **JOSE** 계열(서명용 JWS, 암호화용 JWE)은 기존 도구가 이미 이해하는 표준 형식을 제공합니다. EIP-2844는 지갑이 이 둘을 모두 다룰 수 있게 하자고 제안합니다.\n\n## 어떻게 동작하나요?\n\n`did_` 접두사가 붙은 JSON-RPC 메서드 세 개가 새로 생깁니다.\n\n| 메서드 | 파라미터 | 반환값 |\n| --- | --- | --- |\n| `did_authenticate` | `nonce`, `aud`, `paths[]` | `nonce`, `did`, `paths`, `exp`, 선택적 `aud`를 담은 JWS(general serialization) |\n| `did_createJWS` | `payload`, `protected`, `did`, `revocable` | `{ jws }` |\n| `did_decryptJWE` | `jwe`, `did` | `{ cleartext }`(base64pad 인코딩) |\n\n핵심 내용:\n\n- **인증**은 사용자에게 현재 연결이 자신의 DID와 `/some/permission` 같은 권한 `paths` 집합에 접근하도록 허용해 달라고 요청합니다.\n- **서명**: protected 헤더에는 DID와 키 조각을 나타내는 `kid`가 있어야 합니다. `revocable: false`이면 `kid`가 특정 DID 문서 버전을 고정하므로, 키가 교체되어도 서명이 유효하게 남습니다. 권장 곡선은 `secp256k1` 또는 `ed25519`입니다.\n- **복호화**: 복호화된 페이로드에 `did_authenticate`로 이미 허용된 경로와 일치하는 `paths` 배열이 있으면, 지갑은 다시 묻지 않고 복호화할 수 있습니다. 권장 알고리즘은 `x25519` 키 합의를 쓰는 `xchacha20poly1305`입니다.\n\n이 EIP는 특정 DID 메서드나 JOSE 알고리즘을 강제하지 않으며, 지갑이 지원할 것을 선택합니다.\n\n## 샘플 코드\n\n[EIP-1193](/eip-1193/) 프로바이더를 통한 `did_authenticate` 요청과 `did_createJWS` 요청(설명용: EIP는 파라미터 필드를 나열하지만 정확한 JSON-RPC 프레이밍은 제시하지 않습니다):\n\n```ts\nconst auth = await provider.request({\n  method: \"did_authenticate\",\n  params: {\n    nonce: crypto.randomUUID(),\n    aud: \"https://app.example\",\n    paths: [\"/notes\"],\n  },\n});\n// auth is a general-serialization JWS; verify it and read `did`\n\nconst { jws } = await provider.request({\n  method: \"did_createJWS\",\n  params: {\n    payload: { hello: \"world\" },\n    protected: {},\n    did: \"did:key:z6Mk...\",\n    revocable: false,\n  },\n});\n```\n\n## 알아둘 점\n\n- **상태: Stagnant(정체).** 이 메서드들은 확정된 표준이 된 적이 없습니다. 프로바이더가 `did_*`를 지원한다고 가정하지 마세요.\n- 권한 모델은 의도적으로 제안일 뿐이며, 사용자에게 언제 어떻게 묻는지는 지갑에 맡겨져 있습니다.\n- JOSE와 DID의 보안은 해당 표준에 위임되어 있으며 이 EIP에서 분석하지 않습니다.\n- 이더리움 계정으로 사용자를 앱에 로그인시키려면 [ERC-4361](/eip-4361/)(Sign-In with Ethereum)이 Final 표준입니다. [ERC-1056](/eip-1056/) 같은 온체인 DID 레지스트리는 아이덴티티 쪽을 다룹니다.\n"},"zh":{"lang":"zh","tldr":"提议新增 did_* JSON-RPC 方法，让钱包能够认证去中心化标识符（DID）、签署 JWS 并解密 JWE，把标准的 DID 和 JOSE 格式带入以太坊钱包。","tags":["json-rpc","identity","did","wallet","encryption"],"related":[1193,1056,4361,1474],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-2844/","markdown":"## 它解决什么问题？\n\n钱包可以对以太坊消息签名，但需要**加密**或**标准网络令牌**的应用此前没有好用的钱包 API。早先的尝试（`eth_decrypt` 式的做法）为 `x25519-xsalsa20-poly1305` 密文使用了自定义格式，而且还有更深层的缺陷：知道某人的以太坊地址，并不能让你找到他的加密公钥。\n\nW3C 的**去中心化标识符（DID）**标准解决了发现问题：一个 DID 可以解析为列出公钥的 DID 文档。IETF 的 **JOSE** 系列（用于签名的 JWS、用于加密的 JWE）提供了现有工具已经理解的标准格式。EIP-2844 提议让钱包同时支持这两者。\n\n## 它如何运作\n\n三个以 `did_` 为前缀的新 JSON-RPC 方法：\n\n| 方法 | 参数 | 返回 |\n| --- | --- | --- |\n| `did_authenticate` | `nonce`, `aud`, `paths[]` | 一个 JWS（general serialization），包含 `nonce`、`did`、`paths`、`exp` 和可选的 `aud` |\n| `did_createJWS` | `payload`, `protected`, `did`, `revocable` | `{ jws }` |\n| `did_decryptJWE` | `jwe`, `did` | `{ cleartext }`（base64pad 编码） |\n\n要点：\n\n- **认证**会请用户授予当前连接对其 DID 的访问权限，以及一组权限 `paths`，例如 `/some/permission`。\n- **签名**：protected 头部应当携带标识 DID 和密钥片段的 `kid`。当 `revocable: false` 时，`kid` 会固定某个特定的 DID 文档版本，因此签名在密钥轮换后依然有效。推荐的曲线是 `secp256k1` 或 `ed25519`。\n- **解密**：如果解密后的载荷包含的 `paths` 数组与已通过 `did_authenticate` 授予的路径匹配，钱包可以不再次提示就进行解密。推荐的算法是使用 `x25519` 密钥协商的 `xchacha20poly1305`。\n\n该 EIP 不强制要求任何 DID 方法或 JOSE 算法；由钱包选择支持什么。\n\n## 示例代码\n\n通过 [EIP-1193](/eip-1193/) provider 发出的 `did_authenticate` 请求和 `did_createJWS` 请求（示意性质：该 EIP 列出了参数字段，但没有给出确切的 JSON-RPC 封装）：\n\n```ts\nconst auth = await provider.request({\n  method: \"did_authenticate\",\n  params: {\n    nonce: crypto.randomUUID(),\n    aud: \"https://app.example\",\n    paths: [\"/notes\"],\n  },\n});\n// auth is a general-serialization JWS; verify it and read `did`\n\nconst { jws } = await provider.request({\n  method: \"did_createJWS\",\n  params: {\n    payload: { hello: \"world\" },\n    protected: {},\n    did: \"did:key:z6Mk...\",\n    revocable: false,\n  },\n});\n```\n\n## 需要注意\n\n- **状态：Stagnant（停滞）。** 这些方法从未成为最终确定的标准；不要假定 provider 支持 `did_*`。\n- 权限模型有意只是一个建议；何时以及如何提示用户，由钱包自行决定。\n- JOSE 和 DID 的安全性交由这些标准负责，该 EIP 中没有对其进行分析。\n- 若要用以太坊账户让用户登录应用，[ERC-4361](/eip-4361/)（Sign-In with Ethereum）是已 Final 的标准。像 [ERC-1056](/eip-1056/) 这样的链上 DID 注册表则处理身份方面的问题。\n"}}}
