@@ -15,6 +15,10 @@ const registerApp = async (application) => {
1515 return application
1616}
1717
18+ const getOtpTokenForSecret = async ( application , secret ) => {
19+ return application . options . crypto . totpToken ( secret , Date . now ( ) , 6 , 30 )
20+ }
21+
1822describe ( 'mfa service' , ( ) => {
1923 let application
2024
@@ -48,7 +52,7 @@ describe('mfa service', () => {
4852 expect ( await application . mfa . isMfaActivated ( ) ) . to . equal ( false )
4953
5054 const secret = await application . mfa . generateMfaSecret ( )
51- const token = await application . mfa . getOtpToken ( secret )
55+ const token = await getOtpTokenForSecret ( application , secret )
5256
5357 await application . mfa . enableMfa ( secret , token )
5458
@@ -64,7 +68,7 @@ describe('mfa service', () => {
6468
6569 Factory . handlePasswordChallenges ( application , accountPassword )
6670 const secret = await application . mfa . generateMfaSecret ( )
67- const token = await application . mfa . getOtpToken ( secret )
71+ const token = await getOtpTokenForSecret ( application , secret )
6872
6973 sinon . spy ( application . challenges , 'sendChallenge' )
7074
@@ -82,7 +86,7 @@ describe('mfa service', () => {
8286
8387 Factory . handlePasswordChallenges ( application , accountPassword )
8488 const secret = await application . mfa . generateMfaSecret ( )
85- const token = await application . mfa . getOtpToken ( secret )
89+ const token = await getOtpTokenForSecret ( application , secret )
8690
8791 await application . mfa . enableMfa ( secret , token )
8892
@@ -102,7 +106,7 @@ describe('mfa service', () => {
102106 Factory . handlePasswordChallenges ( application , accountPassword )
103107
104108 const secret = await application . mfa . generateMfaSecret ( )
105- const token = await application . mfa . getOtpToken ( secret )
109+ const token = await getOtpTokenForSecret ( application , secret )
106110
107111 await application . mfa . enableMfa ( secret , token )
108112
@@ -122,7 +126,7 @@ describe('mfa service', () => {
122126 Factory . handlePasswordChallenges ( application , accountPassword )
123127
124128 const secret = await application . mfa . generateMfaSecret ( )
125- const token = await application . mfa . getOtpToken ( secret )
129+ const token = await getOtpTokenForSecret ( application , secret )
126130
127131 await application . mfa . enableMfa ( secret , token )
128132
0 commit comments