-
Notifications
You must be signed in to change notification settings - Fork 229
Decouple CAIP-27 from CAIP-25 and introduce CAIP-217 for Authorization Scopes #217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bumblefudge
merged 32 commits into
master
from
feat/update-caip27-to-be-constrained-by-25
May 19, 2023
Merged
Changes from 13 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
d75e96d
constrain to CAIP-25 session explicitly
4c4ae73
typo
bumblefudge be1aa1c
typo
bumblefudge 95c5268
strawman CAIP-217
407691f
fine-tuning simple CAIP-217
2e54eaa
simplified CAIP-27
aa9506d
simplified CAIP-25
ac80b88
typo
bumblefudge e79a945
formatting tweak
bumblefudge 0ef0acc
typo
bumblefudge 03884a6
typo
bumblefudge 9300226
typo
bumblefudge c1aaf10
language fine-tuning
f3cb8fc
make accounts optionality and semantics more explicit
66b56ff
make informational version of CAIP-211
859551d
add abstract to informational version of CAIP-211
d92e474
add wallet methods to caip-25
pedrouid 48e0e3d
typo
pedrouid 01459af
resolve
pedrouid 555c005
fine-tune abstract
7f4801b
typo
5afcb22
Merge pull request #224 from ChainAgnostic/feat/caip-25-include-examp…
pedrouid 0e72bb6
add security considerations with negotiation example
0fea9db
resolve conflicts
8a92f2b
to clarify scopes object semantics
5076373
to clarify the syntax of string to which each object is keyed
1037853
to clarify the semantics of the whole object in # spec section
96e7760
to clarify that responses are specified per namespace, not here
5097a2d
to clarify that 2 of 3 options in caip25 example are corner cases
0de8414
remove hard requirement on as-yet unmergeddefined CAIP-170
e45f802
restore property 5 in caip171
5fcdf9b
Merge branch 'master' into feat/update-caip27-to-be-constrained-by-25
bumblefudge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| --- | ||
| caip: 217 | ||
| title: Authorization Scopes | ||
| author: Pedro Gomes (@pedrouid), Hassan Malik (@hmalik88), Juan Caballero (@bumblefudge) | ||
| discussions-to: ["https://github.com/ChainAgnostic/CAIPs/discussions/217","https://github.com/ChainAgnostic/CAIPs/discussions/211"] | ||
| status: Draft | ||
| type: Standard | ||
| created: 2022-11-09 | ||
| --- | ||
|
|
||
| ## Simple Summary | ||
|
|
||
| This CAIP defines a simple syntax for scopes of authorization between applications (e.g. dapps) and user-agents (e.g. "wallets" or signers). These are described in JSON objects as a building block across multiple protocols and mechanisms: | ||
| - A JSON-RPC protocol for persisting and synchronizing authorized sessions ([CAIP-25][]) | ||
| - Routing individual RPC commands to an authorized network ([CAIP-27][]) | ||
|
|
||
| ## Motivation | ||
|
|
||
| The layering of today's cryptographic and decentralized systems favors | ||
| loosely-coupled combinations of protocols (representated in the CAIPs model as | ||
| [namespaces][]), instances or consensus-communities within those protocols | ||
| (addressed in the CAIPs model as [CAIP-2][] URNs), and sets of supported RPC | ||
| methods and notifications used in those namespaces. Bundling all of these into | ||
| an object facilitates unambiguous authorization schemes, including progressive | ||
| authorization patterns, feature discovery, authority negotiation (See | ||
| [CAIP-211][]) and delegations. | ||
|
|
||
| ## Specification | ||
|
|
||
| An authorization scope is represented in JSON as a string that expresses its | ||
| scope and a JSON object defining the bundle of properties authorized there. When | ||
| embedded in any other JSON context (including the `params` of a JSON-RPC | ||
| message), the object MUST be expressed as the value of a property named by the | ||
| scope string. | ||
|
|
||
| ### Language | ||
|
|
||
| The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", | ||
| "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" written in | ||
| uppercase in this document are to be interpreted as described in [RFC | ||
| 2119](https://www.ietf.org/rfc/rfc2119.txt) | ||
|
|
||
| ### Definition | ||
|
|
||
| The syntax is as follows: | ||
|
|
||
| ```jsonc | ||
|
|
||
| scope: string | ||
|
|
||
| scopeObject: { | ||
| *scopes: [(chainId)+], | ||
| methods: [(method_name)+], | ||
| notifications: [(notification_name)+], | ||
| accounts: [(account_id)+] | ||
| *rpcDocuments: [(rpcDocument)+], | ||
| *rpcEndpoints: [(rpcEndpoint)+] | ||
| } | ||
| ``` | ||
|
|
||
| Where: | ||
|
|
||
| - `string` (conditional) = A namespace identifier string registered in the CASA [namespaces][] registry to authorize multiple chains with identical properties OR a single, valid [CAIP-2][] identifier, i.e., a specific `chain_id` within a namespace. | ||
| - `scopes` (conditional) = An array of 0 or more [CAIP-2][] `chainId`s. Setting multiple `scopes` is equivalent to making multiple copies of the `scopeObject` for each member of `scopes`, simply in compact form. | ||
|
bumblefudge marked this conversation as resolved.
Outdated
|
||
| - This property MUST NOT be present if the object is already scoped to a single `chainId` in the string value above. | ||
| - This property MUST NOT be present if the scope is an entire [namespace][namespaces] in which `chainId`s are not defined. | ||
| - This property MAY be present if the scope is an entire [namespace][namespaces] in which `chainId`s are defined. | ||
| - `methods` = An array of 0 or more JSON-RPC methods that an application can call on the agent and/or an agent can call on an application. | ||
| - `notifications` = An array of 0 or more JSON-RPC notifications that an application send to or expect from the agent. | ||
| - `accounts` (optional) = An array of 0 or more [CAIP-10][] identifiers valid within the scope of authorization. | ||
|
bumblefudge marked this conversation as resolved.
Outdated
|
||
| - `rpcDocuments` (optional) = An array of URIs that each dereference to an RPC document specifying methods and notifications applicable in this scope. | ||
| - These are ordered from most authoritative to least, i.e. methods defined more than once by the union of entries should be defined by their earliest definition only. | ||
| - `rpcEndpoints` (optional) = An array of URLs that each dereference to an RPC endpoints for routing requests within this scope. | ||
| - These are ordered from most authoritative to least, i.e. priority SHOULD be given to endpoints in the order given, as per the CAIP-217 profile for that [namespace][namespaces], if one has been specified. | ||
|
|
||
| Whenever another CAIP uses the name `scopeObject` and has this CAIP in the | ||
| `required` front-matter property, it SHALL be interpreted as reference to this | ||
| specification. | ||
|
|
||
| ## References | ||
|
|
||
| [CAIP-10]: https://chainAgnostic.org/CAIPs/CAIP-10 | ||
| [CAIP-25]: https://chainAgnostic.org/CAIPs/CAIP-25 | ||
| [CAIP-27]: https://chainAgnostic.org/CAIPs/CAIP-27 | ||
| [CAIP-211]: https://chainAgnostic.org/CAIPs/CAIP-211 | ||
| [namespaces]: https://namespaces.chainAgnostic.org/ | ||
|
|
||
| ## Copyright | ||
|
|
||
| Copyright and related rights waived via | ||
| [CC0](https://creativecommons.org/publicdomain/zero/1.0/). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.