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

Draft
wants to merge 38 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 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
victorbojica Nov 25, 2024
fbb2d4b
feat: added API testing
victorbojica 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)
victorbojica 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)
victorbojica 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
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
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: 3 additions & 0 deletions lib/build/core-mock.d.ts

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

217 changes: 217 additions & 0 deletions lib/build/core-mock.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
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>;
Loading
Loading