Skip to content

[B3-2843] [WIP] TK EOA Auth#407

Draft
GioLogist wants to merge 1 commit intomainfrom
B3-2843-tk-eoa-auth
Draft

[B3-2843] [WIP] TK EOA Auth#407
GioLogist wants to merge 1 commit intomainfrom
B3-2843-tk-eoa-auth

Conversation

@GioLogist
Copy link
Collaborator

[LINEAR_ISSUE_ID_HERE]

Description

Write a description.

Test Plan

  • Locally
  • Unit Tests
  • Manually
  • CI/CD

Screenshots

For BE, include snippets, response payloads and/or curl commands to test endpoints

[FE] Before

[FE] After

[BE] Snippets/Response/Curl


automerge=false

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @GioLogist, 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 lays the groundwork for integrating external wallet authentication into the B3 sign-in process. It enhances the existing Turnkey authentication modal by introducing a new step where users can select their preferred authentication method: either the current email/OTP flow or a new external wallet connection option. While the user interface for wallet selection and initial detection of wallets is implemented, the complete backend authentication logic for external wallets is noted as a work in progress.

Highlights

  • External Wallet Authentication Integration: This pull request introduces the initial framework for external wallet authentication (EOA Auth) within the B3 sign-in flow, allowing users to potentially connect their existing wallets for authentication.
  • New Authentication Method Selection UI: A new 'method' step has been added to the Turnkey authentication modal, presenting users with a choice between traditional email/OTP authentication and external wallet connection.
  • Wallet Detection and Connection UI: The system can now detect available Ethereum wallets (like MetaMask) and display them in a dedicated 'wallet' step, although the full authentication logic for external wallets is marked as a future implementation.
  • Dependency Addition: The @turnkey/react-wallet-kit package has been added as a dependency, indicating the use of Turnkey's toolkit for wallet interactions.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces initial support for external wallet authentication within the TurnkeyAuthModal by adding a new dependency (@turnkey/react-wallet-kit), modifying the modal's flow to include method selection and wallet connection steps, and exposing an enableWalletAuth prop. The reviewer noted that the wallet authentication feature is not yet fully functional, recommending either disabling it or improving communication until it's complete. Additionally, the reviewer suggested using thirdweb's existing wallet connectors instead of direct window.ethereum access for better robustness and making the hardcoded 'ethereum' chain dynamic to support multi-chain capabilities.

// For now, we'll need to implement the actual Turnkey wallet auth
// This would involve signing a message with the wallet and sending it to the backend
// TODO: Implement full wallet authentication flow with Turnkey
setWalletError("Wallet authentication coming soon. Please use email authentication for now.");
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The TODO comment and the user-facing message "Wallet authentication coming soon. Please use email authentication for now." indicate that the wallet authentication feature is not yet functional. Presenting a non-functional option to users can lead to a poor experience. Consider either:

  1. Disabling the option: If the feature is not ready, it might be better to disable the "External Wallet" button or hide it entirely until it's fully implemented.
  2. Clearer communication: If it must be shown, ensure the message is very prominent and explains why it's not available (e.g., "This feature is under development and will be available soon.").

Given this is a [WIP] PR, this might be acceptable for now, but it's a high-priority item before merging to main.

Comment on lines +119 to +121
if (typeof window !== "undefined" && (window as any).ethereum) {
const ethereum = (window as any).ethereum;
const accounts = await ethereum.request({ method: "eth_requestAccounts" });
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Directly accessing window.ethereum can be less robust than using thirdweb's wallet connectors, which are already integrated into the SDK. Leveraging thirdweb's utilities for wallet detection and connection would provide a more consistent and resilient experience, handling various wallet injection scenarios and potential edge cases more gracefully.

{
name: ethereum.isMetaMask ? "MetaMask" : "Ethereum Wallet",
address: accounts[0],
chain: "ethereum",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The chain property is hardcoded to "ethereum" here. If the SDK is intended to support multiple EVM chains, this should be made dynamic to reflect the currently active chain or allow for selection of other supported chains. Hardcoding it limits the flexibility and potential multi-chain capabilities of the wallet authentication feature.

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.

1 participant