-
Notifications
You must be signed in to change notification settings - Fork 217
Lifecycle Methods and Event Alternative to sessionsId
#285
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
Lifecycle Methods and Event Alternative to sessionsId
#285
Conversation
bbb3e3b to
a15b6ab
Compare
vandan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that we need a way to distinguish between the initial and subsequent permission requests as they may have different implications to the way permission requests are presented to end-users.
Specifying that subsequent calls to provider_authorize will be treated as additive (similar to how provider_augment would work) seems like an elegant way to handle this. Otherwise we might have ambiguity about what happens when provider_authorize is called multiple times.
I initially thought we might need wildcards in the provider_revoke call, but with provider_getSession available it should be trivial to create application-side utilities to do things like "revoke all" permissions (aka logout).
|
I would prefer the various methods to be spun out in their own respective CAIPs, you can mark the CAIPs based off of the PR #. |
CAIPs/caip-x.md
Outdated
|
|
||
| - **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." | ||
| - 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. | ||
| - **Proposed Method:** Wallet publishes and caller/dapp listens for an event `providerAuthorizationChanged` with the new full sessionScope. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming you're referring to user-initiated permission revocation in the extension? If so, what happens if the dapp is not connected to the wallet when the permission is revoked? Can the dapp just not rely on provider_getSession?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming you're referring to user-initiated permission revocation in the extension? If so, what happens if the dapp is not connected to the wallet when the permission is revoked?
🤔 I guess you mean if the connection is severed somehow? I suppose in that case the dapp would use provider_getSession but I think this event is useful for most cases where a dapp can immediately reflect a change to the state of its permissions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
severed, or just timed out. i think the fundamental assumption that both app and wallet persist the config (if not the "session" in browser-memory or RPC-connection sense) is the first thing we need to be aligned on, before getting to other stuff? in hassan's example, the wallet would let the user revoke a permission and... persist that message/event until there's an active RPC connection, right?
all this sounds fine to me, but should be explicit in the spec since it obligates the provider (or the wallet+plus+provider) to persist until next connection. conversely, if this event is ONLY fired within an active session and dropped otherwise, specify that and separately define the behavior if user tells wallet to revoke without (or without knowing about the absence of) a live connection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the following additional sentence assuage your concerns?
"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."
Happy to do this. Wanted to present these as a package to lay out the full sweep of scenarios they are serving in place of sessionIds. |
CAIPs/caip-x.md
Outdated
|
|
||
| 4. **Dapp Initiated Permissions Revocation:** | ||
|
|
||
| - **Current Method:** "if a caller [dapp] needs to initiate a new session, it can do so by sending a new request without a sessionIdentifier." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...on the assumption that dapp should only persist one "session" (config) at a time for any given wallet, thus new sessionId overwrites/replaces the revoked session, that by not being persisted is as good as dead.
(no change here, just filling in the assumptions/thought behind status quo in case it's cryptic)
bumblefudge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it, looking forward to discussing Wednesday on the community call
53bec6f to
8c48748
Compare
|
I'm starting to wonder - forgive me if someone already suggested this - whether I suppose you could then argue why not just let it all fall back to I think that could work too. Whether its a new session or just an updated existing session becomes pure semantics when you don't include a After reflecting on it I think its cleaner to either:
WDYT? |
But isn't option (1) just... status quo? CAIP-25 as written means the dapp sends update/escalate/partial-remove proposals by sending the entire state it would like to see, with the current As I understood it, the whole reason for adding more RPC methods was that either party could send deltas without a sessionId and have the other side accept/reject the delta. This gives a sessionId-free wallet a way to interact with a sessionId-relying dapp, while still allowing the dapp to send a blank sessionId when it wants to renew. Makes it easy for both sides to interact meaningfully. |
bumblefudge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking mergeable, once we renumber all the docs? I opened tracking issues to ensure people find THIS thread when looking up THOSE documents:

The only thing that seems like it might change as this gets implemented is error codes and Considersations sections, but all that should be easy enough to update with separate PRs down the road.
@hmalik88 have you taken a stroll through here?
Co-authored-by: Bumblefudge <[email protected]>
09666ea to
9941270
Compare
hmalik88
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This proposal introduces new "lifecycle" methods 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 sessionIds, allowing sessionIds to be optional for CAIP-25.