{"eip":2255,"title":"Wallet Permissions System","description":"An interface to restrict access to sensitive methods","authors":["Dan Finlay (@danfinlay)","Erik Marks (@rekmarks)","Gavin John (@Pandapip1)"],"status":"Final","type":"Standards Track","category":"Interface","created":"2019-08-22","requires":[1193],"discussionsTo":"https://ethereum-magicians.org/t/web3-login-permissions/3583","repo":"EIPs","label":"EIP-2255","officialUrl":"https://eips.ethereum.org/EIPS/eip-2255","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2255.md","url":"https://eips.huatuo.xyz/eip-2255/","tldr":{"en":"Adds wallet_requestPermissions and wallet_getPermissions to the wallet provider API, so a dapp asks once for named permissions (like seeing your accounts) instead of triggering a prompt for every action.","ja":"ウォレットプロバイダー API に wallet_requestPermissions と wallet_getPermissions を追加し、dapp がアクションのたびにプロンプトを出す代わりに、名前付きの権限（アカウントの閲覧など）を一度だけ要求できるようにする。","ko":"지갑 프로바이더 API에 wallet_requestPermissions와 wallet_getPermissions를 추가해, dapp이 모든 동작마다 프롬프트를 띄우는 대신 이름 붙은 권한(예: 계정 보기)을 한 번만 요청하게 한다.","zh":"为钱包提供者 API 增加 wallet_requestPermissions 和 wallet_getPermissions，让 dapp 一次性申请具名权限（例如查看你的账户），而不是每个操作都弹出一次提示。"},"tags":["wallet","permissions","rpc","provider","interface"],"explainers":{"en":{"lang":"en","tldr":"Adds wallet_requestPermissions and wallet_getPermissions to the wallet provider API, so a dapp asks once for named permissions (like seeing your accounts) instead of triggering a prompt for every action.","tags":["wallet","permissions","rpc","provider","interface"],"related":[1193,1102,7715,3085,3326],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-2255/","markdown":"## What problem does it solve?\n\nWallets sit between untrusted websites and the user's keys. The safe default is to prompt for everything, but that makes onboarding a string of popups: reveal your address, switch network, sign a challenge, approve a token, send a transaction.\n\nWeb users know a better pattern from OAuth (\"Sign in with ...\"): one screen listing what the site wants, which the user can approve, reject, or narrow. EIP-2255 brings that model to wallets with a small, generic permissions API.\n\n## How it works\n\nTwo methods on the [EIP-1193](/eip-1193/) provider:\n\n**`wallet_requestPermissions`** takes one object mapping method names to caveat objects:\n\n```ts\ninterface PermissionRequest {\n  [methodName: string]: { [caveatName: string]: any };\n}\n```\n\nThe wallet shows a prompt. If the user approves, it returns an array of `{ parentCapability, date? }`. If the user rejects, it throws an error with code `4001` (user rejected, per EIP-1193).\n\n**`wallet_getPermissions`** takes no parameters and returns the permissions the current site holds (empty by default):\n\n```ts\ninterface Permission {\n  invoker: string;           // origin of the dapp, e.g. \"https://app.example\"\n  parentCapability: string;  // the permitted method, e.g. \"eth_accounts\"\n  caveats: { type: string; value: any }[]; // restrictions on that permission\n}\n```\n\nCalls to a restricted method fail until the matching permission has been granted. **Caveats** let a permission be attenuated; for example, a site could ask only for accounts that support a given signing method, or the user could add an expiry.\n\n## Sample code\n\nAsking for account access explicitly and checking what was granted (browser, EIP-1193 provider):\n\n```ts\nconst provider = (window as any).ethereum;\n\ntry {\n  await provider.request({\n    method: \"wallet_requestPermissions\",\n    params: [{ eth_accounts: {} }],\n  });\n} catch (err: any) {\n  if (err.code === 4001) console.log(\"User rejected the request\");\n  else throw err;\n}\n\nconst permissions = await provider.request({ method: \"wallet_getPermissions\" });\nconst hasAccounts = permissions.some((p: any) =\u003e p.parentCapability === \"eth_accounts\");\n\nif (hasAccounts) {\n  const accounts = await provider.request({ method: \"eth_accounts\" });\n  console.log(accounts);\n}\n```\n\n## Things to know\n\n- Status is **Final**. MetaMask supports both methods; other wallets vary, so feature-detect and fall back to `eth_requestAccounts`.\n- The EIP defines the request and response shapes, not which permissions or caveats exist. Those are wallet-specific.\n- When a wallet shows the site's icon, it should be careful about fetching arbitrary URLs (the spec warns about server-side request forgery).\n- [ERC-7715](/eip-7715/) (Draft) builds on this idea for richer, scoped permissions such as session keys. Related wallet RPCs include [EIP-3085](/eip-3085/) and [EIP-3326](/eip-3326/) for adding and switching chains.\n"},"ja":{"lang":"ja","tldr":"ウォレットプロバイダー API に wallet_requestPermissions と wallet_getPermissions を追加し、dapp がアクションのたびにプロンプトを出す代わりに、名前付きの権限（アカウントの閲覧など）を一度だけ要求できるようにする。","tags":["wallet","permissions","rpc","provider","interface"],"related":[1193,1102,7715,3085,3326],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-2255/","markdown":"## 何を解決するのか\n\nウォレットは、信頼できないウェブサイトとユーザーの鍵の間に立っています。安全なデフォルトはすべてについて確認を求めることですが、そうするとオンボーディングはポップアップの連続になります。アドレスの公開、ネットワークの切り替え、チャレンジへの署名、トークンの承認、トランザクションの送信などです。\n\nウェブのユーザーは OAuth（「～でサインイン」）でより良いパターンを知っています。サイトが求める内容を一覧にした 1 つの画面で、ユーザーは承認、拒否、または範囲の絞り込みができます。EIP-2255 は、小さく汎用的な権限 API によって、このモデルをウォレットに持ち込みます。\n\n## 仕組み\n\n[EIP-1193](/eip-1193/) プロバイダーに 2 つのメソッドを追加します。\n\n**`wallet_requestPermissions`** は、メソッド名を caveat オブジェクトに対応付けた 1 つのオブジェクトを受け取ります。\n\n```ts\ninterface PermissionRequest {\n  [methodName: string]: { [caveatName: string]: any };\n}\n```\n\nウォレットはプロンプトを表示します。ユーザーが承認すると、`{ parentCapability, date? }` の配列を返します。ユーザーが拒否すると、コード `4001`（EIP-1193 でいう user rejected）のエラーを投げます。\n\n**`wallet_getPermissions`** はパラメーターを取らず、現在のサイトが保持している権限を返します（デフォルトは空）。\n\n```ts\ninterface Permission {\n  invoker: string;           // origin of the dapp, e.g. \"https://app.example\"\n  parentCapability: string;  // the permitted method, e.g. \"eth_accounts\"\n  caveats: { type: string; value: any }[]; // restrictions on that permission\n}\n```\n\n制限されたメソッドの呼び出しは、対応する権限が付与されるまで失敗します。**Caveat** によって権限を絞り込めます。たとえば、サイトが特定の署名方式に対応するアカウントだけを要求したり、ユーザーが有効期限を追加したりできます。\n\n## サンプルコード\n\nアカウントへのアクセスを明示的に要求し、何が付与されたかを確認する例（ブラウザ、EIP-1193 プロバイダー）:\n\n```ts\nconst provider = (window as any).ethereum;\n\ntry {\n  await provider.request({\n    method: \"wallet_requestPermissions\",\n    params: [{ eth_accounts: {} }],\n  });\n} catch (err: any) {\n  if (err.code === 4001) console.log(\"User rejected the request\");\n  else throw err;\n}\n\nconst permissions = await provider.request({ method: \"wallet_getPermissions\" });\nconst hasAccounts = permissions.some((p: any) =\u003e p.parentCapability === \"eth_accounts\");\n\nif (hasAccounts) {\n  const accounts = await provider.request({ method: \"eth_accounts\" });\n  console.log(accounts);\n}\n```\n\n## 知っておくべきこと\n\n- ステータスは **Final** です。MetaMask は両方のメソッドに対応しています。他のウォレットは対応状況が異なるため、機能検出を行い、`eth_requestAccounts` にフォールバックしてください。\n- この EIP が定義するのはリクエストとレスポンスの形であり、どの権限や caveat が存在するかではありません。それらはウォレットごとに異なります。\n- ウォレットがサイトのアイコンを表示する場合は、任意の URL を取得することに注意すべきです（仕様はサーバーサイドリクエストフォージェリについて警告しています）。\n- [ERC-7715](/eip-7715/)（Draft）は、この考え方を土台に、セッションキーのようなより豊かでスコープを絞った権限を実現します。関連するウォレット RPC には、チェーンの追加と切り替えを行う [EIP-3085](/eip-3085/) と [EIP-3326](/eip-3326/) があります。\n"},"ko":{"lang":"ko","tldr":"지갑 프로바이더 API에 wallet_requestPermissions와 wallet_getPermissions를 추가해, dapp이 모든 동작마다 프롬프트를 띄우는 대신 이름 붙은 권한(예: 계정 보기)을 한 번만 요청하게 한다.","tags":["wallet","permissions","rpc","provider","interface"],"related":[1193,1102,7715,3085,3326],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-2255/","markdown":"## 어떤 문제를 해결하나요?\n\n지갑은 신뢰할 수 없는 웹사이트와 사용자의 키 사이에 있습니다. 안전한 기본값은 모든 것을 물어보는 것이지만, 그러면 온보딩이 팝업의 연속이 됩니다. 주소 공개, 네트워크 전환, 챌린지 서명, 토큰 승인, 트랜잭션 전송 같은 것들입니다.\n\n웹 사용자는 OAuth(\"~로 로그인\")에서 더 나은 패턴을 알고 있습니다. 사이트가 원하는 것을 나열한 화면 하나에서 사용자가 승인하거나 거부하거나 범위를 좁힐 수 있습니다. EIP-2255는 작고 범용적인 권한 API로 이 모델을 지갑에 가져옵니다.\n\n## 어떻게 동작하나요?\n\n[EIP-1193](/eip-1193/) 프로바이더에 두 가지 메서드가 있습니다.\n\n**`wallet_requestPermissions`**는 메서드 이름을 caveat 객체에 매핑한 객체 하나를 받습니다.\n\n```ts\ninterface PermissionRequest {\n  [methodName: string]: { [caveatName: string]: any };\n}\n```\n\n지갑이 프롬프트를 보여 줍니다. 사용자가 승인하면 `{ parentCapability, date? }` 배열을 반환합니다. 사용자가 거부하면 코드 `4001`(EIP-1193의 user rejected) 오류를 던집니다.\n\n**`wallet_getPermissions`**는 매개변수가 없으며 현재 사이트가 가진 권한을 반환합니다(기본값은 비어 있음).\n\n```ts\ninterface Permission {\n  invoker: string;           // origin of the dapp, e.g. \"https://app.example\"\n  parentCapability: string;  // the permitted method, e.g. \"eth_accounts\"\n  caveats: { type: string; value: any }[]; // restrictions on that permission\n}\n```\n\n제한된 메서드를 호출하면 해당 권한이 부여될 때까지 실패합니다. **Caveat**으로 권한을 좁힐 수 있습니다. 예를 들어 사이트가 특정 서명 방식을 지원하는 계정만 요청하거나, 사용자가 만료 기한을 추가할 수 있습니다.\n\n## 샘플 코드\n\n계정 접근 권한을 명시적으로 요청하고 무엇이 부여되었는지 확인하는 예(브라우저, EIP-1193 프로바이더):\n\n```ts\nconst provider = (window as any).ethereum;\n\ntry {\n  await provider.request({\n    method: \"wallet_requestPermissions\",\n    params: [{ eth_accounts: {} }],\n  });\n} catch (err: any) {\n  if (err.code === 4001) console.log(\"User rejected the request\");\n  else throw err;\n}\n\nconst permissions = await provider.request({ method: \"wallet_getPermissions\" });\nconst hasAccounts = permissions.some((p: any) =\u003e p.parentCapability === \"eth_accounts\");\n\nif (hasAccounts) {\n  const accounts = await provider.request({ method: \"eth_accounts\" });\n  console.log(accounts);\n}\n```\n\n## 알아둘 점\n\n- 상태는 **Final**입니다. MetaMask는 두 메서드를 모두 지원하며, 다른 지갑은 제각각이므로 기능 감지를 하고 `eth_requestAccounts`로 폴백하세요.\n- 이 EIP가 정의하는 것은 요청과 응답의 형태이지, 어떤 권한이나 caveat이 존재하는지가 아닙니다. 그것은 지갑마다 다릅니다.\n- 지갑이 사이트의 아이콘을 보여 줄 때는 임의의 URL을 가져오는 데 주의해야 합니다(명세는 서버 측 요청 위조에 대해 경고합니다).\n- [ERC-7715](/eip-7715/)(Draft)는 이 아이디어를 바탕으로 세션 키 같은 더 풍부하고 범위가 한정된 권한을 제공합니다. 관련된 지갑 RPC로는 체인 추가와 전환을 다루는 [EIP-3085](/eip-3085/)와 [EIP-3326](/eip-3326/)이 있습니다.\n"},"zh":{"lang":"zh","tldr":"为钱包提供者 API 增加 wallet_requestPermissions 和 wallet_getPermissions，让 dapp 一次性申请具名权限（例如查看你的账户），而不是每个操作都弹出一次提示。","tags":["wallet","permissions","rpc","provider","interface"],"related":[1193,1102,7715,3085,3326],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-2255/","markdown":"## 它解决什么问题？\n\n钱包位于不可信的网站和用户的密钥之间。安全的默认做法是凡事都弹窗确认，但这会让新用户上手变成一连串弹窗：暴露你的地址、切换网络、签署挑战、授权代币、发送交易。\n\n网页用户从 OAuth（“使用……登录”）中已经熟悉了更好的模式：一个页面列出网站想要什么，用户可以批准、拒绝或缩小范围。EIP-2255 通过一个小而通用的权限 API，把这种模式带到钱包中。\n\n## 它如何运作\n\n在 [EIP-1193](/eip-1193/) 提供者上增加两个方法：\n\n**`wallet_requestPermissions`** 接受一个把方法名映射到 caveat 对象的对象：\n\n```ts\ninterface PermissionRequest {\n  [methodName: string]: { [caveatName: string]: any };\n}\n```\n\n钱包会显示提示。如果用户批准，它返回一个 `{ parentCapability, date? }` 数组。如果用户拒绝，它会抛出错误码为 `4001` 的错误（按 EIP-1193，表示用户拒绝）。\n\n**`wallet_getPermissions`** 不接受参数，返回当前网站持有的权限（默认为空）：\n\n```ts\ninterface Permission {\n  invoker: string;           // origin of the dapp, e.g. \"https://app.example\"\n  parentCapability: string;  // the permitted method, e.g. \"eth_accounts\"\n  caveats: { type: string; value: any }[]; // restrictions on that permission\n}\n```\n\n在授予相应权限之前，对受限方法的调用都会失败。**Caveat** 可以缩小权限范围；例如，网站可以只请求支持某种签名方法的账户，或者用户可以添加有效期。\n\n## 示例代码\n\n显式请求账户访问权限，并检查授予了什么（浏览器，EIP-1193 提供者）：\n\n```ts\nconst provider = (window as any).ethereum;\n\ntry {\n  await provider.request({\n    method: \"wallet_requestPermissions\",\n    params: [{ eth_accounts: {} }],\n  });\n} catch (err: any) {\n  if (err.code === 4001) console.log(\"User rejected the request\");\n  else throw err;\n}\n\nconst permissions = await provider.request({ method: \"wallet_getPermissions\" });\nconst hasAccounts = permissions.some((p: any) =\u003e p.parentCapability === \"eth_accounts\");\n\nif (hasAccounts) {\n  const accounts = await provider.request({ method: \"eth_accounts\" });\n  console.log(accounts);\n}\n```\n\n## 需要注意\n\n- 状态为 **Final**。MetaMask 支持这两个方法；其他钱包情况不一，所以请做功能检测，并回退到 `eth_requestAccounts`。\n- 该 EIP 定义的是请求和响应的格式，而不是存在哪些权限或 caveat。这些由各钱包自行决定。\n- 钱包显示网站图标时，应当小心获取任意 URL（规范对服务端请求伪造发出了警告）。\n- [ERC-7715](/eip-7715/)（Draft）在这一思路的基础上，提供了更丰富、范围更明确的权限，例如会话密钥。相关的钱包 RPC 还有用于添加和切换链的 [EIP-3085](/eip-3085/) 和 [EIP-3326](/eip-3326/)。\n"}}}
