Feature Branch: Implement CAIP-25 permission #4241
Labels
barad-dur
enhancement
New feature or request
PermissionController
Related to the PermissionController.
team-wallet-api-platform
Requires: #4239
For the Barad-dûr multichain milestone, we are implementing CAIP-25 handshakes. Consequently, our permission system needs to be able to express its granular authorization logic for RPC methods and notifications. After due consideration, we have decided that the solution is essentially to copypaste the CAIP-25 "scopes" object directly into permission controller state. This will require some means of hiding the permission controller's state shape from consumers (#4239). It will also facilitate the eventual removal of the
RestrictedMethod
permission type (#4238).The CAIP-25 permission will consist of an endowment with a single caveat. The caveat's value will consist of a CAIP-25 scope object. This object is specified by CAIP-217. We will only permit a subset of the possible scope object shapes, elaborated below in TypeScript:
In particular, while we may accept any valid scope object at the API layer, our internal representation will require that every key is a complete CAIP-2 id. This is to say, we will pretend that scope objects of the form
{ [namespace]: { scopes: chainId[], ... }
do not exist. Nor will we, at least at present, support any other scope object properties not listed in the above TypeScript definition, although we may add them in the future.Since it trivially meets the needs of the multichain API, the CAIP-25 permission can also express any heretofore implemented
RestrictedMethod
. It also enables us to efficiently answer the question "can this dapp call this method?" by querying its caveat value. The existing permission middleware will have to be reimplemented to support this. In this manner, and alongside #4239, we can replace all existing restricted method implementations, and ship a multichain API.Acceptance Criteria
sessionScopes
of CAIP-25 success response, but maintainingrequiredScopes
andoptionalScopes
metadataThe text was updated successfully, but these errors were encountered: