@@ -155,9 +155,7 @@ export async function handleMFASetupChallenge({
155
155
} : HandleAuthChallengeRequest ) : Promise < RespondToAuthChallengeCommandOutput > {
156
156
const { userPoolId, userPoolClientId, userPoolEndpoint } = config ;
157
157
158
- const trimmedChallengeResponse = challengeResponse . trim ( ) ;
159
-
160
- if ( trimmedChallengeResponse === 'EMAIL' ) {
158
+ if ( challengeResponse === 'EMAIL' ) {
161
159
return {
162
160
ChallengeName : 'MFA_SETUP' ,
163
161
Session : session ,
@@ -168,7 +166,7 @@ export async function handleMFASetupChallenge({
168
166
} ;
169
167
}
170
168
171
- if ( trimmedChallengeResponse === 'TOTP' ) {
169
+ if ( challengeResponse === 'TOTP' ) {
172
170
return {
173
171
ChallengeName : 'MFA_SETUP' ,
174
172
Session : session ,
@@ -183,7 +181,7 @@ export async function handleMFASetupChallenge({
183
181
USERNAME : username ,
184
182
} ;
185
183
186
- const isTOTPCode = / ^ \d + $ / . test ( trimmedChallengeResponse ) ;
184
+ const isTOTPCode = / ^ \d + $ / . test ( challengeResponse ) ;
187
185
188
186
if ( isTOTPCode ) {
189
187
const verifySoftwareToken = createVerifySoftwareTokenClient ( {
@@ -198,7 +196,7 @@ export async function handleMFASetupChallenge({
198
196
userAgentValue : getAuthUserAgentValue ( AuthAction . ConfirmSignIn ) ,
199
197
} ,
200
198
{
201
- UserCode : trimmedChallengeResponse ,
199
+ UserCode : challengeResponse ,
202
200
Session : session ,
203
201
FriendlyDeviceName : deviceName ,
204
202
} ,
@@ -232,10 +230,10 @@ export async function handleMFASetupChallenge({
232
230
) ;
233
231
}
234
232
235
- const isEmail = trimmedChallengeResponse . includes ( '@' ) ;
233
+ const isEmail = challengeResponse . includes ( '@' ) ;
236
234
237
235
if ( isEmail ) {
238
- challengeResponses . EMAIL = trimmedChallengeResponse ;
236
+ challengeResponses . EMAIL = challengeResponse ;
239
237
240
238
const jsonReq : RespondToAuthChallengeCommandInput = {
241
239
ChallengeName : 'MFA_SETUP' ,
0 commit comments