Skip to content

Commit

Permalink
Update multifactorauth endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
deepjyoti30-st committed Oct 14, 2024
1 parent 848c8a8 commit ed648ed
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 113 deletions.
3 changes: 3 additions & 0 deletions lib/build/recipe/multifactorauth/api/implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ function getAPIInterface() {
phoneNumbers: getPhoneNumbersForFactorsResult.factorIdToPhoneNumberMap,
};
},
factorsForUserGET: undefined,
addFactorForUserPOST: undefined,
deleteFactorForUserDELETE: undefined,
};
}
exports.default = getAPIInterface;
94 changes: 39 additions & 55 deletions lib/build/recipe/multifactorauth/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,61 +106,45 @@ export declare type APIInterface = {
}
| GeneralErrorResponse
>);
factorsSetupForUserGET?: (input: {
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
factors: {
id: string;
details: JSONObject;
}[];
backupCodes: string[] | undefined;
}
| GeneralErrorResponse
>;
addFactorForUserPOST?: (input: {
factor: {
id: string;
};
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
backupCodes: string[];
}
| GeneralErrorResponse
>;
deleteFactorForUserDELETE?: (input: {
factorId: string;
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
}
| GeneralErrorResponse
>;
generateBackupCodesPOST?: (input: {
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
backupCodes: string[];
}
| {
status: "NO_FACTORS_ARE_SETUP";
reason: string;
}
| GeneralErrorResponse
>;
factorsForUserGET:
| undefined
| ((input: {
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
factors: string[];
}
| GeneralErrorResponse
>);
addFactorForUserPOST:
| undefined
| ((input: {
factorId: string;
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
}
| GeneralErrorResponse
>);
deleteFactorForUserDELETE:
| undefined
| ((input: {
factorId: string;
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
}
| GeneralErrorResponse
>);
};
export declare type GetFactorsSetupForUserFromOtherRecipesFunc = (
user: User,
Expand Down
3 changes: 3 additions & 0 deletions lib/ts/recipe/multifactorauth/api/implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,8 @@ export default function getAPIInterface(): APIInterface {
phoneNumbers: getPhoneNumbersForFactorsResult.factorIdToPhoneNumberMap,
};
},
factorsForUserGET: undefined,
addFactorForUserPOST: undefined,
deleteFactorForUserDELETE: undefined,
};
}
99 changes: 41 additions & 58 deletions lib/ts/recipe/multifactorauth/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,64 +136,47 @@ export type APIInterface = {
| GeneralErrorResponse
>);

factorsSetupForUserGET?: (input: {
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
factors: {
id: string;
details: JSONObject;
}[];
backupCodes: string[] | undefined;
}
| GeneralErrorResponse
>;

addFactorForUserPOST?: (input: {
factor: {
id: string;
};
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
backupCodes: string[];
}
| GeneralErrorResponse
>;

deleteFactorForUserDELETE?: (input: {
factorId: string;
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
}
| GeneralErrorResponse
>;

generateBackupCodesPOST?: (input: {
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
backupCodes: string[];
}
| {
status: "NO_FACTORS_ARE_SETUP";
reason: string;
}
| GeneralErrorResponse
>;
factorsForUserGET:
| undefined
| ((input: {
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
factors: string[];
}
| GeneralErrorResponse
>);

addFactorForUserPOST:
| undefined
| ((input: {
factorId: string;
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
}
| GeneralErrorResponse
>);

deleteFactorForUserDELETE:
| undefined
| ((input: {
factorId: string;
session: SessionContainerInterface;
options: APIOptions;
userContext: UserContext;
}) => Promise<
| {
status: "OK";
}
| GeneralErrorResponse
>);
};

export type GetFactorsSetupForUserFromOtherRecipesFunc = (user: User, userContext: UserContext) => Promise<string[]>;
Expand Down

0 comments on commit ed648ed

Please sign in to comment.