Fix apple auth scope (0xsequence#950) #243
Fix apple auth scope (0xsequence#950) #243Dargon789 wants to merge 10 commits intoDargon789:0xsequence-1.9.19from
Conversation
* Fix apple auth scope * Fix Apple auth scope test
…ession config helper
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
|
|
Reviewer's GuideAdjusts OAuth scope handling for Apple login, enhances dapp-client session utilities and exports, extends supported login methods with EOA, and rolls forward package versions and changelogs across the monorepo for new beta releases focused on Apple auth fixes and dapp-client updates. Sequence diagram for updated Apple OAuth auth code URL generationsequenceDiagram
participant DappClient
participant AuthCodeHandler
participant OAuthProvider
DappClient->>AuthCodeHandler: buildAuthUrl(signupKind)
AuthCodeHandler->>AuthCodeHandler: init URLSearchParams(client_id, redirect_uri, response_type, state)
alt signupKind is apple
AuthCodeHandler->>AuthCodeHandler: do not set scope parameter
else other OAuth providers
AuthCodeHandler->>AuthCodeHandler: set scope=openid profile email
end
AuthCodeHandler-->>DappClient: oauthUrlWithQuery
DappClient->>OAuthProvider: redirect user to oauthUrlWithQuery
Class diagram for new explicit session configuration types and updated login methodsclassDiagram
class SessionDuration {
+number days
+number hours
+number minutes
}
class NativeTokenSpending {
+bigint valueLimit
+Address.Address[] allowedRecipients
}
class ExplicitSessionParams {
+number chainId
+SessionDuration expiresIn
+Permission.Permission[] permissions
+NativeTokenSpending nativeTokenSpending
}
class ExplicitSessionConfig {
+number chainId
+bigint valueLimit
+bigint deadline
+Permission.Permission[] permissions
}
class DappClientUtils {
+createExplicitSessionConfig(params ExplicitSessionParams) ExplicitSessionConfig
}
class LoginMethod {
google
apple
email
passkey
mnemonic
eoa
}
ExplicitSessionParams --> SessionDuration : expiresIn
ExplicitSessionParams --> NativeTokenSpending : nativeTokenSpending
DappClientUtils ..> ExplicitSessionConfig : creates
DappClientUtils ..> ExplicitSessionParams : uses
Flow diagram for createExplicitSessionConfig logicflowchart TD
A["Start createExplicitSessionConfig(params)"] --> B["Compute nowInSeconds from Date.now()"]
B --> C["Calculate sessionLifetimeSeconds from expiresIn days, hours, minutes"]
C --> D["deadline = nowInSeconds + BigInt(sessionLifetimeSeconds)"]
D --> E{"params.permissions is empty?"}
E -->|"Yes"| F["Throw Error: At least one permission is required"]
E -->|"No"| G["Read nativeTokenSpending from params"]
G --> H["Set valueLimit from nativeTokenSpending or 0n"]
H --> I["Collect nativeTokenReceivers from allowedRecipients"]
I --> J["Map nativeTokenReceivers to nativeTokenSpendingPermissions"]
J --> K["Merge params.permissions with nativeTokenSpendingPermissions"]
K --> L["Return ExplicitSessionConfig { chainId, valueLimit, deadline, permissions }"]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Summary of ChangesHello @Dargon789, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request primarily focuses on refining the Apple authentication process within the system by ensuring the correct handling of OAuth scopes. Concurrently, it significantly upgrades the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
createExplicitSessionConfig,sessionLifetimeSecondsis calculated as a plain number before being cast toBigInt; consider either validating upper bounds or doing the arithmetic inBigIntto avoid potential overflow if very large durations are passed in. createExplicitSessionConfigcurrently allows anexpiresInof all zeros, resulting in an immediate expiry; if this is not desired, consider enforcing a minimum non-zero duration or throwing when the computed lifetime is zero.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `createExplicitSessionConfig`, `sessionLifetimeSeconds` is calculated as a plain number before being cast to `BigInt`; consider either validating upper bounds or doing the arithmetic in `BigInt` to avoid potential overflow if very large durations are passed in.
- `createExplicitSessionConfig` currently allows an `expiresIn` of all zeros, resulting in an immediate expiry; if this is not desired, consider enforcing a minimum non-zero duration or throwing when the computed lifetime is zero.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Code Review
This pull request correctly fixes an issue with Apple authentication by conditionally omitting the scope parameter, and adds a corresponding test to verify the behavior. It also introduces support for EOA (Externally Owned Account) login and exports new helper functions for creating explicit session configurations. While the changes are generally good, I've identified a logical issue in the new createExplicitSessionConfig helper function that could cause it to incorrectly reject valid session configurations. My review includes a suggestion to fix this.
|
@tolgahan-arikan is attempting to deploy a commit to the Foundry development Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
2c49090
15de255
Summary by Sourcery
Adjust authentication and session utilities in the dapp client while fixing Apple OAuth handling and updating package versions and changelogs across the workspace.
New Features:
Bug Fixes:
Enhancements:
Build:
Tests:
Chores: