Skip to content

Commit

Permalink
(types) Add typedefs for enrollSecondAuthFactor() and `verifySecond…
Browse files Browse the repository at this point in the history
…AuthFactor).

Update typedef for `verifyPhoneNumber()`
  • Loading branch information
dpa99c committed Nov 7, 2022
1 parent 1256abd commit 180f408
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
41 changes: 38 additions & 3 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,46 @@ export interface FirebasePlugin {
error?: (err: string) => void
): void
verifyPhoneNumber(
success: (value: object) => void,
success: (value: object | boolean) => void,
error: (err: string) => void,
phoneNumber: string,
opts?: {
timeOutDuration: number,
fakeVerificationCode: string,
requireSmsValidation: boolean
},
): void
enrollSecondAuthFactor(
success: (value: object | boolean) => void,
error: (err: string) => void,
phoneNumber: string,
timeOutDuration: number,
fakeVerificationCode?: string
opts?: {
displayName: string,
credential: {
verificationId: string,
code: string
},
timeOutDuration: number,
fakeVerificationCode: string,
requireSmsValidation: boolean
},
): void
verifySecondAuthFactor(
success: (value: object | boolean) => void,
error: (err: string) => void,
params: {
selectedIndex?: number,
credential?: {
verificationId: string,
code: string
},
},
opts?: {
timeOutDuration: number,
fakeVerificationCode: string,
phoneNumber: string,
requireSmsValidation: boolean
},
): void
setLanguageCode(
lang: string,
Expand Down
4 changes: 2 additions & 2 deletions www/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,14 @@ exports.didCrashOnPreviousExecution = function (success, error) {


// Authentication
exports.verifyPhoneNumber = function (success, error, number, opts) {
exports.verifyPhoneNumber = function (success, error, phoneNumber, opts) {
if(typeof opts !== 'object') opts = {};
exec(function(credential){
if(typeof credential === 'object'){
credential.instantVerification = ensureBoolean(credential.instantVerification);
}
success(credential);
}, error, "FirebasePlugin", "verifyPhoneNumber", [number, opts]);
}, error, "FirebasePlugin", "verifyPhoneNumber", [phoneNumber, opts]);
};

exports.enrollSecondAuthFactor = function (success, error, number, opts) {
Expand Down

0 comments on commit 180f408

Please sign in to comment.