Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: WebAuthN support #966

Merged
merged 130 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
c57b645
add initial passkey types
niftyvictor Oct 10, 2024
56422f3
passkey types cleanup
niftyvictor Oct 11, 2024
f102128
added untested support for options, sign in and sign up methods
niftyvictor Oct 16, 2024
de9fb88
Merge branch 'feat/webauthn/base' into feat/webauthn/basic-methods
niftyvictor Oct 16, 2024
40bd6e9
updated types based on pr changes
niftyvictor Oct 17, 2024
e150fc2
pr changes. removed incorrect errors and added missing ones
niftyvictor Oct 18, 2024
8c8d711
added missing user type
niftyvictor Oct 18, 2024
ced57b1
added webauthn details to user object
niftyvictor Oct 18, 2024
fbbed56
pr fixes. centralized error types and added crud for credentials
niftyvictor Oct 21, 2024
64a4a6b
pr fixes
niftyvictor Oct 21, 2024
3186aa5
pr fixes and added decode method
niftyvictor Oct 21, 2024
3fa31ce
added types implementation and minor fixes
niftyvictor Oct 28, 2024
177b580
pr fixes
niftyvictor Oct 28, 2024
5d1363e
pr fixes and cleanup
niftyvictor Oct 28, 2024
57e210d
pr fixes
niftyvictor Oct 28, 2024
ea42bd1
updated initial recipe implementation
niftyvictor Oct 29, 2024
b8cffc1
fixed implementation
niftyvictor Nov 6, 2024
bf9e00f
added basic build
niftyvictor Nov 8, 2024
b44752f
added basic build exports
niftyvictor Nov 8, 2024
dba5cda
pr fixes
niftyvictor Nov 8, 2024
c84a76a
pr fixes
niftyvictor Nov 8, 2024
3649b45
pr fixes
niftyvictor Nov 12, 2024
3bb7234
pr fixes
niftyvictor Nov 12, 2024
ce371d1
pr fixes
niftyvictor Nov 12, 2024
d356701
added missing default email delivery implementation
niftyvictor Nov 25, 2024
e743046
added basic tests and mock
niftyvictor Nov 25, 2024
6a2e53f
Merge pull request #952 from supertokens/feat/webauthn/basic-methods
coolbueb Nov 25, 2024
fbb2d4b
feat: added API testing
coolbueb Dec 3, 2024
ab6980d
Add support for correct types for signup and signin endpoints (#967)
deepjyoti30-st Jan 8, 2025
8dcca2d
WebAuthn API testing updates (#971)
coolbueb Jan 8, 2025
00f03b5
added expires at and created at and minor fixes and register crendeti…
niftyvictor Jan 14, 2025
48fbcde
Merge remote-tracking branch 'origin/feat/webauthn/base' into feat/we…
niftyvictor Jan 14, 2025
217bbd3
fix
niftyvictor Jan 14, 2025
eafcf8e
Split listUsersByAccountInfo input type from AccountInfo (#973)
coolbueb Jan 21, 2025
fd87984
removed email support for sign in
niftyvictor Jan 21, 2025
8e68827
Add fix for not requiring email in webauthn sign in
deepjyoti30-st Jan 27, 2025
f3fd0dd
Add build files for changes related to email not being required
deepjyoti30-st Jan 27, 2025
813bd39
added support for backend-sdk-testing
niftyvictor Jan 29, 2025
c0cc3bc
test fixes
niftyvictor Jan 31, 2025
93f30d6
added more test details
niftyvictor Jan 31, 2025
262942b
test fixes
niftyvictor Jan 31, 2025
bd6ef14
test fixes
niftyvictor Jan 31, 2025
9979d7b
test fixes
niftyvictor Jan 31, 2025
376a658
test fixes
niftyvictor Jan 31, 2025
d6bfac8
test fixes
niftyvictor Jan 31, 2025
5221d4b
test fixes
niftyvictor Feb 3, 2025
11f52c0
test fixes
niftyvictor Feb 4, 2025
88377de
updated registerOptions to use the core to get the user email when us…
niftyvictor Feb 5, 2025
a0155f2
Fix method used for getting user details from recover account token
deepjyoti30-st Feb 5, 2025
7c2441e
fix user retrieval by token path
niftyvictor Feb 5, 2025
8e842c6
added missing build
niftyvictor Feb 5, 2025
a4db5f3
test cleanup and fixes
niftyvictor Feb 5, 2025
276769f
Fix issue of parsing email from webauthn user retrieval endpoint
deepjyoti30-st Feb 6, 2025
310a5f8
fix email changes
niftyvictor Feb 6, 2025
1dcb7e5
fix recipeuserid not being passed correctly to registerCredential
niftyvictor Feb 6, 2025
7c5e3c8
type fixes
niftyvictor Feb 6, 2025
9508175
test fixes
niftyvictor Feb 6, 2025
4e04c20
test fixes
niftyvictor Feb 6, 2025
8baa775
fix listUsersByAccountInfo not suing webauthn
niftyvictor Feb 7, 2025
538b5ca
fix sign in adn removed logs
niftyvictor Feb 7, 2025
5308253
fix user verification
niftyvictor Feb 7, 2025
5b87089
updated tests and added userPresence support
niftyvictor Feb 10, 2025
873df1e
test fixes
niftyvictor Feb 11, 2025
1c350be
error handling cleanup and general cleanup
niftyvictor Feb 13, 2025
ade3611
added more tests
niftyvictor Feb 14, 2025
3276174
added more error tests
niftyvictor Feb 14, 2025
0311240
removed email exists error message
niftyvictor Feb 14, 2025
d79d6cb
test fixes, mising tests and build code
niftyvictor Feb 14, 2025
209c789
updated recover account link
niftyvictor Feb 14, 2025
e1655f9
test fixes
niftyvictor Feb 14, 2025
cc3d449
test fixes
niftyvictor Feb 14, 2025
179646f
test fixes
niftyvictor Feb 14, 2025
13beb1b
test fixes
niftyvictor Feb 16, 2025
2cc3347
test fixes
niftyvictor Feb 17, 2025
7a654db
test fixes
niftyvictor Feb 17, 2025
a4c0332
added email verification tests
niftyvictor Feb 19, 2025
d22e26d
added dev info
niftyvictor Feb 19, 2025
27fa091
fix rp id on sign in options
niftyvictor Feb 19, 2025
bb71308
added dev info
niftyvictor Feb 19, 2025
52e71dc
updated cdi version
niftyvictor Feb 21, 2025
59e0da3
updated cdi version
niftyvictor Feb 22, 2025
162bdc9
reverted cdi version for deployment
niftyvictor Feb 22, 2025
1b209ea
updated cdi version and test updates
niftyvictor Feb 22, 2025
1229fff
test fixes
niftyvictor Feb 23, 2025
b46ccc6
Update forceRunCI to start testing CI for webauthn
deepjyoti30-st Feb 28, 2025
aa4c9d4
testing repo fixes
niftyvictor Feb 28, 2025
03cd332
move tests to testing repo
niftyvictor Feb 28, 2025
f2d2fb2
Merge remote-tracking branch 'origin/feat/webauthn/base' into feat/we…
niftyvictor Feb 28, 2025
510147f
ci: fix forceRunCI
porcellus Feb 28, 2025
3376a45
chore: update coreDriverInterfaceSupported.json
porcellus Feb 28, 2025
6e9e475
Update forceRunCI to updated branches in core and plugin interface
deepjyoti30-st Mar 4, 2025
b9d8731
recover account token email find fix
niftyvictor Mar 4, 2025
e285a6f
type fixes and cleanup webauthn recipe
niftyvictor Mar 4, 2025
7a8c472
cleanup
niftyvictor Mar 4, 2025
b9f4a64
type fixes
niftyvictor Mar 6, 2025
f933a3d
type fixes
niftyvictor Mar 6, 2025
20826a5
pr fixes
niftyvictor Mar 10, 2025
d078be1
pr fixes
niftyvictor Mar 10, 2025
7de6023
pr fixes
niftyvictor Mar 10, 2025
160ca8e
fix: consolidate WebAuthn error handling for invalid credentials
niftyvictor Mar 10, 2025
a85bec4
Add support for installing node 18 for tests to run auth-react
deepjyoti30-st Mar 11, 2025
29259f7
Change the filter logic temporarily to make auth-react tests run on w…
deepjyoti30-st Mar 11, 2025
7f4e3f0
Fix step for installing nvm
deepjyoti30-st Mar 11, 2025
17b9220
Try to install node independent of nvm to run tests
deepjyoti30-st Mar 11, 2025
08e199f
Make changes to run tests with node 18 image
deepjyoti30-st Mar 11, 2025
af2cf4c
Make install java script executable for it to run
deepjyoti30-st Mar 11, 2025
a962b25
Merge branch 'fix/ci-image-to-node-18' into feat/webauthn/base
deepjyoti30-st Mar 12, 2025
15a481a
Update forceRunCI since core/plugin-interface was merged
deepjyoti30-st Mar 12, 2025
9b8f0e1
Change the filter branches for run trigger
deepjyoti30-st Mar 12, 2025
20fcb5e
feat: prioritize session login method email in WebAuthn email list an…
niftyvictor Mar 12, 2025
aed2e62
Merge remote-tracking branch 'origin/feat/webauthn/base' into feat/we…
niftyvictor Mar 12, 2025
b64046f
chore: Remove feat/webauthn/base branch filter from CircleCI config
niftyvictor Mar 12, 2025
1c7c67f
added build
niftyvictor Mar 12, 2025
b4e33c0
Update auth-react-server to support running webauthn
deepjyoti30-st Mar 12, 2025
f240884
Merge remote-tracking branch 'origin/master' into feat/webauthn/base
porcellus Mar 12, 2025
a4c67f5
Add logs for storing/retrieving webauthn token for debugging
deepjyoti30-st Mar 13, 2025
91f6ace
Update branch mappings in forceRunCI to use 4.1
deepjyoti30-st Mar 13, 2025
df96816
chore: add 4.1 as supported FDI
porcellus Mar 13, 2025
f193c35
added release notes
niftyvictor Mar 13, 2025
f8765f1
updated version to 22
niftyvictor Mar 13, 2025
d14c29b
Update sdk-testing map to use branch with fixes
deepjyoti30-st Mar 13, 2025
1d39a0d
Revert "Update sdk-testing map to use branch with fixes"
deepjyoti30-st Mar 13, 2025
0ad1ebe
test fixes
niftyvictor Mar 13, 2025
f83b89c
Merge remote-tracking branch 'origin/feat/webauthn/base' into feat/we…
niftyvictor Mar 13, 2025
2c957ae
added logging for emeail sending
niftyvictor Mar 13, 2025
7ab330a
test webauthn email
niftyvictor Mar 14, 2025
ae11b0a
test webauthn email
niftyvictor Mar 14, 2025
7a16955
updated webauthn recover email endpoint
niftyvictor Mar 14, 2025
e6d11f2
cleanup
niftyvictor Mar 14, 2025
7432b74
Merge branch '22.0' into feat/webauthn/base
porcellus Mar 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .circleci/forceRunCI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ PAT=`cat .pat`
auth=`echo "${PAT}:" | tr -d '\n' | base64 --wrap=0`
branch=`git rev-parse --abbrev-ref HEAD`

cdiCoreMap='{ }' # "5.2": "feat/oauth/allow-list"
cdiPluginInterfaceMap='{ }' # "5.2": "feat/oauth/allow-list"
fdiNodeMap='{ }' # "3.1": "feat/add_clientId_secret_and_refreshTokenRotation_settings", "4.0": "feat/add_clientId_secret_and_refreshTokenRotation_settings"
fdiWebsiteMap='{ }' # "1.17": "20.1", "1.18": "20.1", "1.19": "20.1", "2.0": "20.1", "3.0": "20.1", "3.1": "20.1", "4.0": "20.1"
fdiAuthReactMap='{ }' # "3.1": "0.48", "4.0": "0.48"
cdiCoreMap='{ }'
cdiPluginInterfaceMap='{ }'
fdiNodeMap='{ "4.1": "feat/webauthn/base" }'
fdiWebsiteMap='{ "1.17": "20.1", "1.18": "20.1", "1.19": "20.1", "2.0": "20.1", "3.0": "20.1", "3.1": "20.1", "4.0": "20.1", "4.1": "20.1" }'
fdiAuthReactMap='{ "4.1": "feat/webauthn/base" }'

data=`jq -cn --arg branch "$branch" \
--arg cdiCoreMap "$cdiCoreMap" \
Expand Down
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

### Added WebAuthn (Passkeys) Support

- Added WebAuthn recipe with authentication support:

- Registration, sign-in, and credential verification flows
- Account recovery functionality

- Added new API endpoints for WebAuthn operations:

- GET `/api/webauthn/email/exists` - Check if email exists in system
- POST `/api/webauthn/options/register` - Handle registration options
- POST `/api/webauthn/options/signin` - Handle sign-in options
- POST `/api/webauthn/signin` - Handle WebAuthn sign-in
- POST `/api/webauthn/signup` - Handle WebAuthn sign-up
- POST `/api/user/webauthn/reset` - Handle account recovery
- POST `/api/user/webauthn/reset/token` - Generate recovery tokens

- Added WebAuthn support to account linking functionality:

- Support for linking users based on WebAuthn `credentialId`
- Updated `AccountInfo` type to `AccountInfoInput` with WebAuthn fields
- Added `hasSameWebauthnInfoAs` method for credential comparison

- Updated FDI support to `4.1`

### Breaking Changes

- Updated CDI supported version from `5.2` to `5.3`
- Changed `AccountInfo` to `AccountInfoInput` in various methods for better type safety. This is required in order to allow querying by a single WebAuthn `credentialId`, while the WebAuthn login method contains an array of `credentialId`

## [21.1.1] - 2025-03-06

- Fixes an issue where the response body was not being cloned when using cache
Expand Down
2 changes: 1 addition & 1 deletion coreDriverInterfaceSupported.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_comment": "contains a list of core-driver interfaces branch names that this core supports",
"versions": ["5.2"]
"versions": ["5.3"]
}
2 changes: 1 addition & 1 deletion frontendDriverInterfaceSupported.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_comment": "contains a list of frontend-driver interfaces branch names that this core supports",
"versions": ["1.17", "1.18", "1.19", "2.0", "3.0", "3.1", "4.0"]
"versions": ["1.17", "1.18", "1.19", "2.0", "3.0", "3.1", "4.0", "4.1"]
}
11 changes: 11 additions & 0 deletions lib/build/authUtils.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/build/authUtils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/build/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 19 additions & 4 deletions lib/build/recipe/accountlinking/recipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,15 @@ class Recipe extends recipeModule_1.default {
if (user.isPrimaryUser) {
return user;
}
// then, we try and find a primary user based on the email / phone number / third party ID.
// then, we try and find a primary user based on the email / phone number / third party ID / credentialId.
let users = await this.recipeInterfaceImpl.listUsersByAccountInfo({
tenantId,
accountInfo: user.loginMethods[0],
accountInfo: Object.assign(Object.assign({}, user.loginMethods[0]), {
// we don't need to list by (webauthn) credentialId because we are looking for
// a user to link to the current recipe user, but any search using the credentialId
// of the current user "will identify the same user" which is the current one.
webauthn: undefined,
}),
doUnionOfAccountInfo: true,
userContext,
});
Expand Down Expand Up @@ -87,7 +92,12 @@ class Recipe extends recipeModule_1.default {
// then, we try and find matching users based on the email / phone number / third party ID.
let users = await this.recipeInterfaceImpl.listUsersByAccountInfo({
tenantId,
accountInfo: user.loginMethods[0],
accountInfo: Object.assign(Object.assign({}, user.loginMethods[0]), {
// we don't need to list by (webauthn) credentialId because we are looking for
// a user to link to the current recipe user, but any search using the credentialId
// of the current user "will identify the same user" which is the current one.
webauthn: undefined,
}),
doUnionOfAccountInfo: true,
userContext,
});
Expand Down Expand Up @@ -172,7 +182,12 @@ class Recipe extends recipeModule_1.default {
// primary user.
let users = await this.recipeInterfaceImpl.listUsersByAccountInfo({
tenantId,
accountInfo,
accountInfo: Object.assign(Object.assign({}, accountInfo), {
// we don't need to list by (webauthn) credentialId because we are looking for
// a user to link to the current recipe user, but any search using the credentialId
// of the current user "will identify the same user" which is the current one.
webauthn: undefined,
}),
doUnionOfAccountInfo: true,
userContext,
});
Expand Down
4 changes: 3 additions & 1 deletion lib/build/recipe/accountlinking/recipeImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function getRecipeImplementation(querier, config, recipeInstance) {
return undefined;
},
listUsersByAccountInfo: async function ({ tenantId, accountInfo, doUnionOfAccountInfo, userContext }) {
var _a, _b;
var _a, _b, _c;
let result = await querier.sendGetRequest(
new normalisedURLPath_1.default(
`${tenantId !== null && tenantId !== void 0 ? tenantId : "public"}/users/by-accountinfo`
Expand All @@ -167,6 +167,8 @@ function getRecipeImplementation(querier, config, recipeInstance) {
phoneNumber: accountInfo.phoneNumber,
thirdPartyId: (_a = accountInfo.thirdParty) === null || _a === void 0 ? void 0 : _a.id,
thirdPartyUserId: (_b = accountInfo.thirdParty) === null || _b === void 0 ? void 0 : _b.userId,
webauthnCredentialId:
(_c = accountInfo.webauthn) === null || _c === void 0 ? void 0 : _c.credentialId,
doUnionOfAccountInfo,
},
userContext
Expand Down
12 changes: 10 additions & 2 deletions lib/build/recipe/accountlinking/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export declare type RecipeInterface = {
getUser: (input: { userId: string; userContext: UserContext }) => Promise<User | undefined>;
listUsersByAccountInfo: (input: {
tenantId: string;
accountInfo: AccountInfo;
accountInfo: AccountInfoInput;
doUnionOfAccountInfo: boolean;
userContext: UserContext;
}) => Promise<User[]>;
Expand All @@ -182,9 +182,17 @@ export declare type AccountInfo = {
id: string;
userId: string;
};
webauthn?: {
credentialIds: string[];
};
};
export declare type AccountInfoInput = Omit<AccountInfo, "webauthn"> & {
webauthn?: {
credentialId: string;
};
};
export declare type AccountInfoWithRecipeId = {
recipeId: "emailpassword" | "thirdparty" | "passwordless";
recipeId: "emailpassword" | "thirdparty" | "passwordless" | "webauthn";
} & AccountInfo;
export declare type RecipeLevelUser = {
tenantIds: string[];
Expand Down
1 change: 1 addition & 0 deletions lib/build/recipe/multifactorauth/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default class Wrapper {
static MultiFactorAuthClaim: import("./multiFactorAuthClaim").MultiFactorAuthClaimClass;
static FactorIds: {
EMAILPASSWORD: string;
WEBAUTHN: string;
OTP_EMAIL: string;
OTP_PHONE: string;
LINK_EMAIL: string;
Expand Down
1 change: 1 addition & 0 deletions lib/build/recipe/multifactorauth/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export declare type GetPhoneNumbersForFactorsFromOtherRecipesFunc = (
};
export declare const FactorIds: {
EMAILPASSWORD: string;
WEBAUTHN: string;
OTP_EMAIL: string;
OTP_PHONE: string;
LINK_EMAIL: string;
Expand Down
1 change: 1 addition & 0 deletions lib/build/recipe/multifactorauth/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.FactorIds = void 0;
exports.FactorIds = {
EMAILPASSWORD: "emailpassword",
WEBAUTHN: "webauthn",
OTP_EMAIL: "otp-email",
OTP_PHONE: "otp-phone",
LINK_EMAIL: "link-email",
Expand Down
9 changes: 9 additions & 0 deletions lib/build/recipe/webauthn/api/emailExists.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// @ts-nocheck
import { APIInterface, APIOptions } from "../";
import { UserContext } from "../../../types";
export default function emailExists(
apiImplementation: APIInterface,
tenantId: string,
options: APIOptions,
userContext: UserContext
): Promise<boolean>;
44 changes: 44 additions & 0 deletions lib/build/recipe/webauthn/api/emailExists.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"use strict";
/* Copyright (c) 2025, VRAI Labs and/or its affiliates. All rights reserved.
*
* This software is licensed under the Apache License, Version 2.0 (the
* "License") as published by the Apache Software Foundation.
*
* You may not use this file except in compliance with the License. You may
* obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
var __importDefault =
(this && this.__importDefault) ||
function (mod) {
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../../../utils");
const error_1 = __importDefault(require("../error"));
async function emailExists(apiImplementation, tenantId, options, userContext) {
if (apiImplementation.emailExistsGET === undefined) {
return false;
}
const email = options.req.getKeyValueFromQuery("email");
if (email === undefined || typeof email !== "string") {
throw new error_1.default({
type: error_1.default.BAD_INPUT_ERROR,
message: "Please provide the email as a GET param",
});
}
let result = await apiImplementation.emailExistsGET({
email,
tenantId,
options,
userContext,
});
utils_1.send200Response(options.res, result);
return true;
}
exports.default = emailExists;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// @ts-nocheck
import { APIInterface, APIOptions } from "../";
import { UserContext } from "../../../types";
export default function generateRecoverAccountToken(
apiImplementation: APIInterface,
tenantId: string,
options: APIOptions,
userContext: UserContext
): Promise<boolean>;
45 changes: 45 additions & 0 deletions lib/build/recipe/webauthn/api/generateRecoverAccountToken.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"use strict";
/* Copyright (c) 2025, VRAI Labs and/or its affiliates. All rights reserved.
*
* This software is licensed under the Apache License, Version 2.0 (the
* "License") as published by the Apache Software Foundation.
*
* You may not use this file except in compliance with the License. You may
* obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
var __importDefault =
(this && this.__importDefault) ||
function (mod) {
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../../../utils");
const error_1 = __importDefault(require("../error"));
async function generateRecoverAccountToken(apiImplementation, tenantId, options, userContext) {
if (apiImplementation.generateRecoverAccountTokenPOST === undefined) {
return false;
}
const requestBody = await options.req.getJSONBody();
const email = requestBody.email;
if (email === undefined || typeof email !== "string") {
throw new error_1.default({
type: error_1.default.BAD_INPUT_ERROR,
message: "Please provide the email",
});
}
const result = await apiImplementation.generateRecoverAccountTokenPOST({
email,
tenantId,
options,
userContext,
});
utils_1.send200Response(options.res, result);
return true;
}
exports.default = generateRecoverAccountToken;
3 changes: 3 additions & 0 deletions lib/build/recipe/webauthn/api/implementation.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// @ts-nocheck
import { APIInterface } from "..";
export default function getAPIImplementation(): APIInterface;
Loading
Loading