Skip to content

Instantly share code, notes, and snippets.

@oed
Created November 25, 2022 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oed/010c3cf57420248ae0ab4d827f016580 to your computer and use it in GitHub Desktop.
Save oed/010c3cf57420248ae0ab4d827f016580 to your computer and use it in GitHub Desktop.

This document describes how ReCap can adopt the capability format that is used by UCAN. Note that the design of UCANs structure is still in discussion, and if it changes we would want to adopt those changes (for v1 of UCAN).

Going to demonstrate by example. Here is what the ReCap json structure should look like.

{
  "att": {
    "http://example.com/public/photos/": {
        "crud/delete": []
    },
    "mailto:username@example.com": {
      "msg/send": [{ "to": "someone@email.com" }, { "to": "joe@email.com" }]
      "msg/receive": [{
        "max_count": 5,
        "templates": ["newsletter", "marketing"]
      }]
    }
  },
  "prf": ["zM5K3WPEexRZN9x7ikg5LoijNjU2ytFTGJ6eeruGiN3Q9xkfGpMVei9cz5jMZAFUsmxXi9k"]

Main changes:

  • "def" and "tar" are now included as "att"
  • The structure of the capabilities are different
  • "ext" has been removed since it can be represetned within each action (in the array)
    • The objects contain in this array contain a "nota bene"
    • The consuming app must know how to interpret these statements or reject the capability
  • A "prf" field has been added where links to the capability chain can be found
  • Keys in "att" needs to be URIs

The ReCap example above would translate to the following SIWE message:

example.com wants you to sign in with your Ethereum account:
0x0000000000000000000000000000000000000000

I further authorize https://example.com to perform the following actions on my behalf: (1) "crud/delete" for "http://example.com/public/photos/". (2) "msg/send", "msg/receive" for "mailto:username@example.com". 


URI: https://example.com
Version: 1
Chain ID: 1
Nonce: n-0S6_WzA2Mj
Issued At: 2022-06-21T12:00:00.000Z
Resources:
- urn:recap:example:eyJkZWYiOlsicmVhZCJdLCJ0YXIiOnsibXkucmVzb3VyY2UuMSI6WyJhcHBlbmQiLCJkZWxldGUiXSwibXkucmVzb3VyY2UuMiI6WyJhcHBlbmQiXSwibXkucmVzb3VyY2UuMyI6WyJhcHBlbmQiXX19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment