Skip to content

Adds Controller required for seed #14889

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

Closed
wants to merge 0 commits into from
Closed

Conversation

ieow
Copy link
Contributor

@ieow ieow commented Apr 25, 2025

Description

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

github-actions bot commented Apr 25, 2025

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@ieow
Copy link
Contributor Author

ieow commented Apr 28, 2025

I have read the CLA Document and I hereby sign the CLA

@chaitanyapotti chaitanyapotti added the No QA Needed Apply this label when your PR does not need any QA effort. label Apr 28, 2025
@chaitanyapotti chaitanyapotti marked this pull request as ready for review April 29, 2025 09:17
@chaitanyapotti chaitanyapotti requested review from a team as code owners April 29, 2025 09:17
@chaitanyapotti chaitanyapotti changed the title Feat/main seedless onboarding controller integration Adds OAuth Controller required for seedless onboarding Apr 29, 2025
@@ -0,0 +1,80 @@
import { AuthSessionResult } from 'expo-auth-session';
Copy link
Contributor

Choose a reason for hiding this comment

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

@chaitanyapotti I would recommend that you add these directories to the .github/CODEOWNERS file.

@ieow ieow mentioned this pull request Apr 30, 2025
7 tasks
Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

Left some comments

} from '@metamask/seedless-onboarding-controller';
import { Encryptor, LEGACY_DERIVATION_OPTIONS } from '../../../Encryptor';

export const web3AuthNetwork = process.env.Web3AuthNetwork as Web3AuthNetwork;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export const web3AuthNetwork = process.env.Web3AuthNetwork as Web3AuthNetwork;
export const web3AuthNetwork = process.env.WEB3_AUTH_NETWORK as Web3AuthNetwork;

Also, should this be moved into a constants file or just use the env var inline

export const web3AuthNetwork = process.env.Web3AuthNetwork as Web3AuthNetwork;

if (!web3AuthNetwork) {
throw new Error('Missing environment variables');
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
throw new Error('Missing environment variables');
throw new Error('Missing environment variable WEB3_AUTH_NETWORK');

}

const encryptor = new Encryptor({
keyDerivationOptions: LEGACY_DERIVATION_OPTIONS,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not familiar with the different types of derivation options but I know we're using it in many places. @ccharly Can you take a look at this if it's fine?

) {
return baseControllerMessenger.getRestricted({
name: 'SeedlessOnboardingController',
allowedEvents: [],
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have visibility to the seedless onboarding controller. Does the controller use actions or events of other controllers?

@@ -485,5 +485,8 @@
}
]
}
},
"SeedlessOnboardingController": {
Copy link
Contributor

Choose a reason for hiding this comment

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

To be safe, let's also create a new migration to prepopulate the controller with this state

package.json Outdated
@@ -332,6 +340,7 @@
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^1.10.3",
"react-native-get-random-values": "^1.8.0",
"react-native-google-acm": "git+https://github.com/Web3Auth/react-native-google-acm.git#edf4e52397f766d56d1644d908246e358f3cf774",
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we bypass the paid version by forking our own and adding our own implementation?

}

export class OAuthService {
public localState: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Extract types

ReduxService.store.dispatch({
type: UserActionType.LOADING_SET,
payload: {
loadingMsg: 'Logging in...',
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably not necessary to pass in payload since this is static. We can just set it in the reducer itself

data: AuthResponse,
authConnection: AuthConnection,
): Promise<{
type: 'success' | 'error';
Copy link
Contributor

Choose a reason for hiding this comment

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

Extract into enum

}

if (!AuthServerUrl || !AuthConnectionId || !GroupedAuthConnectionId) {
throw new Error('Missing environment variables');
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's move this condition to the top of the file below imports and specify explicitly, which env vars are missing

Copy link

socket-security bot commented May 5, 2025

Caution

Review the following alerts detected in dependencies.

According to your organization's Security Policy, you must resolve all "Block" alerts before proceeding. Learn more about Socket for GitHub.

Action Severity Alert (click for details)
Block Medium
npm/@toruslabs/[email protected] has Network access.

Module: globalThis["fetch"]

Location: Package overview

From: yarn.locknpm/@toruslabs/[email protected]

ℹ Read more on: This package | This alert | What is network access?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@toruslabs/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Medium
npm/@toruslabs/[email protected] has Network access.

Module: globalThis["fetch"]

Location: Package overview

From: yarn.locknpm/@toruslabs/[email protected]

ℹ Read more on: This package | This alert | What is network access?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@toruslabs/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Medium
npm/[email protected] has Network access.

Module: globalThis["fetch"]

Location: Package overview

From: package.jsonnpm/[email protected]

ℹ Read more on: This package | This alert | What is network access?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
npm/[email protected] has a New author.

New Author: ljharb

Previous Author:

From: yarn.locknpm/[email protected]

ℹ Read more on: This package | This alert | What is new author?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Scrutinize new collaborator additions to packages because they now have the ability to publish code into your dependency tree. Packages should avoid frequent or unnecessary additions or changes to publishing rights.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@ieow ieow closed this May 13, 2025
@ieow ieow force-pushed the feat/main-seedless-onboarding branch from d61cbbb to 6895dbe Compare May 13, 2025 12:58
@github-project-automation github-project-automation bot moved this from Needs dev review to Merged, Closed or Archived in PR review queue May 13, 2025
@github-actions github-actions bot locked and limited conversation to collaborators May 13, 2025
@ieow ieow removed the team-web3auth Web3Auth team label May 13, 2025
@ieow ieow changed the title Adds OAuth Controller required for seedless onboarding Adds Controller required for seed May 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-onboarding No QA Needed Apply this label when your PR does not need any QA effort.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants