---
eip: 5573
label: ERC-5573
title: Sign-In with Ethereum Capabilities, ReCaps
status: Draft
type: Standards Track
category: ERC
created: 2021-07-20
requires: 4361
official: https://eips.ethereum.org/EIPS/eip-5573
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5573.md
canonical: https://eips.huatuo.xyz/eip-5573/
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]
---

# ERC-5573: Sign-In with Ethereum Capabilities, ReCaps

> Mechanism on top of Sign-In with Ethereum for informed consent to delegate capabilities with an extensible scope mechanism

**TL;DR:** 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.

## What problem does it solve?

[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.

Without 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).

## How it works

A **ReCap** is a normal SIWE message with two additions:

1. The **last entry** in `Resources` is a ReCap URI: `urn:recap:` followed by the unpadded base64url encoding of a JSON **Details Object**.
2. The `statement` ends with an auto-generated, human-readable sentence describing those permissions.

The Details Object:

- `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.
- `prf` (optional): CIDs of parent capabilities, when the signer is not the direct controller of the resource.

The SIWE `URI` field names the relying party receiving the rights; `Issued At`, `Expiration Time` and `Not Before` bound when they are valid.

The **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.

**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.

## Sample code

Building a ReCap URI and the matching statement in TypeScript:

```ts
type Att = Record<string, Record<string, object[]>>;

function sortKeys<T extends Record<string, any>>(o: T): T {
  return Object.fromEntries(Object.keys(o).sort().map(k => [k, o[k]])) as T;
}

export function buildRecap(att: Att) {
  const sorted: Att = sortKeys(Object.fromEntries(
    Object.entries(att).map(([res, abil]) => [res, sortKeys(abil)]),
  ));
  const json = JSON.stringify({ att: sorted });
  const uri = "urn:recap:" + Buffer.from(json).toString("base64url"); // unpadded

  let n = 1;
  let text = "I further authorize the stated URI to perform the following actions on my behalf:";
  for (const [resource, abilities] of Object.entries(sorted)) {
    const byNs: Record<string, string[]> = {};
    for (const key of Object.keys(abilities)) {
      const [ns, name] = key.split("/");
      (byNs[ns] ??= []).push(name);
    }
    for (const [ns, names] of Object.entries(byNs)) {
      text += ` (${n++}) '${ns}': ${names.map(x => `'${x}'`).join(", ")} for '${resource}'.`;
    }
  }
  return { uri, statement: text };
}

// buildRecap({ "https://example.com/pictures/": { "crud/update": [{}], "crud/delete": [{}] } })
// statement: "... (1) 'crud': 'delete', 'update' for 'https://example.com/pictures/'."
```

Place `uri` as the final `Resources` entry and append `statement` to any existing SIWE statement.

## Things to know

- **Status: Draft.** Several sections (implementer's guide, rationale) are still marked TBD.
- A ReCap is not a bearer token. The resource service must still authenticate the relying party separately; how is out of scope.
- What each ability and restriction means is defined by each resource service, not by this standard.
- Ordering rules matter: a differently ordered `att` produces a different URI and statement, and verification will fail.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-5573
