@@ -22,13 +22,12 @@ import { Auth, User } from '../../../src/model/public_types';
22
22
import { getAuth , connectAuthEmulator } from '../../../' ; // Use browser OR node dist entrypoint depending on test env.
23
23
import { _generateEventId } from '../../../src/core/util/event_id' ;
24
24
import { getAppConfig , getEmulatorUrl } from './settings' ;
25
- import { getOobCodes , OobCodeSession , resetEmulator } from './emulator_rest_helpers' ;
26
- import * as config from '../../../../../config/project.json' ;
27
-
28
- //import * as otpauth from "https://deno.land/x/[email protected] /dist/otpauth.esm.js";
29
- //// <reference path="helpers.d.ts"/>
25
+ import {
26
+ getOobCodes ,
27
+ OobCodeSession ,
28
+ resetEmulator
29
+ } from './emulator_rest_helpers' ;
30
30
const totp = require ( 'totp-generator' ) ;
31
- //import * as totp from 'otpauth';
32
31
interface IntegrationTestAuth extends Auth {
33
32
cleanUp ( ) : Promise < void > ;
34
33
}
@@ -62,8 +61,6 @@ export function getTestInstance(requireEmulator = false): Auth {
62
61
63
62
auth . cleanUp = async ( ) => {
64
63
// If we're in an emulated environment, the emulator will clean up for us
65
-
66
- console . log ( 'Auth cleanup should not be called' ) ;
67
64
if ( emulatorUrl ) {
68
65
await resetEmulator ( ) ;
69
66
} else {
@@ -83,13 +80,15 @@ export function getTestInstance(requireEmulator = false): Auth {
83
80
return auth ;
84
81
}
85
82
86
- export async function cleanUpTestInstance ( auth : Auth , tests ? : string ) : Promise < void > {
83
+ export async function cleanUpTestInstance (
84
+ auth : Auth ,
85
+ tests ?: string
86
+ ) : Promise < void > {
87
87
await auth . signOut ( ) ;
88
88
89
- if ( typeof tests === 'undefined' ) {
89
+ if ( typeof tests === 'undefined' ) {
90
90
await ( auth as IntegrationTestAuth ) . cleanUp ( ) ;
91
91
}
92
-
93
92
}
94
93
95
94
function stubConsoleToSilenceEmulatorWarnings ( ) : sinon . SinonStub {
@@ -107,26 +106,26 @@ function stubConsoleToSilenceEmulatorWarnings(): sinon.SinonStub {
107
106
108
107
export async function code ( toEmail : string ) : Promise < OobCodeSession > {
109
108
const codes = await getOobCodes ( ) ;
110
- console . log ( 'codes: ' , codes ) ;
111
-
112
109
return codes . reverse ( ) . find ( ( { email } ) => email === toEmail ) ! ;
113
110
}
114
111
112
+ export function getTotpCode (
113
+ sharedSecretKey : string ,
114
+ periodSec : number ,
115
+ verificationCodeLength : number ,
116
+ hashingAlgorithm : string
117
+ ) {
118
+ let token = totp ( sharedSecretKey , {
119
+ period : periodSec ,
120
+ digits : verificationCodeLength ,
121
+ algorithm : 'SHA-1'
122
+ } ) ;
115
123
116
- export function getTotpCode ( sharedSecretKey : string , periodSec : number , verificationCodeLength : number , hashingAlgorithm : string ) {
117
-
118
- let token = totp ( sharedSecretKey , { period : periodSec , digits : verificationCodeLength , algorithm : 'SHA-1' } ) ;
119
-
120
-
121
- return token
122
-
124
+ return token ;
123
125
}
124
126
125
- export function delay ( dt :number ) {
126
-
127
- console . log ( 'Delay called' ) ;
128
-
129
- return new Promise ( resolve => setTimeout ( resolve , dt ) ) ;
127
+ export function delay ( dt : number ) {
128
+ return new Promise ( resolve => setTimeout ( resolve , dt ) ) ;
130
129
}
131
130
132
131
export const email = '[email protected] ' ;
0 commit comments