You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CAIPs/caip-x.md
+50-48Lines changed: 50 additions & 48 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
caip: XX
2
+
caip: 285
3
3
title: JSON-RPC Provider Lifecycle Methods for Session Management
4
4
author: [Alex Donesky] (@adonesky1)
5
5
discussions-to: TBD
@@ -11,51 +11,51 @@ requires: 25, 217
11
11
12
12
## Simple Summary
13
13
14
-
CAIP-XX introduces new "lifecycle" methods and a new event for managing permissions within an existing CAIP-25 session, allowing for addition, revocation, and retrieval of permissions. These methods provide an alternative to session management via `sessionId`s, allowing `sessionId`s to be optional for CAIP-25.
14
+
CAIP-285 introduces new "lifecycle" methods and a new event for managing authorizations within an existing CAIP-25 session, allowing for addition, revocation, and retrieval of authorizations. These methods provide an alternative to session management via `sessionId`s, allowing `sessionId`s to be optional for CAIP-25.
15
15
16
16
## Abstract
17
17
18
-
This proposal aims to extend the CAIP-25 standard by defining new JSON-RPC methods for managing the lifecycle of permissions within a session. These methods allow dapps and wallets to dynamically adjust permissions, providing more granular control and better user experience. Additionally, it allows for session management without mandatory sessionIds, offering more flexibility in handling sessions.
18
+
This proposal aims to extend the CAIP-25 standard by defining new JSON-RPC methods for managing the lifecycle of authorizations within a session. These methods allow dapps and wallets to dynamically adjust authorizations, providing more granular control and better user experience. Additionally, it allows for session management without mandatory sessionIds, offering more flexibility in handling sessions.
19
19
20
20
## Motivation
21
21
22
-
The motivation behind this proposal is to enhance the flexibility of CAIP-25 by enabling management of session permissions without sessionIds which don't map well to extension based wallet's dapp connections and could therefore add constraints and burdens to existing flows. The proposed methods provide an intuitive way to add, revoke, and retrieve permissions within an existing session, simplifying the management of session lifecycles.
22
+
The motivation behind this proposal is to enhance the flexibility of CAIP-25 by enabling management of session authorizations without sessionIds which don't map well to extension based wallet's dapp connections and could therefore add constraints and burdens to existing flows. The proposed methods provide an intuitive way to add, revoke, and retrieve authorizations within an existing session, simplifying the management of session lifecycles.
23
23
24
24
### Use Case Scenarios
25
25
26
-
1.**Dapp Initiated Adding Permissions To an Existing Session:**
26
+
1.**Dapp Initiated Adding Authorizations To an Existing Session:**
27
27
28
-
-**Current Method:** Call `provider_authorize` again with an existing session identifier and new scopes/methods to add. This is actually somewhat ambiguous in CAIP-25 where it’s unclear if incremental permissions adds should include the full object or just scopes to add: "This object gets updated, extended, closed, etc. by successive calls and notifications, each tagged by this identifier."
29
-
-**Proposed Method:** Use `provider_augment` to add new permissions to the existing session. Alternatively, this could be achieved with more specific language indicating that a subsequent `provider_authorize` call with new scopes/permissions could simply add to an existing session. If we pursue this latter approach one flow that will need clarity is what happens if a subsequent `provider_authorize` request includes `requiredScopes` which the respondent does not authorize. In this case I would expect that this does not revoke the existing session but rather only the new request is rejected.
28
+
-**Current Method:** Call `provider_authorize` again with an existing session identifier and new scopes/methods to add. This is actually somewhat ambiguous in CAIP-25 where it’s unclear if incremental authorizations adds should include the full object or just scopes to add: "This object gets updated, extended, closed, etc. by successive calls and notifications, each tagged by this identifier."
29
+
-**Proposed Method:** Use `wallet_updateSession` to add new authorizations to the existing session. Alternatively, this could be achieved with more specific language indicating that a subsequent `provider_authorize` call with new scopes/authorizations could simply add to an existing session. If we pursue this latter approach one flow that will need clarity is what happens if a subsequent `provider_authorize` request includes `requiredScopes` which the respondent does not authorize. In this case I would expect that this does not revoke the existing session but rather only the new request is rejected.
30
30
31
-
2.**Wallet Initiated Adding Permissions To an Existing Session:**
31
+
2.**Wallet Initiated Adding Authorizations To an Existing Session:**
32
32
33
-
-**Current Method:** CAIP-25 does not make it very clear how a respondent (wallet), can modify the permissions of an existing session. The following excerpt is the closest we get: "The properties and authorization scopes that make up the session are expected to be persisted and tracked over time by both parties in a discrete data store, identified by an entropic identifier assigned in the initial response. This object gets updated, extended, closed, etc. by successive calls and notifications, each tagged by this identifier."
34
-
-**Proposed Method:** Wallet publishes and caller/dapp listens for an event `providerAuthorizationChanged` with the new full sessionScope.
33
+
-**Current Method:** CAIP-25 does not make it very clear how a respondent (wallet), can modify the authorizations of an existing session. The following excerpt is the closest we get: "The properties and authorization scopes that make up the session are expected to be persisted and tracked over time by both parties in a discrete data store, identified by an entropic identifier assigned in the initial response. This object gets updated, extended, closed, etc. by successive calls and notifications, each tagged by this identifier."
34
+
-**Proposed Method:** Wallet publishes and caller/dapp listens for an event `wallet_sessionChanged` with the new full sessionScope.
35
35
36
-
3.**Wallet Initiated Permissions Revocation:**
36
+
3.**Wallet Initiated Authorizations Revocation:**
37
37
38
38
-**Current Method:** "If a respondent (e.g. a wallet) needs to initiate a new session, whether due to user input, security policy, or session expiry reasons, it can simply generate a new session identifier to signal this notification to the calling provider."
39
-
- Given this language it is unclear if a wallet can revoke permissions without creating a new session. It is also therefore unclear if a wallet can revoke some subset of permissions without creating a new session.
40
-
-**Proposed Method:** Wallet publishes and caller/dapp listens for an event `providerAuthorizationChanged` with the new full sessionScope.
39
+
- Given this language it is unclear if a wallet can revoke authorizations without creating a new session. It is also therefore unclear if a wallet can revoke some subset of authorizations without creating a new session.
40
+
-**Proposed Method:** Wallet publishes and caller/dapp listens for an event `wallet_sessionChanged` with the new full sessionScope.
41
41
42
-
4.**Dapp Initiated Permissions Revocation:**
42
+
4.**Dapp Initiated Authorizations Revocation:**
43
43
44
44
-**Current Method:** "if a caller [dapp] needs to initiate a new session, it can do so by sending a new request without a sessionIdentifier."
45
-
-**Proposed Method:** Use `provider_revoke` to revoke specific permissions or the entire existing session.
45
+
-**Proposed Method:** Use `wallet_revokeSession` to revoke specific authorizations or the entire existing session. A revokation of methods/notifications/accounts is achieved by sending the sessionScope with the methods/notifications/accounts to revoke. A revokation of a full scope is achieved by sending an empty object for that scope. A full revokation of the session is achieved by sending an empty object for the scopes param.
46
46
47
-
5.**Retrieving Current Permissions:**
47
+
5.**Retrieving Current Session Authorizations:**
48
48
49
-
-**Current Method:**Track permissions externally or infer from session creation.
50
-
-**Proposed Method:** Use `provider_getSession` to retrieve the current permissions of the session.
49
+
-**Current Method:**Wallet and app both persist configuration across updates.
50
+
-**Proposed Method:** Use `wallet_getSession` to retrieve the current authorizations of the session.
51
51
52
52
## Specification
53
53
54
54
### New Methods
55
55
56
-
#### `provider_augment` // open to a different name here!
56
+
#### `wallet_updateSession`
57
57
58
-
Adds new permissions to an existing session.
58
+
Adds new authorizations to an existing session.
59
59
60
60
**Parameters:**
61
61
@@ -85,7 +85,7 @@ Adds new permissions to an existing session.
85
85
{
86
86
"id": 1,
87
87
"jsonrpc": "2.0",
88
-
"method": "provider_augment",
88
+
"method": "wallet_updateSession",
89
89
"params": {
90
90
"scopes": {
91
91
"eip155:1": {
@@ -123,11 +123,11 @@ Adds new permissions to an existing session.
123
123
124
124
**Explanation:**
125
125
126
-
- The `provider_augment` method adds the specified scopes to the current session's permissions. If the scope already exists, the new methods and notifications are merged with the existing ones.
126
+
- The `wallet_updateSession` method adds the specified scopes to the current session's authorizations. If the scope already exists, the new methods and notifications are merged with the existing ones.
127
127
128
-
#### `provider_revoke`
128
+
#### `wallet_revokeSession`
129
129
130
-
Revokes permissions from an existing session.
130
+
Revokes authorizations from an existing session.
131
131
132
132
**Parameters:**
133
133
@@ -157,7 +157,7 @@ Revokes permissions from an existing session.
157
157
{
158
158
"id": 1,
159
159
"jsonrpc": "2.0",
160
-
"method": "provider_revoke",
160
+
"method": "wallet_revokeSession",
161
161
"params": {
162
162
"scopes": {
163
163
"eip155:1": {
@@ -196,11 +196,11 @@ Revokes permissions from an existing session.
196
196
197
197
**Explanation:**
198
198
199
-
- The `provider_revoke` method removes the specified methods, notifications, and accounts from the current session's permissions. If the scope no longer has any methods, notifications, or accounts after revocation, it is removed from the session. If no scopes remain in the session, the session is considered closed. If no accounts remain in a scope, and only write methods the entire scope is removed.
199
+
- The `wallet_revokeSession` method removes the specified methods, notifications, and accounts from the current session's authorizations. If the scope no longer has any methods, notifications, or accounts after revocation, it is removed from the session. If no scopes remain in the session, the session is considered closed. If no accounts remain in a scope, and only write methods the entire scope is removed.
200
200
201
-
#### `provider_getSession` // open to a different name here!
201
+
#### `wallet_getSession`
202
202
203
-
Retrieves the current permissions of an existing session.
203
+
Retrieves the current authorizations of an existing session.
204
204
205
205
**Parameters:**
206
206
@@ -229,7 +229,7 @@ Retrieves the current permissions of an existing session.
229
229
{
230
230
"id": 1,
231
231
"jsonrpc": "2.0",
232
-
"method": "provider_getSession",
232
+
"method": "wallet_getSession",
233
233
"params": {}
234
234
}
235
235
```
@@ -259,32 +259,34 @@ Retrieves the current permissions of an existing session.
259
259
260
260
**Explanation:**
261
261
262
-
- The `provider_getSession` method returns the current permissions for the session. It lists all scopes along with their methods, notifications, and accounts.
262
+
- The `wallet_getSession` method returns the current authorizations for the session. It lists all scopes along with their methods, notifications, and accounts.
263
263
264
264
### Events
265
265
266
-
#### `providerAuthorizationChanged`
266
+
#### `wallet_sessionChanged`
267
267
268
-
This event is published by the wallet to notify the caller/dapp of updates to the session authorization scopes. The event payload indicates how the scopes have changed, showing additions and removals in the permissions.
268
+
This event is published by the wallet to notify the caller/dapp of updates to the session authorization scopes. The event payload indicates how the scopes have changed, showing additions and removals in the authorizations. If a connection between the wallet and the caller/dapp is severed and the possiblity of missed events arises, the caller/dapp should immediately call `wallet_getSession` to retrieve the current session scopes.
269
269
270
270
**Event Payload:**
271
271
272
272
-`sessionId` (string, optional): The session identifier.
273
-
-`scopes` (object, required): An object containing the updated session scopes, formatted according to CAIP-217.
273
+
-`sessionScopes` (object of `scopeObject` objects, required): An object containing the updated session scopes, formatted according to CAIP-217.
274
274
275
275
**Initial Session Scopes:**
276
276
277
277
```json
278
278
{
279
-
"eip155:1": {
280
-
"methods": ["eth_signTransaction"],
281
-
"notifications": ["accountsChanged"],
282
-
"accounts": ["eip155:1:0xabc123"]
283
-
},
284
-
"eip155:137": {
285
-
"methods": ["eth_sendTransaction"],
286
-
"notifications": ["chainChanged"],
287
-
"accounts": ["eip155:137:0xdef456"]
279
+
"sessionScopes": {
280
+
"eip155:1": {
281
+
"methods": ["eth_signTransaction"],
282
+
"notifications": ["accountsChanged"],
283
+
"accounts": ["eip155:1:0xabc123"]
284
+
},
285
+
"eip155:137": {
286
+
"methods": ["eth_sendTransaction"],
287
+
"notifications": ["chainChanged"],
288
+
"accounts": ["eip155:137:0xdef456"]
289
+
}
288
290
}
289
291
}
290
292
```
@@ -293,9 +295,9 @@ This event is published by the wallet to notify the caller/dapp of updates to th
@@ -319,15 +321,15 @@ The `sessionId` parameter in the new lifecycle methods is optional. When not pro
319
321
320
322
## Security Considerations
321
323
322
-
The introduction of these lifecycle methods must ensure that only authorized parties can modify the permissions of a session. Proper authentication and authorization mechanisms must be in place to prevent unauthorized access or modifications.
324
+
The introduction of these lifecycle methods must ensure that only authorized parties can modify the authorizations of a session. Proper authentication and authorization mechanisms must be in place to prevent unauthorized access or modifications.
323
325
324
326
## Privacy Considerations
325
327
326
-
Managing permissions within an existing session reduces the need to create multiple session identifiers, which can help minimize the exposure of session-related metadata. However, care must be taken to handle these methods in a way that does not inadvertently leak sensitive information.
328
+
Managing authorizations within an existing session reduces the need to create multiple session identifiers, which can help minimize the exposure of session-related metadata. However, care must be taken to handle these methods in a way that does not inadvertently leak sensitive information.
0 commit comments