Skip to content

Commit 7cdead8

Browse files
committed
Missing types and fix web parity
1 parent c880081 commit 7cdead8

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

packages/auth/lib/TotpMultiFactorGenerator.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,11 @@ export default class TotpMultiFactorGenerator {
2525
}
2626

2727
static assertionForSignIn(uid, verificationCode) {
28-
// There is no logic here, we mainly do this for API compatibility
29-
// (following the Web API).
3028
return { uid, verificationCode };
3129
}
3230

3331
static assertionForEnrollment(totpSecret, verificationCode) {
34-
// There is no logic here, we mainly do this for API compatibility
35-
// (following the Web API).
36-
return { totpSecret, verificationCode };
32+
return { totpSecret: totpSecret.secretKey, verificationCode };
3733
}
3834

3935
static async generateSecret(session, auth) {

packages/auth/lib/index.d.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,16 @@ export namespace FirebaseAuthTypes {
276276
}
277277

278278
export interface TotpMultiFactorGenerator {
279-
FACTOR_ID: FactorId.TOTP;
279+
static FACTOR_ID: FactorId.TOTP;
280280

281-
assertionForSignIn(uid: string, totpSecret: string): MultiFactorAssertion;
281+
static assertionForSignIn(uid: string, totpSecret: string): MultiFactorAssertion;
282+
283+
static assertionForEnrollment(secret: TotpSecret, code: string): MultiFactorAssertion;
284+
285+
/**
286+
* @param auth - The Auth instance. Only used for native platforms, should be ignored on web.
287+
*/
288+
static generateSecret(session: FirebaseAuthTypes.MultiFactorSession, auth: FirebaseAuthTypes.Auth): Promise<TotpSecret>;
282289
}
283290

284291
export declare interface MultiFactorError extends AuthError {

0 commit comments

Comments
 (0)