@@ -1531,14 +1531,16 @@ export default class AuthClient {
15311531 } = { } ,
15321532 headers ?: Headers
15331533 ) : Promise < SignedInAccountData > {
1534-
1535- const oldCredentials = await this . sessionReauth ( sessionToken , options . reauthEmail || email , oldPassword , {
1536- keys : true
1537- } , headers ) ;
1538- const oldCredentialsAuth = await crypto . getCredentials (
1539- email ,
1540- oldPassword
1534+ const oldCredentials = await this . sessionReauth (
1535+ sessionToken ,
1536+ options . reauthEmail || email ,
1537+ oldPassword ,
1538+ {
1539+ keys : true ,
1540+ } ,
1541+ headers
15411542 ) ;
1543+ const oldCredentialsAuth = await crypto . getCredentials ( email , oldPassword ) ;
15421544 const oldAuthPW = oldCredentialsAuth . authPW ;
15431545
15441546 const keys = await this . accountKeys (
@@ -1547,10 +1549,7 @@ export default class AuthClient {
15471549 headers
15481550 ) ;
15491551
1550- const newCredentials = await crypto . getCredentials (
1551- email ,
1552- newPassword
1553- ) ;
1552+ const newCredentials = await crypto . getCredentials ( email , newPassword ) ;
15541553
15551554 const wrapKb = crypto . unwrapKB ( keys . kB , newCredentials . unwrapBKey ) ;
15561555 const authPW = newCredentials . authPW ;
@@ -1600,8 +1599,8 @@ export default class AuthClient {
16001599 if (
16011600 error &&
16021601 error . email &&
1603- error . errno === ERRORS . INCORRECT_EMAIL_CASE
1604- && ! options . skipCaseError
1602+ error . errno === ERRORS . INCORRECT_EMAIL_CASE &&
1603+ ! options . skipCaseError
16051604 ) {
16061605 options . skipCaseError = true ;
16071606 options . reauthEmail = email ;
@@ -2979,7 +2978,7 @@ export default class AuthClient {
29792978 }
29802979
29812980 /**
2982- * Removes a recovery phone from the user's account
2981+ * @deprecated Use recoveryPhoneDeleteWithJwt instead
29832982 *
29842983 * @param sessionToken The user's current session token
29852984 * @param headers
@@ -2988,6 +2987,17 @@ export default class AuthClient {
29882987 return this . sessionDelete ( '/recovery_phone' , sessionToken , { } , headers ) ;
29892988 }
29902989
2990+ /**
2991+ * Disables 2FA Protection on the account.
2992+ *
2993+ * @param jwt - required, must be a verified session token
2994+ * @param headers - Optional additional headers for the request
2995+ * @returns A promise that resolves when the 2FA has been removed
2996+ */
2997+ async recoveryPhoneDeleteWithJwt ( jwt : string , headers ?: Headers ) {
2998+ return this . jwtDelete ( '/mfa/recovery_phone' , jwt , { } , headers ) ;
2999+ }
3000+
29913001 /**
29923002 * Gets status of the recovery phone on the users account.
29933003 * @param sessionToken The user's current session token
0 commit comments