EIP-2844 Adding DID methods to JSON-RPC (Add DID related methods to the JSON-RPC)
No call decision · Security & privacy · EIP status Stagnant · created 2020-08-01
Adds three methods, did_authenticate, did_createJWS, and did_decryptJWE, to JSON-RPC so that wallets can handle signing and encryption using DID (Decentralized Identifier) and the JOSE standard.
Why it is needed
There have been previous attempts to add decryption capability to Ethereum wallets (#130, #1098), but they encoded x25519-xsalsa20-poly1305 data in a non-standard way, and there was no way to find a counterparty's encryption public key when only their Ethereum address was known. In contrast, the W3C DID standard always lets you locate a document containing the public key once you know a single DID, and JOSE expresses signed and encrypted data in a standard format. Since implementations such as did:ethr and did:3 are already in use and work connecting DID and JOSE is underway, wallets that support these two standards can handle everything from traditional JWT authentication to new use cases such as Secure Data Store and IPFS encrypted data.
What changes
Today
- Wallet encryption is only possible via a non-standard approach (custom x25519-xsalsa20-poly1305 encoding)
- An Ethereum address alone cannot be used to find a counterparty's encryption public key
- There is no official way to connect the DID and JOSE standards with wallets
After EIP-2844
- did_authenticate lets an app request access to a user's DID and a specific path
- did_createJWS lets a wallet produce a JOSE-standard signature (JWS)
- did_decryptJWE lets a wallet decrypt JOSE-standard ciphertext (JWE)
- Anyone can look up a counterparty's public key via the DID document
Who is affected
- Wallet developers: The three methods did_authenticate, did_createJWS, and did_decryptJWE, along with path-based permission checking logic, must be implemented.
- App/dApp developers: Looking up a user's DID, signing data (JWS), and decrypting ciphertext (JWE) can be requested via standard JSON-RPC calls.
- DID ecosystem implementations: Existing DID methods such as did:ethr and did:3 gain a common interface for interoperating with wallets.
In depth
Overview of the three methods
This EIP defines three methods under the new did_* prefix: did_authenticate, did_createJWS, and did_decryptJWE. None of the three methods mandate a specific DID method or JOSE algorithm, leaving the concrete implementation up to the wallet.
did_authenticate
The parameters are nonce (a challenge string), aud (the intended recipient of the response), and paths (an array of strings). The wallet asks the user whether to allow the current connection access to the DID and the given paths, and if approved, returns a general-serialization JWS containing nonce, did, paths, exp (expiration Unix timestamp), and aud. The protected header additionally includes a kid indicating the DID and the keyFragment used.
did_createJWS
The parameters are payload (a JSON object or base64url string), protected (a JSON object header), did (the DID to sign with, which may include a key fragment), and revocable (default false). The return value is a JWS in the jws property. If revocable is false, the signature must be irrevocable (some methods, such as did:key, are always this way), and for methods that support key rotation, if revocable is true, the kid must not include a version-id. secp256k1 is recommended as the signing algorithm, with ed25519 as an alternative.
did_decryptJWE
The parameters are jwe (a general-serialization JWE string) and did. The return value is plaintext encoded as base64pad in the cleartext property. If the decrypted plaintext contains a paths array and one of them matches a path already approved via did_authenticate, decryption proceeds without user confirmation. xchacha20poly1305 is recommended as the encryption algorithm, with x25519 for key exchange.
Path-based permission system
Clients request permissions in units of path prefixes such as /some/permission. If the decrypted JWE plaintext has no paths property, the wallet can ask the user for approval every time; if it has paths, decryption proceeds automatically when they match an already approved prefix. This approach draws on existing discussions but is designed to avoid the data-dependency problems of pinning permissions to an origin (source domain).
Security considerations
Since JOSE and DID themselves are already well-established, proven standards, this document does not separately address their security. secp256k1, already used in Ethereum, is recommended for signing, and xchacha20poly1305, also used in TLS, is recommended for decryption. The permission system proposed by this EIP is the most important security consideration, but the specific threat model and detailed behavior are left to each wallet implementation's choice.
Current status
This EIP is classified as Stagnant, so active discussion is not ongoing. The specification itself has been tested through implementations such as IdentityWallet, key-did-provider-ed25519, js-did, and MinimalCipher.