Skip to content

feat: request grant confirmation for config updates#39

Merged
DarianM merged 43 commits intomainfrom
al/13-request-grant-confirmation-for-config-updates
Mar 21, 2025
Merged

feat: request grant confirmation for config updates#39
DarianM merged 43 commits intomainfrom
al/13-request-grant-confirmation-for-config-updates

Conversation

@lengyel-arpad85
Copy link
Collaborator

@lengyel-arpad85 lengyel-arpad85 commented Dec 4, 2024

Changes proposed

  • add open-payments library
  • request grant confirmation when creating, deleting or updating a config
  • after first grant confirmation, we save the wallet address for the duration of the session, to prevent prompting user at every action

@lengyel-arpad85 lengyel-arpad85 self-assigned this Dec 4, 2024
@lengyel-arpad85 lengyel-arpad85 linked an issue Dec 4, 2024 that may be closed by this pull request
@lengyel-arpad85 lengyel-arpad85 marked this pull request as draft December 4, 2024 21:33
@lengyel-arpad85 lengyel-arpad85 marked this pull request as ready for review March 18, 2025 21:55
@lengyel-arpad85 lengyel-arpad85 requested a review from DarianM March 18, 2025 22:00
url: string,
opClient?: AuthenticatedClient
) {
opClient = opClient ? opClient : await createClient()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
opClient = opClient ? opClient : await createClient()
opClient ??= await createClient()

But previous suggestion of caching client might be better. Then don't need to pass the client around as params and can reuse existing one.

Copy link
Member

@sidvishnoi sidvishnoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tested locally, but code looks fine.

const { getSession, commitSession, destroySession } =
createCookieSessionStorage({
cookie: {
name: 'wmtools-session',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think we should add a maxAge or delete the wmtools-session cookie when the session/tab closes?
basically asking the user for a new grant confirmation over a period of time or after the tab closes.

only session gets cleared after a session but not this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sadly there is no way of detecting when tab closes (browser event onunload fires even when navigating to a different domain, so it would remove the cookie everytime we go to IDP to confirm the grant)
the only solution I see is add maxAge, just need to decide how long that should be ? 10, 30 minutes ? 1h ?

@DarianM DarianM merged commit 80aa32f into main Mar 21, 2025
7 checks passed
@sidvishnoi sidvishnoi deleted the al/13-request-grant-confirmation-for-config-updates branch May 27, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request grant confirmation when updating existing config

3 participants