Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
ERC5573 proposes an extension to Sign-In with Ethereum that lets users securely specify which services they authorize to perform particular actions.
This article translates, summarizes, and expands on the following specification.
I have also covered a range of EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.
Overview
ERC4361, also known as Sign-In with Ethereum (SIWE), defines how users can securely authenticate to services outside the blockchain using an Ethereum account.
For more on ERC4361, see the following article.
ERC4361: Signing In to Off-Chain Services with an Ethereum Address
ERC5573 proposes ReCaps, an additional layer on top of SIWE. ReCaps allow the owner of an Ethereum account to give informed consent with a clear understanding of which service receives authority, what scope of authority it receives, and for what purpose. Users can therefore control how their permissions are exercised.
A Relying Party is the service or application to which the user authenticates. ReCaps grant that Relying Party permission to use specific capabilities within a defined scope.
ERC5573 does not specify how the Relying Party actually accesses external resources, or how communication takes place after authentication. Those details are left to individual implementations.
Motivation
SIWE ReCaps extend existing SIWE functionality to make it easier for developers to integrate protocols and APIs. They reduce user interaction and minimize on-chain state and processing, such as transactions, while improving security. In particular, they provide explicit grants of authority based on user consent and predictable, consistent permission management through deterministic capability objects.
Conventional SIWE allows an Ethereum account to authenticate to a particular service (the Relying Party). However, it does not provide a standard way for that party to obtain permission to access third-party services, such as data storage or messaging APIs, on behalf of the Ethereum account.
ReCaps address this gap by integrating authentication and authorization securely without compromising the user experience, reliability, or security. Specifically, they define a way for a Relying Party to access another service securely on behalf of an Ethereum account.
The approach resembles the combination of OpenID Connect and OAuth2 commonly used in web authentication.
- OpenID Connect establishes the user's identity (authentication).
- OAuth2 grants a particular application specific permissions.
SIWE plays a role similar to OpenID Connect by establishing who signed in, while ReCaps play a role similar to OAuth2 by defining how much access is permitted. Together, they extend Ethereum sign-in into a unified framework for authentication and authorization.
Specification
ERC5573 is designed for three audiences.
| Audience | Purpose |
|---|---|
| Web3 application developers | Integrate authentication and delegated authority using ReCaps for protocols and APIs that adopt object capabilities, where permissions are represented as data and passed between parties. |
| Protocol and API developers | Learn how to specify which permissions their services support and how to represent them in ReCaps (the design of the ReCap Details Object). |
| Wallet implementers | Improve how ReCaps are presented in wallet interfaces so users can understand what they are consenting to when signing. |
An object capability represents access authority as an object, such as JSON data, and allows the minimum required permissions to be passed securely to another party.
Terms and definitions
| Term | Description |
|---|---|
| ReCap | A SIWE message conforming to ERC5573. Its Resources contain at least one ReCap URI, and a human-readable ReCap Statement corresponding to that URI is appended to the SIWE statement. |
| ReCap URI | A URI that resolves to a ReCap Details Object (described below). It starts with urn:recap:. |
| ReCap Details Object | A JSON object describing which actions may be performed and, where applicable, against which resources. |
| Resource Service (RS) | A third-party service providing functionality to an Ethereum account, such as user data storage. |
| SIWE Client (SC) | The entity initiating SIWE authentication and the ReCap flow. |
| Relying Party (RP) | In the context of authorization, synonymous with SC: the service to which the user delegates authority. |
Overview
ERC5573 defines the following elements.
- ReCap SIWE Extension (an extension to the SIWE message)
- ReCap Capability (the basic unit of an authority object)
- ReCap URI scheme (URI representation)
- ReCap Details Object schema (JSON structure)
- ReCap transformation algorithm (deterministic conversion into human-readable text)
- ReCap verification (checking the signature and statement for consistency)
Together, these elements make it possible to deterministically reproduce the permissions that the RP may exercise within the scope of the user's informed consent.
ReCap SIWE Extension
A ReCap is an ERC4361 (SIWE) message that follows a particular format. The user's Ethereum account delegates ReCap Capabilities to an RP with explicit consent. The capabilities are represented by a ReCap URI in the final element of the SIWE message's Resources array. The ReCap transformation algorithm converts its contents into human-readable text deterministically (the same input always produces the same output), which is appended to the statement.
The standard SIWE fields constrain the scope of the authority.
| SIWE field | Role |
|---|---|
uri |
Identifies the RP receiving authority, for example https://example.com or a decentralized identifier (DID), did:key:.... The RS is expected to authenticate that RP when an action is performed. |
issuedAt |
The time at which the authority was issued. |
expirationTime |
(Optional) The authority is invalid after this time. |
notBefore |
(Optional) The authority is not valid before this time. |
Example SIWE message
example.com wants you to sign in with your Ethereum account:
0x0000000000000000000000000000000000000000
I further authorize the stated URI to perform the following actions on my behalf: (1) 'example': 'append', 'read' for 'https://example.com'. (2) 'other': 'action' for 'https://example.com'. (3) 'example': 'append', 'delete' for 'my:resource:uri.1'. (4) 'example': 'append' for 'my:resource:uri.2'. (5) 'example': 'append' for 'my:resource:uri.3'.
URI: did:key:example
Version: 1
Chain ID: 1
Nonce: mynonce1
Issued At: 2022-06-21T12:00:00.000Z
Resources:
- urn:recap:eyJhdHQiOnsiaHR0cHM6Ly9leGFtcGxlLmNvbSI6eyJleGFtcGxlL2FwcGVuZCI6W10sImV4YW1wbGUvcmVhZCI6W10sIm90aGVyL2FjdGlvbiI6W119LCJteTpyZXNvdXJjZTp1cmkuMSI6eyJleGFtcGxlL2FwcGVuZCI6W10sImV4YW1wbGUvZGVsZXRlIjpbXX0sIm15OnJlc291cmNlOnVyaS4yIjp7ImV4YW1wbGUvYXBwZW5kIjpbXX0sIm15OnJlc291cmNlOnVyaS4zIjp7ImV4YW1wbGUvYXBwZW5kIjpbXX19LCJwcmYiOltdfQReCap Capability
A ReCap Capability is uniquely identified by a ReCap URI. Resolving the URI yields the ReCap Details Object, which specifies which actions are permitted against which resources. The SIWE fields uri, issuedAt, expirationTime, and notBefore further restrict the common scope of all capabilities.
ReCap URI scheme
A ReCap URI has the following format.
urn:recap:<unpadded-base64url(ReCap Details Object)>base64url is the URL-safe Base64 encoding defined in RFC 4648 (it uses - and _ instead of + and /, and omits the padding =). The ReCap URI must be the last element of the Resources array.
Example ReCap Capability
urn:recap:eyJhdHQiOnsiaHR0cHM6Ly9leGFtcGxlLmNvbS9waWN0dXJlcy8iOnsiY3J1ZC9kZWxldGUiOlt7fV0sImNydWQvdXBkYXRlIjpbe31dLCJvdGhlci9hY3Rpb24iOlt7fV19LCJtYWlsdG86dXNlcm5hbWVAZXhhbXBsZS5jb20iOnsibXNnL3JlY2VpdmUiOlt7Im1heF9jb3VudCI6NSwidGVtcGxhdGVzIjpbIm5ld3NsZXR0ZXIiLCJtYXJrZXRpbmciXX1dLCJtc2cvc2VuZCI6W3sidG8iOiJzb21lb25lQGVtYWlsLmNvbSJ9LHsidG8iOiJqb2VAZW1haWwuY29tIn1dfX0sInByZiI6WyJ6ZGo3V2o2Rk5TNHJVVWJzaUp2amp4Y3NOcVpkRENTaVlSOHNLUVhmb1BmcFNadUF3Il19Ability strings
Actions are expressed in the form <namespace>/<ability> (for example, crud/update). Both namespace and ability may contain only alphanumeric characters and . * _ + -. The regular expressions are as follows.
- Individual constraints on
namespaceandability^[a-zA-Z0-9.*_+-]$(the intended meaning of the specification text is that only these characters are allowed). - Entire string
^[a-zA-Z0-9.*_+-]+\/[a-zA-Z0-9.*_+-]+$
ReCap Details Object schema
The Details Object lists the abilities that the RP can invoke on the user's behalf and the corresponding resource URIs. It can also include additional information that the RS (Resource Service) needs for verification.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"att": {
"type": "object",
"propertyNames": { "format": "uri" },
"patternProperties": {
"^.+:.*$": {
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9.*_+-]+\\/^[a-zA-z0-9.*_+-]+$": { "type": "array", "items": { "type": "object" } }
},
"additionalProperties": false,
"minProperties": 1
}
},
"additionalProperties": false,
"minProperties": 1
},
"prf": {
"type": "array",
"items": { "type": "string", "format": "CID" },
"minItems": 1
}
}
}attShort for attenuations (restrictions). Each key is a resource URI, and its value is an object mapping ability strings to arrays of constraints. Keys are sorted lexicographically (by byte value, with shorter strings preceding longer strings sharing the same prefix).prfShort for proof; references parent capabilities using Base58 CIDs (Content Identifiers, or content-addressable identifiers). It is used to prove the legitimacy of the SIWE signer (address) when the signer is not the controller ofatt.- An empty object
{}in the constraint array Means the action may be performed without restrictions. An empty array[]Means there is no valid way to exercise the ability (effectively disallowed).
Example Details Object (with att and prf)
{
"att": {
"https://example.com/pictures/": {
"crud/delete": [{}],
"crud/update": [{}],
"other/action": [{}]
},
"mailto:username@example.com": {
"msg/receive": [{
"max_count": 5,
"templates": ["newsletter", "marketing"]
}],
"msg/send": [{ "to": "someone@email.com" }, { "to": "joe@email.com" }]
}
},
"prf": ["bafybeigk7ly3pog6uupxku3b6bubirr434ib6tfaymvox6gotaaaaaaaaa"]
}In this example, https://example.com/pictures/ permits crud/update, crud/delete, and other/action without restrictions. For mailto:username@example.com, msg/send is limited to two recipients, and msg/receive is limited to five messages and to newsletter or marketing templates.
The ReCap transformation algorithm deterministically converts this Details Object into the following human-readable text at the end of the SIWE statement (in this example, the URI is https://example.com).
I further authorize the stated URI to perform the following actions on my behalf:
(1) 'crud': 'delete', 'update' for 'https://example.com/pictures/'.
(2) 'other': 'action' for 'https://example.com/pictures/'.
(3) 'msg': 'receive', 'send' for 'mailto:username@example.com'.Encoding the same Details Object using unpadded base64url produces the following ReCap URI.
urn:recap:eyJhdHQiOnsiaHR0cHM6Ly9leGFtcGxlLmNvbS9waWN0dXJlcy8iOnsiY3J1ZC9kZWxldGUiOlt7fV0sImNydWQvdXBkYXRlIjpbe31dLCJvdGhlci9hY3Rpb24iOlt7fV19LCJtYWlsdG86dXNlcm5hbWVAZXhhbXBsZS5jb20iOnsibXNnL3JlY2VpdmUiOlt7Im1heF9jb3VudCI6NSwidGVtcGxhdGVzIjpbIm5ld3NsZXR0ZXIiLCJtYXJrZXRpbmciXX1dLCJtc2cvc2VuZCI6W3sidG8iOiJzb21lb25lQGVtYWlsLmNvbSJ9LHsidG8iOiJqb2VAZW1haWwuY29tIn1dfX0sInByZiI6WyJ6ZGo3V2o2Rk5TNHJVVWJzaUp2amp4Y3NOcVpkRENTaVlSOHNLUVhmb1BmcFNadUF3Il19Merging capability objects
Two ReCap objects can be merged by recursively combining their fields while preserving ordering rules such as lexicographic order.
Input
{
"att": { "https://example1.com": { "crud/read": [{}] } },
"prf": ["bafyexample1"]
}{
"att": {
"https://example1.com": { "crud/update": [{ "max_times": 1 }] },
"https://example2.com": { "crud/delete": [{}] }
},
"prf": ["bafyexample2"]
}Result
{
"att": {
"https://example1.com": {
"crud/read": [{}],
"crud/update": [{ "max_times": 1 }]
},
"https://example2.com": { "crud/delete": [{}] }
},
"prf": ["bafyexample1", "bafyexample2"]
}ReCap transformation algorithm
This algorithm formats the Details Object embedded in the ReCap URI as human-readable text and appends it to the SIWE statement. Because the transformation is deterministic, the same input always produces the same statement.
Input
recap-uriA ReCap URI containing a conforming Details Object.statementOptional. The existing SIWEstatement, if present.
Procedure (pseudocode)
- Initialize an empty string,
recap-transformed-statement. If an existingstatementis present, append it followed by one space. - Append the following prefix.
I further authorize the stated URI to perform the following actions on my behalf: - Initialize
numberingto 1. - Iterate through the Details Object's
att(attenuations) in lexicographic order. Obtain theresource(target URI) andabilitiesfrom each entry. - Group the keys of
abilities(ability strings) by namespace. For example,crud/deleteandcrud/updateare two abilities in thecrudnamespace. - Generate and append the following text for each namespace.
(<numbering>) '<namespace>': '<ability1>', '<ability2>' for '<resource>'. - Increment
numberingand repeat for every namespace and resource. - Return the completed
recap-transformed-statement.
The format is specified using ABNF. Definitions of strings and numbers follow JSON (RFC 8259).
ReCap verification algorithm
The RP and RS verify that the SIWE message and signature are valid and that the end of the statement matches the output of the transformation algorithm.
Input
recap-siweA SIWE message conforming to ERC5573.siwe-signatureThe signature overrecap-siwe, conforming to ERC4361.
Procedure
- Verify the signature of
recap-siweandsiwe-signatureusing the ERC4361 procedure. - Obtain
recap-siwe.urito identify the RP. - Extract the ReCap URI from the last element of
recap-siwe.resources. - Run the ReCap transformation algorithm with the Details Object contained in that ReCap URI and the
urias inputs to obtainrecap-transformed-statement. - Check that the end of
recap-siwe.statementexactly matchesrecap-transformed-statement.
This eliminates discrepancies between the contents of the signed message and the permission statement represented by the ReCap Details Object. The displayed statement can thus be checked against the authority actually signed.
Implementation considerations
- Deterministic ordering
Sort keys under
att(resource URIs and ability strings) lexicographically. The article describes byte-value order, with shorter matching prefixes first, as the same behavior as JavaScript's defaultArray.sort(). - Empty objects versus empty arrays
[{}]means the action can be performed without restrictions;[]means there is no valid way to perform it (effectively disallowed). - CID (Content Identifier)
Base58-encoded CIDs in
prfcan be used to prove parent authority or a chain of delegation. - RP authentication by the RS
The RS is expected to verify at execution time that the party is the RP identified by
uri, using mechanisms such as DIDs or HTTPS origins. - User interface Wallets can display the deterministic human-readable statement produced by the transformation algorithm directly, giving users a clear view of which actions they are permitting, against which resources, and within what scope.
Security
Differences from bearer tokens
With conventional bearer tokens, possession of the token itself is treated as proof of authority to access a resource. Access tokens issued through OAuth2 are a common example. Anyone who obtains such a token may be able to access the resource, so token leakage poses a significant risk.
ReCaps, by contrast, are not merely tokens. They are structured data (capability objects) that explicitly represent authority through an Ethereum signature. They are not meant to be usable by a third party simply copying them; consistency with the signature is a prerequisite. Even so, the presence of a ReCap must not automatically be treated as a grant of access.
Why Relying Party authentication matters
ReCaps allow a user to authorize a particular Relying Party (RP) to perform specific actions. The Resource Service (RS) must therefore establish that the RP named in the ReCap is the actual RP (the legitimate client).
If the RS grants access based solely on a ReCap without authenticating the RP, a malicious third party could misuse the contents of the ReCap and act on behalf of the user. It is important to understand that ReCaps are evidence of the permissions granted, not a substitute for authenticating the party exercising them.
Authentication methods are outside the scope of the specification
The ReCaps specification does not define how to authenticate a Relying Party. Each Resource Service is responsible for implementing RP authentication.
Possible approaches include the following.
| Authentication method | Overview |
|---|---|
| Domain verification through HTTPS/TLS certificates | If the RP's URI uses HTTPS, verify its certificate to establish the legitimacy of the server. |
| DID (decentralized identifier) authentication | If a DID appears in the ReCap URI field, verify a signature based on its DID Document. |
| Combination with API keys or OAuth 2.0 tokens | Perform additional server-to-server authentication to establish that the RP is an authorized client. |
ReCaps define permissions but do not, by themselves, prove the legitimacy of the RP. The RS must therefore provide an appropriate authentication mechanism to ensure security.
References
Oliver Terbu (@awoie), Jacob Ward (@cobward), Charles Lehner (@clehner), Sam Gbafa (@skgbafa), Wayne Chang (@wyc), Charles Cunningham (@chunningham), "ERC-5573: Sign-In with Ethereum Capabilities, ReCaps [DRAFT]," Ethereum Improvement Proposals, no. 5573, July 2021. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5573.
Conclusion
This article covered ERC5573, which extends Sign-In with Ethereum with a mechanism for users to securely specify which services they authorize to perform particular actions.
If you have questions, feel free to contact me via Twitter DM.
I also share content on other platforms.



