{"eip":5573,"title":"Sign-In with Ethereum Capabilities, ReCaps","description":"Mechanism on top of Sign-In with Ethereum for informed consent to delegate capabilities with an extensible scope mechanism","authors":["Oliver Terbu (@awoie)","Jacob Ward (@cobward)","Charles Lehner (@clehner)","Sam Gbafa (@skgbafa)","Wayne Chang (@wyc)","Charles Cunningham (@chunningham)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2021-07-20","requires":[4361],"discussionsTo":"https://ethereum-magicians.org/t/eip-5573-siwe-recap/10627","repo":"ERCs","label":"ERC-5573","officialUrl":"https://eips.ethereum.org/EIPS/eip-5573","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5573.md","url":"https://eips.huatuo.xyz/eip-5573/","tldr":{"en":"ReCaps extend Sign-In with Ethereum so one signed message both logs you in and grants an app scoped, human-readable permissions to act on your behalf at other services, like OAuth on top of SIWE.","ja":"ReCap は Sign-In with Ethereum を拡張し、1 つの署名付きメッセージでログインと、他のサービスであなたの代わりに動作するためのスコープ付きで人間が読める権限をアプリに付与することの両方を行う。SIWE の上に載る OAuth のようなもの。","ko":"ReCap은 Sign-In with Ethereum을 확장해, 서명된 메시지 하나로 로그인과 함께 다른 서비스에서 사용자를 대신해 동작할 수 있는 범위 지정형의 사람이 읽을 수 있는 권한을 앱에 부여한다. SIWE 위에 얹은 OAuth와 같다.","zh":"ReCap 扩展了 Sign-In with Ethereum：一条签名消息既能让你登录，又能授予应用有范围限定、人类可读的权限，使其在其他服务上代表你行事，就像建立在 SIWE 之上的 OAuth。"},"tags":["siwe","authorization","capabilities","wallet","offchain"],"explainers":{"en":{"lang":"en","tldr":"ReCaps extend Sign-In with Ethereum so one signed message both logs you in and grants an app scoped, human-readable permissions to act on your behalf at other services, like OAuth on top of SIWE.","tags":["siwe","authorization","capabilities","wallet","offchain"],"related":[4361],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-5573/","markdown":"## What problem does it solve?\n\n[ERC-4361](/eip-4361/) (Sign-In with Ethereum, SIWE) proves to a website that you control an address. That is authentication. But apps often need *authorization* too: permission to read or write your data at a third-party service, such as a storage provider, on your behalf.\n\nWithout a standard, each service invents its own delegation format, and wallets show users opaque blobs. ReCaps add capability-based authorization to the SIWE message, so the user sees exactly what they are granting in plain text and the service can verify it deterministically. The spec compares the pairing to OpenID Connect (SIWE) plus OAuth2 (ReCaps).\n\n## How it works\n\nA **ReCap** is a normal SIWE message with two additions:\n\n1. The **last entry** in `Resources` is a ReCap URI: `urn:recap:` followed by the unpadded base64url encoding of a JSON **Details Object**.\n2. The `statement` ends with an auto-generated, human-readable sentence describing those permissions.\n\nThe Details Object:\n\n- `att`: map of resource URI → map of ability strings (`namespace/ability`, e.g. `crud/update`) → array of restriction objects. `[{}]` means \"allowed, no restrictions\"; an empty array means unusable. Keys must be sorted lexicographically.\n- `prf` (optional): CIDs of parent capabilities, when the signer is not the direct controller of the resource.\n\nThe SIWE `URI` field names the relying party receiving the rights; `Issued At`, `Expiration Time` and `Not Before` bound when they are valid.\n\nThe **translation algorithm** turns `att` into text beginning with `I further authorize the stated URI to perform the following actions on my behalf:` followed by numbered entries per resource and namespace.\n\n**Verification:** check the SIWE signature, decode the last resource as a ReCap, regenerate the statement, and confirm the signed `statement` ends with it. This guarantees the user saw the same permissions that are being enforced.\n\n## Sample code\n\nBuilding a ReCap URI and the matching statement in TypeScript:\n\n```ts\ntype Att = Record\u003cstring, Record\u003cstring, object[]\u003e\u003e;\n\nfunction sortKeys\u003cT extends Record\u003cstring, any\u003e\u003e(o: T): T {\n  return Object.fromEntries(Object.keys(o).sort().map(k =\u003e [k, o[k]])) as T;\n}\n\nexport function buildRecap(att: Att) {\n  const sorted: Att = sortKeys(Object.fromEntries(\n    Object.entries(att).map(([res, abil]) =\u003e [res, sortKeys(abil)]),\n  ));\n  const json = JSON.stringify({ att: sorted });\n  const uri = \"urn:recap:\" + Buffer.from(json).toString(\"base64url\"); // unpadded\n\n  let n = 1;\n  let text = \"I further authorize the stated URI to perform the following actions on my behalf:\";\n  for (const [resource, abilities] of Object.entries(sorted)) {\n    const byNs: Record\u003cstring, string[]\u003e = {};\n    for (const key of Object.keys(abilities)) {\n      const [ns, name] = key.split(\"/\");\n      (byNs[ns] ??= []).push(name);\n    }\n    for (const [ns, names] of Object.entries(byNs)) {\n      text += ` (${n++}) '${ns}': ${names.map(x =\u003e `'${x}'`).join(\", \")} for '${resource}'.`;\n    }\n  }\n  return { uri, statement: text };\n}\n\n// buildRecap({ \"https://example.com/pictures/\": { \"crud/update\": [{}], \"crud/delete\": [{}] } })\n// statement: \"... (1) 'crud': 'delete', 'update' for 'https://example.com/pictures/'.\"\n```\n\nPlace `uri` as the final `Resources` entry and append `statement` to any existing SIWE statement.\n\n## Things to know\n\n- **Status: Draft.** Several sections (implementer's guide, rationale) are still marked TBD.\n- A ReCap is not a bearer token. The resource service must still authenticate the relying party separately; how is out of scope.\n- What each ability and restriction means is defined by each resource service, not by this standard.\n- Ordering rules matter: a differently ordered `att` produces a different URI and statement, and verification will fail.\n"},"ja":{"lang":"ja","tldr":"ReCap は Sign-In with Ethereum を拡張し、1 つの署名付きメッセージでログインと、他のサービスであなたの代わりに動作するためのスコープ付きで人間が読める権限をアプリに付与することの両方を行う。SIWE の上に載る OAuth のようなもの。","tags":["siwe","authorization","capabilities","wallet","offchain"],"related":[4361],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-5573/","markdown":"## 何を解決するのか\n\n[ERC-4361](/eip-4361/)（Sign-In with Ethereum、SIWE）は、あなたがあるアドレスを管理していることをウェブサイトに証明します。これは認証です。しかしアプリは*認可*も必要とすることがよくあります。ストレージプロバイダーなどのサードパーティサービスで、あなたの代わりにデータを読み書きする権限です。\n\n標準がなければ、サービスごとに独自の委任フォーマットが作られ、ウォレットはユーザーに意味不明なデータの塊を見せることになります。ReCap は SIWE メッセージにケイパビリティベースの認可を加え、ユーザーは自分が何を許可するのかをそのままのテキストで確認でき、サービスはそれを決定論的に検証できます。仕様は、この組み合わせを OpenID Connect（SIWE）と OAuth2（ReCap）の組み合わせに例えています。\n\n## 仕組み\n\n**ReCap** は、2 つの追加がある通常の SIWE メッセージです。\n\n1. `Resources` の**最後のエントリ**が ReCap URI です。`urn:recap:` の後に、JSON の **Details Object** をパディングなしの base64url でエンコードしたものが続きます。\n2. `statement` の末尾に、それらの権限を説明する、自動生成された人間が読める文が付きます。\n\nDetails Object:\n\n- `att`: リソース URI → アビリティ文字列（`namespace/ability`、例: `crud/update`）→ 制限オブジェクトの配列、というマップ。`[{}]` は「制限なしで許可」を意味し、空の配列は使用不可を意味します。キーは辞書順にソートされていなければなりません。\n- `prf`（任意）: 署名者がリソースの直接の管理者でない場合の、親ケイパビリティの CID。\n\nSIWE の `URI` フィールドは権利を受け取る relying party を指し、`Issued At`、`Expiration Time`、`Not Before` がそれらが有効な期間を区切ります。\n\n**翻訳アルゴリズム**は、`att` を `I further authorize the stated URI to perform the following actions on my behalf:` で始まるテキストに変換し、リソースと名前空間ごとの番号付きエントリが続きます。\n\n**検証:** SIWE の署名を確認し、最後のリソースを ReCap としてデコードし、statement を再生成して、署名された `statement` がそれで終わっていることを確認します。これにより、ユーザーが見た権限と、実際に強制される権限が同一であることが保証されます。\n\n## サンプルコード\n\nTypeScript で ReCap URI と対応する statement を構築する例:\n\n```ts\ntype Att = Record\u003cstring, Record\u003cstring, object[]\u003e\u003e;\n\nfunction sortKeys\u003cT extends Record\u003cstring, any\u003e\u003e(o: T): T {\n  return Object.fromEntries(Object.keys(o).sort().map(k =\u003e [k, o[k]])) as T;\n}\n\nexport function buildRecap(att: Att) {\n  const sorted: Att = sortKeys(Object.fromEntries(\n    Object.entries(att).map(([res, abil]) =\u003e [res, sortKeys(abil)]),\n  ));\n  const json = JSON.stringify({ att: sorted });\n  const uri = \"urn:recap:\" + Buffer.from(json).toString(\"base64url\"); // unpadded\n\n  let n = 1;\n  let text = \"I further authorize the stated URI to perform the following actions on my behalf:\";\n  for (const [resource, abilities] of Object.entries(sorted)) {\n    const byNs: Record\u003cstring, string[]\u003e = {};\n    for (const key of Object.keys(abilities)) {\n      const [ns, name] = key.split(\"/\");\n      (byNs[ns] ??= []).push(name);\n    }\n    for (const [ns, names] of Object.entries(byNs)) {\n      text += ` (${n++}) '${ns}': ${names.map(x =\u003e `'${x}'`).join(\", \")} for '${resource}'.`;\n    }\n  }\n  return { uri, statement: text };\n}\n\n// buildRecap({ \"https://example.com/pictures/\": { \"crud/update\": [{}], \"crud/delete\": [{}] } })\n// statement: \"... (1) 'crud': 'delete', 'update' for 'https://example.com/pictures/'.\"\n```\n\n`uri` を `Resources` の最後のエントリとして置き、`statement` を既存の SIWE の statement に追記します。\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** いくつかのセクション（実装者ガイド、根拠）はまだ TBD のままです。\n- ReCap はベアラートークンではありません。リソースサービスは、relying party を別途認証する必要があります。その方法はスコープ外です。\n- 各アビリティと制限が何を意味するかは、この標準ではなく各リソースサービスが定義します。\n- 順序のルールが重要です。`att` の順序が異なると URI と statement が変わり、検証に失敗します。\n"},"ko":{"lang":"ko","tldr":"ReCap은 Sign-In with Ethereum을 확장해, 서명된 메시지 하나로 로그인과 함께 다른 서비스에서 사용자를 대신해 동작할 수 있는 범위 지정형의 사람이 읽을 수 있는 권한을 앱에 부여한다. SIWE 위에 얹은 OAuth와 같다.","tags":["siwe","authorization","capabilities","wallet","offchain"],"related":[4361],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-5573/","markdown":"## 어떤 문제를 해결하나요?\n\n[ERC-4361](/eip-4361/)(Sign-In with Ethereum, SIWE)은 웹사이트에 여러분이 어떤 주소를 제어한다는 것을 증명합니다. 이것은 인증입니다. 하지만 앱은 *인가*도 필요한 경우가 많습니다. 스토리지 제공업체 같은 제3자 서비스에서 여러분을 대신해 데이터를 읽거나 쓸 권한입니다.\n\n표준이 없으면 서비스마다 자체 위임 형식을 만들어 내고, 지갑은 사용자에게 알아볼 수 없는 데이터 덩어리를 보여 줍니다. ReCap은 SIWE 메시지에 capability 기반 인가를 더해, 사용자가 무엇을 허용하는지 평문으로 정확히 보고 서비스는 이를 결정적으로 검증할 수 있게 합니다. 스펙은 이 조합을 OpenID Connect(SIWE)와 OAuth2(ReCap)에 비유합니다.\n\n## 어떻게 동작하나요?\n\n**ReCap**은 두 가지가 추가된 일반 SIWE 메시지입니다.\n\n1. `Resources`의 **마지막 항목**이 ReCap URI입니다. `urn:recap:` 뒤에 JSON **Details Object**를 패딩 없는 base64url로 인코딩한 값이 붙습니다.\n2. `statement`는 이 권한들을 설명하는, 자동 생성된 사람이 읽을 수 있는 문장으로 끝납니다.\n\nDetails Object:\n\n- `att`: 리소스 URI → 능력 문자열(`namespace/ability`, 예: `crud/update`) → 제한 객체 배열의 맵. `[{}]`는 \"제한 없이 허용\"을 뜻하고, 빈 배열은 사용할 수 없음을 뜻합니다. 키는 사전순으로 정렬되어야 합니다.\n- `prf`(선택): 서명자가 리소스의 직접적인 제어자가 아닐 때 부모 capability의 CID.\n\nSIWE의 `URI` 필드는 권한을 받는 relying party를 가리키며, `Issued At`, `Expiration Time`, `Not Before`가 권한이 유효한 기간을 정합니다.\n\n**변환 알고리즘**은 `att`를 `I further authorize the stated URI to perform the following actions on my behalf:`로 시작하는 텍스트로 바꾸고, 그 뒤에 리소스와 네임스페이스별로 번호가 매겨진 항목이 이어집니다.\n\n**검증:** SIWE 서명을 확인하고, 마지막 리소스를 ReCap으로 디코딩하고, statement를 다시 생성해 서명된 `statement`가 그것으로 끝나는지 확인합니다. 이를 통해 사용자가 본 권한과 실제로 적용되는 권한이 동일하다는 것이 보장됩니다.\n\n## 샘플 코드\n\nTypeScript로 ReCap URI와 대응하는 statement를 만드는 예:\n\n```ts\ntype Att = Record\u003cstring, Record\u003cstring, object[]\u003e\u003e;\n\nfunction sortKeys\u003cT extends Record\u003cstring, any\u003e\u003e(o: T): T {\n  return Object.fromEntries(Object.keys(o).sort().map(k =\u003e [k, o[k]])) as T;\n}\n\nexport function buildRecap(att: Att) {\n  const sorted: Att = sortKeys(Object.fromEntries(\n    Object.entries(att).map(([res, abil]) =\u003e [res, sortKeys(abil)]),\n  ));\n  const json = JSON.stringify({ att: sorted });\n  const uri = \"urn:recap:\" + Buffer.from(json).toString(\"base64url\"); // unpadded\n\n  let n = 1;\n  let text = \"I further authorize the stated URI to perform the following actions on my behalf:\";\n  for (const [resource, abilities] of Object.entries(sorted)) {\n    const byNs: Record\u003cstring, string[]\u003e = {};\n    for (const key of Object.keys(abilities)) {\n      const [ns, name] = key.split(\"/\");\n      (byNs[ns] ??= []).push(name);\n    }\n    for (const [ns, names] of Object.entries(byNs)) {\n      text += ` (${n++}) '${ns}': ${names.map(x =\u003e `'${x}'`).join(\", \")} for '${resource}'.`;\n    }\n  }\n  return { uri, statement: text };\n}\n\n// buildRecap({ \"https://example.com/pictures/\": { \"crud/update\": [{}], \"crud/delete\": [{}] } })\n// statement: \"... (1) 'crud': 'delete', 'update' for 'https://example.com/pictures/'.\"\n```\n\n`uri`를 `Resources`의 마지막 항목으로 넣고, `statement`를 기존 SIWE statement 뒤에 덧붙입니다.\n\n## 알아둘 점\n\n- **상태: Draft.** 일부 섹션(구현자 가이드, 근거)은 아직 TBD로 표시되어 있습니다.\n- ReCap은 bearer 토큰이 아닙니다. 리소스 서비스는 relying party를 별도로 인증해야 하며, 그 방법은 범위 밖입니다.\n- 각 능력과 제한이 무엇을 의미하는지는 이 표준이 아니라 각 리소스 서비스가 정의합니다.\n- 순서 규칙이 중요합니다. `att`의 순서가 다르면 다른 URI와 statement가 만들어지고 검증이 실패합니다.\n"},"zh":{"lang":"zh","tldr":"ReCap 扩展了 Sign-In with Ethereum：一条签名消息既能让你登录，又能授予应用有范围限定、人类可读的权限，使其在其他服务上代表你行事，就像建立在 SIWE 之上的 OAuth。","tags":["siwe","authorization","capabilities","wallet","offchain"],"related":[4361],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-5573/","markdown":"## 它解决什么问题？\n\n[ERC-4361](/eip-4361/)（Sign-In with Ethereum，SIWE）向网站证明你控制某个地址。这是认证。但应用往往还需要*授权*：代表你在第三方服务（例如存储提供商）读取或写入你数据的权限。\n\n没有标准的话，每个服务都会发明自己的委托格式，钱包向用户展示的也是看不懂的数据块。ReCap 为 SIWE 消息加入了基于能力（capability）的授权，这样用户能以明文看到自己究竟授予了什么，服务也能确定性地验证它。规范把这一组合比作 OpenID Connect（SIWE）加 OAuth2（ReCap）。\n\n## 它如何运作\n\n**ReCap** 是一条普通的 SIWE 消息，外加两处改动：\n\n1. `Resources` 中的**最后一项**是一个 ReCap URI：`urn:recap:` 后面跟着 JSON **Details Object** 的无填充 base64url 编码。\n2. `statement` 以一句自动生成的、人类可读的句子结尾，用于描述这些权限。\n\nDetails Object：\n\n- `att`：资源 URI → 能力字符串（`namespace/ability`，例如 `crud/update`）→ 限制对象数组 的映射。`[{}]` 表示\"允许，无限制\"；空数组表示不可用。键必须按字典序排序。\n- `prf`（可选）：父级能力的 CID，用于签名者并非资源的直接控制者的情况。\n\nSIWE 的 `URI` 字段指明接收这些权利的依赖方（relying party）；`Issued At`、`Expiration Time` 和 `Not Before` 限定它们的有效时间。\n\n**转换算法**会把 `att` 转成以 `I further authorize the stated URI to perform the following actions on my behalf:` 开头的文本，后面按资源和命名空间列出编号条目。\n\n**验证：**检查 SIWE 签名，把最后一个资源解码为 ReCap，重新生成 statement，并确认已签名的 `statement` 以它结尾。这保证了用户看到的权限与实际执行的权限一致。\n\n## 示例代码\n\n用 TypeScript 构建 ReCap URI 及对应的 statement：\n\n```ts\ntype Att = Record\u003cstring, Record\u003cstring, object[]\u003e\u003e;\n\nfunction sortKeys\u003cT extends Record\u003cstring, any\u003e\u003e(o: T): T {\n  return Object.fromEntries(Object.keys(o).sort().map(k =\u003e [k, o[k]])) as T;\n}\n\nexport function buildRecap(att: Att) {\n  const sorted: Att = sortKeys(Object.fromEntries(\n    Object.entries(att).map(([res, abil]) =\u003e [res, sortKeys(abil)]),\n  ));\n  const json = JSON.stringify({ att: sorted });\n  const uri = \"urn:recap:\" + Buffer.from(json).toString(\"base64url\"); // unpadded\n\n  let n = 1;\n  let text = \"I further authorize the stated URI to perform the following actions on my behalf:\";\n  for (const [resource, abilities] of Object.entries(sorted)) {\n    const byNs: Record\u003cstring, string[]\u003e = {};\n    for (const key of Object.keys(abilities)) {\n      const [ns, name] = key.split(\"/\");\n      (byNs[ns] ??= []).push(name);\n    }\n    for (const [ns, names] of Object.entries(byNs)) {\n      text += ` (${n++}) '${ns}': ${names.map(x =\u003e `'${x}'`).join(\", \")} for '${resource}'.`;\n    }\n  }\n  return { uri, statement: text };\n}\n\n// buildRecap({ \"https://example.com/pictures/\": { \"crud/update\": [{}], \"crud/delete\": [{}] } })\n// statement: \"... (1) 'crud': 'delete', 'update' for 'https://example.com/pictures/'.\"\n```\n\n把 `uri` 作为 `Resources` 的最后一项，并把 `statement` 追加到已有的 SIWE statement 之后。\n\n## 需要注意\n\n- **状态：Draft。** 若干章节（实现者指南、设计理由）仍标记为 TBD。\n- ReCap 不是不记名令牌（bearer token）。资源服务仍须另行认证依赖方；具体如何做不在范围之内。\n- 每种能力和限制的含义由各资源服务定义，而不是由本标准定义。\n- 排序规则很重要：`att` 的顺序不同，会产生不同的 URI 和 statement，验证就会失败。\n"}}}
