Green: prefer TOTP via twoFactorSessionIDV2 when passkey also enrolled
beginLogin now checks twoFactorSessionID ?? twoFactorSessionIDV2 before the passkey branch. Accounts with both passkeys and TOTP can now log in from the CLI using their authenticator app.
This commit is contained in:
1 parent
0024631ef3
commit
9fd7b6a857
2 files changed
+15
-4
No files matched your search
+8
-2
@@ -73,8 +73,14 @@ const srpHandshake = async (
|
||||
|
||||
srpClient.checkM2(Buffer.from(verifyResponse.srpM2, "base64"));
|
||||
|
||||
if (verifyResponse.twoFactorSessionID) {
|
||||
return { kind: "totp", sessionID: verifyResponse.twoFactorSessionID };
|
||||
// twoFactorSessionIDV2 is set (instead of twoFactorSessionID) when the
|
||||
// account has BOTH passkeys and TOTP. Prefer TOTP: a CLI cannot perform
|
||||
// a WebAuthn ceremony, and the user has a TOTP secret enrolled.
|
||||
const totpSessionID =
|
||||
verifyResponse.twoFactorSessionID ??
|
||||
verifyResponse.twoFactorSessionIDV2;
|
||||
if (totpSessionID) {
|
||||
return { kind: "totp", sessionID: totpSessionID };
|
||||
}
|
||||
if (verifyResponse.passkeySessionID) {
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user