-
Notifications
You must be signed in to change notification settings - Fork 148
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
feat: add mfa totp to the email otp flow #1389
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
expirationSeconds, | ||
redirectParams: params.redirectParams, | ||
}); | ||
if (existingUser) { |
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 whole method should probably be broken up into multiple methods but I figured I could do that as a separate task if we want to circle back to it
@@ -68,6 +73,12 @@ export class RNSignerClient extends BaseSignerClient<undefined> { | |||
targetPublicKey: publicKey, | |||
}); | |||
|
|||
if (!credentialBundle) { |
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.
@@ -21,6 +22,11 @@ export enum AlchemySignerStatus { | |||
AWAITING_OTP_AUTH = "AWAITING_OTP_AUTH", | |||
} | |||
|
|||
export enum AlchemyMfaStatus { |
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 this need a 3rd state of "completed"?
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 guess looking at some of Josh's PRs it might also need a "disabled"
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 think there are two separate states at play here. The state of the mfa factor and whether or not a user requires mfa on login.
I was thinking that AlchemyMfaStatus would be the User level required/not required at sign in state.
|
||
export type MfaState = { | ||
factors?: MfaFactor[]; | ||
multiFactorState: "required" | "not_required"; |
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.
is this just AlchemyMfaStatus?
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.
Yeah good catch
organizationId: this.user.orgId, | ||
}); | ||
|
||
return this.request("/v1/auth-list-multi-factors", { |
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.
Worth gut checking to see if this request already includes the jwt in the headers? https://github.com/alchemyplatform/aa-sdk/blob/008812b0/account-kit/signer/src/client/base.ts#L374 We might not even need to have the stamped request object in there.
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.
Just checked and when the api call is made, the jwt is undefined
|
||
switch (params.factorType) { | ||
case "totp": | ||
return this.request("/v1/auth-request-multi-factor", { |
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 thing we may have forgetten is specifying which type of multifactor @0xfourzerofour. We might want that as a parameter here just for the sake of future proofing.
Pull Request Checklist
yarn test
)site
folder, and guidelines for updating/adding docs can be found in the contribution guide)feat!: breaking change
)yarn lint:check
) and fix any issues? (yarn lint:write
)New api
// Setting up MFA
Authenticating (email + otp)
Authenticating (email + magic link)
PR-Codex overview
This PR primarily focuses on enhancing the multi-factor authentication (MFA) functionality in the
@account-kit/signer
package. It introduces new types, methods, and documentation related to MFA, ensuring better handling and management of MFA factors.Detailed summary
isMfaRequired
toTemporarySession
type.AlchemyMfaStatus
enum with valuesNOT_REQUIRED
andREQUIRED
.getMfaFactors
,addMfa
,verifyMfa
, andremoveMfa
inBaseSignerClient
andAlchemySignerWebClient
.RNSignerClient
to override MFA methods with errors if not implemented..mdx
files.BaseAlchemySigner
.