@robelest/convex-auth 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/bin.cjs +27733 -0
- package/dist/client/index.d.ts +49 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +283 -0
- package/dist/client/index.js.map +1 -0
- package/dist/component/_generated/api.d.ts +36 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/dist/component/_generated/api.js +31 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +295 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +46 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +121 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +78 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/convex.config.d.ts +3 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +4 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/index.d.ts +15 -0
- package/dist/component/index.d.ts.map +1 -0
- package/dist/component/index.js +13 -0
- package/dist/component/index.js.map +1 -0
- package/dist/component/public.d.ts +450 -0
- package/dist/component/public.d.ts.map +1 -0
- package/dist/component/public.js +528 -0
- package/dist/component/public.js.map +1 -0
- package/dist/component/schema.d.ts +107 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +26 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/providers/Anonymous.d.ts +50 -0
- package/dist/providers/Anonymous.d.ts.map +1 -0
- package/dist/providers/Anonymous.js +39 -0
- package/dist/providers/Anonymous.js.map +1 -0
- package/dist/providers/ConvexCredentials.d.ts +88 -0
- package/dist/providers/ConvexCredentials.d.ts.map +1 -0
- package/dist/providers/ConvexCredentials.js +37 -0
- package/dist/providers/ConvexCredentials.js.map +1 -0
- package/dist/providers/Email.d.ts +33 -0
- package/dist/providers/Email.d.ts.map +1 -0
- package/dist/providers/Email.js +50 -0
- package/dist/providers/Email.js.map +1 -0
- package/dist/providers/Password.d.ts +95 -0
- package/dist/providers/Password.d.ts.map +1 -0
- package/dist/providers/Password.js +174 -0
- package/dist/providers/Password.js.map +1 -0
- package/dist/providers/Phone.d.ts +22 -0
- package/dist/providers/Phone.d.ts.map +1 -0
- package/dist/providers/Phone.js +37 -0
- package/dist/providers/Phone.js.map +1 -0
- package/dist/server/convex_types.d.ts +17 -0
- package/dist/server/convex_types.d.ts.map +1 -0
- package/dist/server/convex_types.js +2 -0
- package/dist/server/convex_types.js.map +1 -0
- package/dist/server/cookies.d.ts +35 -0
- package/dist/server/cookies.d.ts.map +1 -0
- package/dist/server/cookies.js +34 -0
- package/dist/server/cookies.js.map +1 -0
- package/dist/server/implementation/db.d.ts +80 -0
- package/dist/server/implementation/db.d.ts.map +1 -0
- package/dist/server/implementation/db.js +59 -0
- package/dist/server/implementation/db.js.map +1 -0
- package/dist/server/implementation/index.d.ts +370 -0
- package/dist/server/implementation/index.d.ts.map +1 -0
- package/dist/server/implementation/index.js +521 -0
- package/dist/server/implementation/index.js.map +1 -0
- package/dist/server/implementation/mutations/createAccountFromCredentials.d.ts +33 -0
- package/dist/server/implementation/mutations/createAccountFromCredentials.d.ts.map +1 -0
- package/dist/server/implementation/mutations/createAccountFromCredentials.js +71 -0
- package/dist/server/implementation/mutations/createAccountFromCredentials.js.map +1 -0
- package/dist/server/implementation/mutations/createVerificationCode.d.ts +25 -0
- package/dist/server/implementation/mutations/createVerificationCode.d.ts.map +1 -0
- package/dist/server/implementation/mutations/createVerificationCode.js +84 -0
- package/dist/server/implementation/mutations/createVerificationCode.js.map +1 -0
- package/dist/server/implementation/mutations/index.d.ts +304 -0
- package/dist/server/implementation/mutations/index.d.ts.map +1 -0
- package/dist/server/implementation/mutations/index.js +108 -0
- package/dist/server/implementation/mutations/index.js.map +1 -0
- package/dist/server/implementation/mutations/invalidateSessions.d.ts +13 -0
- package/dist/server/implementation/mutations/invalidateSessions.d.ts.map +1 -0
- package/dist/server/implementation/mutations/invalidateSessions.js +35 -0
- package/dist/server/implementation/mutations/invalidateSessions.js.map +1 -0
- package/dist/server/implementation/mutations/modifyAccount.d.ts +23 -0
- package/dist/server/implementation/mutations/modifyAccount.d.ts.map +1 -0
- package/dist/server/implementation/mutations/modifyAccount.js +48 -0
- package/dist/server/implementation/mutations/modifyAccount.js.map +1 -0
- package/dist/server/implementation/mutations/refreshSession.d.ts +16 -0
- package/dist/server/implementation/mutations/refreshSession.d.ts.map +1 -0
- package/dist/server/implementation/mutations/refreshSession.js +116 -0
- package/dist/server/implementation/mutations/refreshSession.js.map +1 -0
- package/dist/server/implementation/mutations/retrieveAccountWithCredentials.d.ts +27 -0
- package/dist/server/implementation/mutations/retrieveAccountWithCredentials.d.ts.map +1 -0
- package/dist/server/implementation/mutations/retrieveAccountWithCredentials.js +55 -0
- package/dist/server/implementation/mutations/retrieveAccountWithCredentials.js.map +1 -0
- package/dist/server/implementation/mutations/signIn.d.ts +17 -0
- package/dist/server/implementation/mutations/signIn.d.ts.map +1 -0
- package/dist/server/implementation/mutations/signIn.js +26 -0
- package/dist/server/implementation/mutations/signIn.js.map +1 -0
- package/dist/server/implementation/mutations/signOut.d.ts +11 -0
- package/dist/server/implementation/mutations/signOut.d.ts.map +1 -0
- package/dist/server/implementation/mutations/signOut.js +24 -0
- package/dist/server/implementation/mutations/signOut.js.map +1 -0
- package/dist/server/implementation/mutations/userOAuth.d.ts +19 -0
- package/dist/server/implementation/mutations/userOAuth.d.ts.map +1 -0
- package/dist/server/implementation/mutations/userOAuth.js +84 -0
- package/dist/server/implementation/mutations/userOAuth.js.map +1 -0
- package/dist/server/implementation/mutations/verifier.d.ts +8 -0
- package/dist/server/implementation/mutations/verifier.d.ts.map +1 -0
- package/dist/server/implementation/mutations/verifier.js +19 -0
- package/dist/server/implementation/mutations/verifier.js.map +1 -0
- package/dist/server/implementation/mutations/verifierSignature.d.ts +15 -0
- package/dist/server/implementation/mutations/verifierSignature.d.ts.map +1 -0
- package/dist/server/implementation/mutations/verifierSignature.js +29 -0
- package/dist/server/implementation/mutations/verifierSignature.js.map +1 -0
- package/dist/server/implementation/mutations/verifyCodeAndSignIn.d.ts +21 -0
- package/dist/server/implementation/mutations/verifyCodeAndSignIn.d.ts.map +1 -0
- package/dist/server/implementation/mutations/verifyCodeAndSignIn.js +127 -0
- package/dist/server/implementation/mutations/verifyCodeAndSignIn.js.map +1 -0
- package/dist/server/implementation/provider.d.ts +6 -0
- package/dist/server/implementation/provider.d.ts.map +1 -0
- package/dist/server/implementation/provider.js +21 -0
- package/dist/server/implementation/provider.js.map +1 -0
- package/dist/server/implementation/rateLimit.d.ts +6 -0
- package/dist/server/implementation/rateLimit.d.ts.map +1 -0
- package/dist/server/implementation/rateLimit.js +76 -0
- package/dist/server/implementation/rateLimit.js.map +1 -0
- package/dist/server/implementation/redirects.d.ts +6 -0
- package/dist/server/implementation/redirects.d.ts.map +1 -0
- package/dist/server/implementation/redirects.js +40 -0
- package/dist/server/implementation/redirects.js.map +1 -0
- package/dist/server/implementation/refreshTokens.d.ts +40 -0
- package/dist/server/implementation/refreshTokens.d.ts.map +1 -0
- package/dist/server/implementation/refreshTokens.js +160 -0
- package/dist/server/implementation/refreshTokens.js.map +1 -0
- package/dist/server/implementation/sessions.d.ts +43 -0
- package/dist/server/implementation/sessions.d.ts.map +1 -0
- package/dist/server/implementation/sessions.js +94 -0
- package/dist/server/implementation/sessions.js.map +1 -0
- package/dist/server/implementation/signIn.d.ts +31 -0
- package/dist/server/implementation/signIn.d.ts.map +1 -0
- package/dist/server/implementation/signIn.js +148 -0
- package/dist/server/implementation/signIn.js.map +1 -0
- package/dist/server/implementation/tokens.d.ts +7 -0
- package/dist/server/implementation/tokens.d.ts.map +1 -0
- package/dist/server/implementation/tokens.js +18 -0
- package/dist/server/implementation/tokens.js.map +1 -0
- package/dist/server/implementation/types.d.ts +288 -0
- package/dist/server/implementation/types.d.ts.map +1 -0
- package/dist/server/implementation/types.js +182 -0
- package/dist/server/implementation/types.js.map +1 -0
- package/dist/server/implementation/users.d.ts +27 -0
- package/dist/server/implementation/users.d.ts.map +1 -0
- package/dist/server/implementation/users.js +181 -0
- package/dist/server/implementation/users.js.map +1 -0
- package/dist/server/implementation/utils.d.ts +17 -0
- package/dist/server/implementation/utils.d.ts.map +1 -0
- package/dist/server/implementation/utils.js +72 -0
- package/dist/server/implementation/utils.js.map +1 -0
- package/dist/server/index.d.ts +17 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +54 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/oauth/authorizationUrl.d.ts +13 -0
- package/dist/server/oauth/authorizationUrl.d.ts.map +1 -0
- package/dist/server/oauth/authorizationUrl.js +91 -0
- package/dist/server/oauth/authorizationUrl.js.map +1 -0
- package/dist/server/oauth/callback.d.ts +19 -0
- package/dist/server/oauth/callback.d.ts.map +1 -0
- package/dist/server/oauth/callback.js +173 -0
- package/dist/server/oauth/callback.js.map +1 -0
- package/dist/server/oauth/checks.d.ts +52 -0
- package/dist/server/oauth/checks.d.ts.map +1 -0
- package/dist/server/oauth/checks.js +106 -0
- package/dist/server/oauth/checks.js.map +1 -0
- package/dist/server/oauth/convexAuth.d.ts +12 -0
- package/dist/server/oauth/convexAuth.d.ts.map +1 -0
- package/dist/server/oauth/convexAuth.js +137 -0
- package/dist/server/oauth/convexAuth.js.map +1 -0
- package/dist/server/oauth/lib/utils/customFetch.d.ts +9 -0
- package/dist/server/oauth/lib/utils/customFetch.d.ts.map +1 -0
- package/dist/server/oauth/lib/utils/customFetch.js +11 -0
- package/dist/server/oauth/lib/utils/customFetch.js.map +1 -0
- package/dist/server/oauth/lib/utils/providers.d.ts +3 -0
- package/dist/server/oauth/lib/utils/providers.d.ts.map +1 -0
- package/dist/server/oauth/lib/utils/providers.js +7 -0
- package/dist/server/oauth/lib/utils/providers.js.map +1 -0
- package/dist/server/oauth/providers/oauth.d.ts +43 -0
- package/dist/server/oauth/providers/oauth.d.ts.map +1 -0
- package/dist/server/oauth/providers/oauth.js +3 -0
- package/dist/server/oauth/providers/oauth.js.map +1 -0
- package/dist/server/oauth/types.d.ts +24 -0
- package/dist/server/oauth/types.d.ts.map +1 -0
- package/dist/server/oauth/types.js +5 -0
- package/dist/server/oauth/types.js.map +1 -0
- package/dist/server/provider_utils.d.ts +76 -0
- package/dist/server/provider_utils.d.ts.map +1 -0
- package/dist/server/provider_utils.js +177 -0
- package/dist/server/provider_utils.js.map +1 -0
- package/dist/server/types.d.ts +412 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/types.js +2 -0
- package/dist/server/types.js.map +1 -0
- package/dist/server/utils.d.ts +3 -0
- package/dist/server/utils.d.ts.map +1 -0
- package/dist/server/utils.js +11 -0
- package/dist/server/utils.js.map +1 -0
- package/package.json +126 -0
- package/providers/Anonymous/package.json +6 -0
- package/providers/ConvexCredentials/package.json +6 -0
- package/providers/Email/package.json +6 -0
- package/providers/Password/package.json +6 -0
- package/providers/Phone/package.json +6 -0
- package/server/package.json +6 -0
- package/src/cli/command.ts +69 -0
- package/src/cli/generateKeys.ts +20 -0
- package/src/cli/index.ts +840 -0
- package/src/client/index.ts +415 -0
- package/src/component/_generated/api.ts +52 -0
- package/src/component/_generated/component.ts +586 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +156 -0
- package/src/component/convex.config.ts +5 -0
- package/src/component/index.ts +40 -0
- package/src/component/public.ts +607 -0
- package/src/component/schema.ts +35 -0
- package/src/providers/Anonymous.ts +79 -0
- package/src/providers/ConvexCredentials.ts +108 -0
- package/src/providers/Email.ts +60 -0
- package/src/providers/Password.ts +253 -0
- package/src/providers/Phone.ts +46 -0
- package/src/server/convex_types.ts +55 -0
- package/src/server/cookies.ts +42 -0
- package/src/server/implementation/db.ts +125 -0
- package/src/server/implementation/index.ts +815 -0
- package/src/server/implementation/mutations/createAccountFromCredentials.ts +113 -0
- package/src/server/implementation/mutations/createVerificationCode.ts +139 -0
- package/src/server/implementation/mutations/index.ts +157 -0
- package/src/server/implementation/mutations/invalidateSessions.ts +47 -0
- package/src/server/implementation/mutations/modifyAccount.ts +65 -0
- package/src/server/implementation/mutations/refreshSession.ts +188 -0
- package/src/server/implementation/mutations/retrieveAccountWithCredentials.ts +87 -0
- package/src/server/implementation/mutations/signIn.ts +51 -0
- package/src/server/implementation/mutations/signOut.ts +38 -0
- package/src/server/implementation/mutations/userOAuth.ts +112 -0
- package/src/server/implementation/mutations/verifier.ts +29 -0
- package/src/server/implementation/mutations/verifierSignature.ts +44 -0
- package/src/server/implementation/mutations/verifyCodeAndSignIn.ts +205 -0
- package/src/server/implementation/provider.ts +38 -0
- package/src/server/implementation/rateLimit.ts +105 -0
- package/src/server/implementation/redirects.ts +58 -0
- package/src/server/implementation/refreshTokens.ts +221 -0
- package/src/server/implementation/sessions.ts +155 -0
- package/src/server/implementation/signIn.ts +253 -0
- package/src/server/implementation/tokens.ts +29 -0
- package/src/server/implementation/types.ts +220 -0
- package/src/server/implementation/users.ts +286 -0
- package/src/server/implementation/utils.ts +91 -0
- package/src/server/index.ts +74 -0
- package/src/server/oauth/NOTICE.txt +21 -0
- package/src/server/oauth/README.md +7 -0
- package/src/server/oauth/authorizationUrl.ts +113 -0
- package/src/server/oauth/callback.ts +243 -0
- package/src/server/oauth/checks.ts +136 -0
- package/src/server/oauth/convexAuth.ts +168 -0
- package/src/server/oauth/lib/utils/customFetch.ts +18 -0
- package/src/server/oauth/lib/utils/providers.ts +12 -0
- package/src/server/oauth/providers/oauth.ts +56 -0
- package/src/server/oauth/types.ts +60 -0
- package/src/server/provider_utils.ts +222 -0
- package/src/server/types.ts +470 -0
- package/src/server/utils.ts +12 -0
- package/src/test.ts +24 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,wBAmBG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineSchema, defineTable } from "convex/server";
|
|
2
|
+
import { v } from "convex/values";
|
|
3
|
+
import { authTables } from "../server/implementation/types.js";
|
|
4
|
+
const { user, account, session, token, verification, verifier, limit, } = authTables;
|
|
5
|
+
void user;
|
|
6
|
+
export default defineSchema({
|
|
7
|
+
user: defineTable({
|
|
8
|
+
name: v.optional(v.string()),
|
|
9
|
+
image: v.optional(v.string()),
|
|
10
|
+
email: v.optional(v.string()),
|
|
11
|
+
emailVerificationTime: v.optional(v.number()),
|
|
12
|
+
phone: v.optional(v.string()),
|
|
13
|
+
phoneVerificationTime: v.optional(v.number()),
|
|
14
|
+
isAnonymous: v.optional(v.boolean()),
|
|
15
|
+
favoriteColor: v.optional(v.string()),
|
|
16
|
+
})
|
|
17
|
+
.index("email", ["email"])
|
|
18
|
+
.index("phone", ["phone"]),
|
|
19
|
+
account,
|
|
20
|
+
session,
|
|
21
|
+
token,
|
|
22
|
+
verification,
|
|
23
|
+
verifier,
|
|
24
|
+
limit,
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAE/D,MAAM,EACJ,IAAI,EACJ,OAAO,EACP,OAAO,EACP,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,KAAK,GACN,GAAG,UAAU,CAAC;AACf,KAAK,IAAI,CAAC;AAEV,eAAe,YAAY,CAAC;IAC1B,IAAI,EAAE,WAAW,CAAC;QAChB,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC5B,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC7B,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC7B,qBAAqB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC7C,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC7B,qBAAqB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC7C,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QACpC,aAAa,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;KACtC,CAAC;SACC,KAAK,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC;SACzB,KAAK,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC;IAC5B,OAAO;IACP,OAAO;IACP,KAAK;IACL,YAAY;IACZ,QAAQ;IACR,KAAK;CACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configure {@link Anonymous} provider given an {@link AnonymousConfig}.
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* import { Anonymous } from "@robelest/convex-auth/providers/Anonymous";
|
|
6
|
+
* import { convexAuth } from "@robelest/convex-auth/component";
|
|
7
|
+
*
|
|
8
|
+
* export const { auth, signIn, signOut, store } = convexAuth({
|
|
9
|
+
* providers: [Anonymous],
|
|
10
|
+
* });
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import { GenericActionCtxWithAuthConfig } from "@robelest/convex-auth/component";
|
|
16
|
+
import { DocumentByName, GenericDataModel, WithoutSystemFields } from "convex/server";
|
|
17
|
+
import { Value } from "convex/values";
|
|
18
|
+
/**
|
|
19
|
+
* The available options to an {@link Anonymous} provider for Convex Auth.
|
|
20
|
+
*/
|
|
21
|
+
export interface AnonymousConfig<DataModel extends GenericDataModel> {
|
|
22
|
+
/**
|
|
23
|
+
* Uniquely identifies the provider, allowing to use
|
|
24
|
+
* multiple different {@link Anonymous} providers.
|
|
25
|
+
*/
|
|
26
|
+
id?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Perform checks on provided params and customize the user
|
|
29
|
+
* information stored after sign in.
|
|
30
|
+
*/
|
|
31
|
+
profile?: (
|
|
32
|
+
/**
|
|
33
|
+
* The values passed to the `signIn` function.
|
|
34
|
+
*/
|
|
35
|
+
params: Record<string, Value | undefined>,
|
|
36
|
+
/**
|
|
37
|
+
* Convex ActionCtx in case you want to read from or write to
|
|
38
|
+
* the database.
|
|
39
|
+
*/
|
|
40
|
+
ctx: GenericActionCtxWithAuthConfig<DataModel>) => WithoutSystemFields<DocumentByName<DataModel, "user">> & {
|
|
41
|
+
isAnonymous: true;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* An anonymous authentication provider.
|
|
46
|
+
*
|
|
47
|
+
* This provider doesn't require any user-provided information.
|
|
48
|
+
*/
|
|
49
|
+
export default function anonymous<DataModel extends GenericDataModel>(config?: AnonymousConfig<DataModel>): import("@robelest/convex-auth/component").ConvexCredentialsConfig;
|
|
50
|
+
//# sourceMappingURL=Anonymous.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Anonymous.d.ts","sourceRoot":"","sources":["../../src/providers/Anonymous.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EACL,8BAA8B,EAE/B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,SAAS,SAAS,gBAAgB;IACjE;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,OAAO,CAAC,EAAE;IACR;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,GAAG,SAAS,CAAC;IACzC;;;OAGG;IACH,GAAG,EAAE,8BAA8B,CAAC,SAAS,CAAC,KAC3C,mBAAmB,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,GAAG;QAC5D,WAAW,EAAE,IAAI,CAAC;KACnB,CAAC;CACH;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,SAAS,SAAS,gBAAgB,EAClE,MAAM,GAAE,eAAe,CAAC,SAAS,CAAM,qEAiBxC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configure {@link Anonymous} provider given an {@link AnonymousConfig}.
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* import { Anonymous } from "@robelest/convex-auth/providers/Anonymous";
|
|
6
|
+
* import { convexAuth } from "@robelest/convex-auth/component";
|
|
7
|
+
*
|
|
8
|
+
* export const { auth, signIn, signOut, store } = convexAuth({
|
|
9
|
+
* providers: [Anonymous],
|
|
10
|
+
* });
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import convexCredentials from "@robelest/convex-auth/providers/ConvexCredentials";
|
|
16
|
+
import { createAccount, } from "@robelest/convex-auth/component";
|
|
17
|
+
/**
|
|
18
|
+
* An anonymous authentication provider.
|
|
19
|
+
*
|
|
20
|
+
* This provider doesn't require any user-provided information.
|
|
21
|
+
*/
|
|
22
|
+
export default function anonymous(config = {}) {
|
|
23
|
+
const provider = config.id ?? "anonymous";
|
|
24
|
+
return convexCredentials({
|
|
25
|
+
id: "anonymous",
|
|
26
|
+
authorize: async (params, ctx) => {
|
|
27
|
+
const profile = config.profile?.(params, ctx) ?? { isAnonymous: true };
|
|
28
|
+
const { user } = await createAccount(ctx, {
|
|
29
|
+
provider,
|
|
30
|
+
account: { id: crypto.randomUUID() },
|
|
31
|
+
profile: profile,
|
|
32
|
+
});
|
|
33
|
+
// END
|
|
34
|
+
return { userId: user._id };
|
|
35
|
+
},
|
|
36
|
+
...config,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=Anonymous.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Anonymous.js","sourceRoot":"","sources":["../../src/providers/Anonymous.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,iBAAiB,MAAM,mDAAmD,CAAC;AAClF,OAAO,EAEL,aAAa,GACd,MAAM,iCAAiC,CAAC;AAoCzC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,SAAqC,EAAE;IAEvC,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,IAAI,WAAW,CAAC;IAC1C,OAAO,iBAAiB,CAAY;QAClC,EAAE,EAAE,WAAW;QACf,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;YAC/B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;YACvE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,aAAa,CAAC,GAAG,EAAE;gBACxC,QAAQ;gBACR,OAAO,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE;gBACpC,OAAO,EAAE,OAAc;aACxB,CAAC,CAAC;YACH,MAAM;YACN,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;QAC9B,CAAC;QACD,GAAG,MAAM;KACV,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configure {@link ConvexCredentials} provider given a {@link ConvexCredentialsUserConfig}.
|
|
3
|
+
*
|
|
4
|
+
* This is for a very custom authentication implementation, often you can
|
|
5
|
+
* use the [`Password`](https://labs.convex.dev/auth/api_reference/providers/Password) provider instead.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import ConvexCredentials from "@robelest/convex-auth/providers/ConvexCredentials";
|
|
9
|
+
* import { convexAuth } from "@robelest/convex-auth/component";
|
|
10
|
+
*
|
|
11
|
+
* export const { auth, signIn, signOut, store } = convexAuth({
|
|
12
|
+
* providers: [
|
|
13
|
+
* ConvexCredentials({
|
|
14
|
+
* authorize: async (credentials, ctx) => {
|
|
15
|
+
* // Your custom logic here...
|
|
16
|
+
* },
|
|
17
|
+
* }),
|
|
18
|
+
* ],
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @module
|
|
23
|
+
*/
|
|
24
|
+
import { AuthProviderConfig, ConvexCredentialsConfig, GenericActionCtxWithAuthConfig } from "@robelest/convex-auth/component";
|
|
25
|
+
import { GenericDataModel } from "convex/server";
|
|
26
|
+
import { GenericId, Value } from "convex/values";
|
|
27
|
+
/**
|
|
28
|
+
* The available options to a {@link ConvexCredentials} provider for Convex Auth.
|
|
29
|
+
*/
|
|
30
|
+
export interface ConvexCredentialsUserConfig<DataModel extends GenericDataModel = GenericDataModel> {
|
|
31
|
+
/**
|
|
32
|
+
* Uniquely identifies the provider, allowing to use
|
|
33
|
+
* multiple different {@link ConvexCredentials} providers.
|
|
34
|
+
*/
|
|
35
|
+
id?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Gives full control over how you handle the credentials received from the user
|
|
38
|
+
* via the client-side `signIn` function.
|
|
39
|
+
*
|
|
40
|
+
* @returns This method expects a user ID to be returned for a successful login.
|
|
41
|
+
* A session ID can be also returned and that session will be used.
|
|
42
|
+
* If an error is thrown or `null` is returned, the sign-in will fail.
|
|
43
|
+
*/
|
|
44
|
+
authorize: (
|
|
45
|
+
/**
|
|
46
|
+
* The available keys are determined by your call to `signIn()` on the client.
|
|
47
|
+
*
|
|
48
|
+
* You can add basic validation depending on your use case,
|
|
49
|
+
* or you can use a popular library like [Zod](https://zod.dev) for validating
|
|
50
|
+
* the input.
|
|
51
|
+
*/
|
|
52
|
+
credentials: Partial<Record<string, Value | undefined>>, ctx: GenericActionCtxWithAuthConfig<DataModel>) => Promise<{
|
|
53
|
+
userId: GenericId<"user">;
|
|
54
|
+
sessionId?: GenericId<"session">;
|
|
55
|
+
} | null>;
|
|
56
|
+
/**
|
|
57
|
+
* Provide hashing and verification functions if you're
|
|
58
|
+
* storing account secrets and want to control
|
|
59
|
+
* how they're hashed.
|
|
60
|
+
*
|
|
61
|
+
* These functions will be called during
|
|
62
|
+
* the `createAccount` and `retrieveAccount` execution when the
|
|
63
|
+
* `secret` option is used.
|
|
64
|
+
*/
|
|
65
|
+
crypto?: {
|
|
66
|
+
/**
|
|
67
|
+
* Function used to hash the secret.
|
|
68
|
+
*/
|
|
69
|
+
hashSecret: (secret: string) => Promise<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Function used to verify that the secret
|
|
72
|
+
* matches the stored hash.
|
|
73
|
+
*/
|
|
74
|
+
verifySecret: (secret: string, hash: string) => Promise<boolean>;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Register extra providers used in the implementation of the credentials
|
|
78
|
+
* provider. They will only be available to the `signInViaProvider`
|
|
79
|
+
* function, and not to the `signIn` function exposed to clients.
|
|
80
|
+
*/
|
|
81
|
+
extraProviders?: (AuthProviderConfig | undefined)[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The Credentials provider allows you to handle signing in with arbitrary credentials,
|
|
85
|
+
* such as a username and password, domain, or two factor authentication or hardware device (e.g. YubiKey U2F / FIDO).
|
|
86
|
+
*/
|
|
87
|
+
export default function convexCredentials<DataModel extends GenericDataModel>(config: ConvexCredentialsUserConfig<DataModel>): ConvexCredentialsConfig;
|
|
88
|
+
//# sourceMappingURL=ConvexCredentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConvexCredentials.d.ts","sourceRoot":"","sources":["../../src/providers/ConvexCredentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,8BAA8B,EAC/B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,2BAA2B,CAC1C,SAAS,SAAS,gBAAgB,GAAG,gBAAgB;IAErD;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,SAAS,EAAE;IACT;;;;;;OAMG;IACH,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,GAAG,SAAS,CAAC,CAAC,EACvD,GAAG,EAAE,8BAA8B,CAAC,SAAS,CAAC,KAC3C,OAAO,CAAC;QACX,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QAC1B,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KAClC,GAAG,IAAI,CAAC,CAAC;IACV;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QAChD;;;WAGG;QACH,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;KAClE,CAAC;IACF;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,kBAAkB,GAAG,SAAS,CAAC,EAAE,CAAC;CACrD;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,SAAS,SAAS,gBAAgB,EAC1E,MAAM,EAAE,2BAA2B,CAAC,SAAS,CAAC,GAC7C,uBAAuB,CAQzB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configure {@link ConvexCredentials} provider given a {@link ConvexCredentialsUserConfig}.
|
|
3
|
+
*
|
|
4
|
+
* This is for a very custom authentication implementation, often you can
|
|
5
|
+
* use the [`Password`](https://labs.convex.dev/auth/api_reference/providers/Password) provider instead.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import ConvexCredentials from "@robelest/convex-auth/providers/ConvexCredentials";
|
|
9
|
+
* import { convexAuth } from "@robelest/convex-auth/component";
|
|
10
|
+
*
|
|
11
|
+
* export const { auth, signIn, signOut, store } = convexAuth({
|
|
12
|
+
* providers: [
|
|
13
|
+
* ConvexCredentials({
|
|
14
|
+
* authorize: async (credentials, ctx) => {
|
|
15
|
+
* // Your custom logic here...
|
|
16
|
+
* },
|
|
17
|
+
* }),
|
|
18
|
+
* ],
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @module
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* The Credentials provider allows you to handle signing in with arbitrary credentials,
|
|
26
|
+
* such as a username and password, domain, or two factor authentication or hardware device (e.g. YubiKey U2F / FIDO).
|
|
27
|
+
*/
|
|
28
|
+
export default function convexCredentials(config) {
|
|
29
|
+
return {
|
|
30
|
+
id: "credentials",
|
|
31
|
+
type: "credentials",
|
|
32
|
+
authorize: async () => null,
|
|
33
|
+
// @ts-expect-error Internal
|
|
34
|
+
options: config,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=ConvexCredentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConvexCredentials.js","sourceRoot":"","sources":["../../src/providers/ConvexCredentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAuEH;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,MAA8C;IAE9C,OAAO;QACL,EAAE,EAAE,aAAa;QACjB,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,KAAK,IAAI,EAAE,CAAC,IAAI;QAC3B,4BAA4B;QAC5B,OAAO,EAAE,MAAM;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simplifies creating custom email providers, such as for sending OTPs.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { GenericDataModel } from "convex/server";
|
|
7
|
+
import { EmailConfig, EmailUserConfig } from "../server/types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Email providers send a token to the user's email address
|
|
10
|
+
* for sign-in.
|
|
11
|
+
*
|
|
12
|
+
* When you use this function to create your config, by default it
|
|
13
|
+
* checks that there is an `email` field during token verification
|
|
14
|
+
* that matches the `email` used during the initial `signIn` call.
|
|
15
|
+
*
|
|
16
|
+
* If you want the "magic link behavior", where only the token is needed,
|
|
17
|
+
* you can override the `authorize` method to skip the check:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* import Email from "@robelest/convex-auth/providers/Email";
|
|
21
|
+
* import { convexAuth } from "@robelest/convex-auth/component";
|
|
22
|
+
*
|
|
23
|
+
* export const { auth, signIn, signOut, store } = convexAuth({
|
|
24
|
+
* providers: [
|
|
25
|
+
* Email({ authorize: undefined }),
|
|
26
|
+
* ],
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* Make sure the token has high enough entropy to be secure.
|
|
31
|
+
*/
|
|
32
|
+
export declare function Email<DataModel extends GenericDataModel>(config: EmailUserConfig<DataModel> & Pick<EmailConfig, "sendVerificationRequest">): EmailConfig<DataModel>;
|
|
33
|
+
//# sourceMappingURL=Email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Email.d.ts","sourceRoot":"","sources":["../../src/providers/Email.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,KAAK,CAAC,SAAS,SAAS,gBAAgB,EACtD,MAAM,EAAE,eAAe,CAAC,SAAS,CAAC,GAChC,IAAI,CAAC,WAAW,EAAE,yBAAyB,CAAC,GAC7C,WAAW,CAAC,SAAS,CAAC,CAuBxB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simplifies creating custom email providers, such as for sending OTPs.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Email providers send a token to the user's email address
|
|
8
|
+
* for sign-in.
|
|
9
|
+
*
|
|
10
|
+
* When you use this function to create your config, by default it
|
|
11
|
+
* checks that there is an `email` field during token verification
|
|
12
|
+
* that matches the `email` used during the initial `signIn` call.
|
|
13
|
+
*
|
|
14
|
+
* If you want the "magic link behavior", where only the token is needed,
|
|
15
|
+
* you can override the `authorize` method to skip the check:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import Email from "@robelest/convex-auth/providers/Email";
|
|
19
|
+
* import { convexAuth } from "@robelest/convex-auth/component";
|
|
20
|
+
*
|
|
21
|
+
* export const { auth, signIn, signOut, store } = convexAuth({
|
|
22
|
+
* providers: [
|
|
23
|
+
* Email({ authorize: undefined }),
|
|
24
|
+
* ],
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Make sure the token has high enough entropy to be secure.
|
|
29
|
+
*/
|
|
30
|
+
export function Email(config) {
|
|
31
|
+
return {
|
|
32
|
+
id: "email",
|
|
33
|
+
type: "email",
|
|
34
|
+
name: "Email",
|
|
35
|
+
from: "Auth.js <no-reply@authjs.dev>",
|
|
36
|
+
maxAge: 60 * 60, // 1 hour
|
|
37
|
+
authorize: async (params, account) => {
|
|
38
|
+
if (typeof params.email !== "string") {
|
|
39
|
+
throw new Error("Token verification requires an `email` in params of `signIn`.");
|
|
40
|
+
}
|
|
41
|
+
if (account.providerAccountId !== params.email) {
|
|
42
|
+
throw new Error("Short verification code requires a matching `email` " +
|
|
43
|
+
"in params of `signIn`.");
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
sendVerificationRequest: config.sendVerificationRequest,
|
|
47
|
+
options: config,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=Email.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Email.js","sourceRoot":"","sources":["../../src/providers/Email.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,KAAK,CACnB,MAC8C;IAE9C,OAAO;QACL,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,+BAA+B;QACrC,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,SAAS;QAC1B,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;YACnC,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACrC,MAAM,IAAI,KAAK,CACb,+DAA+D,CAChE,CAAC;YACJ,CAAC;YACD,IAAI,OAAO,CAAC,iBAAiB,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC;gBAC/C,MAAM,IAAI,KAAK,CACb,sDAAsD;oBACpD,wBAAwB,CAC3B,CAAC;YACJ,CAAC;QACH,CAAC;QACD,uBAAuB,EAAE,MAAM,CAAC,uBAAuB;QACvD,OAAO,EAAE,MAAM;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configure {@link Password} provider given a {@link PasswordConfig}.
|
|
3
|
+
*
|
|
4
|
+
* The `Password` provider supports the following flows, determined
|
|
5
|
+
* by the `flow` parameter:
|
|
6
|
+
*
|
|
7
|
+
* - `"signUp"`: Create a new account with a password.
|
|
8
|
+
* - `"signIn"`: Sign in with an existing account and password.
|
|
9
|
+
* - `"reset"`: Request a password reset.
|
|
10
|
+
* - `"reset-verification"`: Verify a password reset code and change password.
|
|
11
|
+
* - `"email-verification"`: If email verification is enabled and `code` is
|
|
12
|
+
* included in params, verify an OTP.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* import Password from "@robelest/convex-auth/providers/Password";
|
|
16
|
+
* import { convexAuth } from "@robelest/convex-auth/component";
|
|
17
|
+
*
|
|
18
|
+
* export const { auth, signIn, signOut, store } = convexAuth({
|
|
19
|
+
* providers: [Password],
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @module
|
|
24
|
+
*/
|
|
25
|
+
import { ConvexCredentialsUserConfig } from "@robelest/convex-auth/providers/ConvexCredentials";
|
|
26
|
+
import { EmailConfig, GenericActionCtxWithAuthConfig } from "@robelest/convex-auth/component";
|
|
27
|
+
import { DocumentByName, GenericDataModel, WithoutSystemFields } from "convex/server";
|
|
28
|
+
import { Value } from "convex/values";
|
|
29
|
+
/**
|
|
30
|
+
* The available options to a {@link Password} provider for Convex Auth.
|
|
31
|
+
*/
|
|
32
|
+
export interface PasswordConfig<DataModel extends GenericDataModel> {
|
|
33
|
+
/**
|
|
34
|
+
* Uniquely identifies the provider, allowing to use
|
|
35
|
+
* multiple different {@link Password} providers.
|
|
36
|
+
*/
|
|
37
|
+
id?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Perform checks on provided params and customize the user
|
|
40
|
+
* information stored after sign up, including email normalization.
|
|
41
|
+
*
|
|
42
|
+
* Called for every flow ("signUp", "signIn", "reset",
|
|
43
|
+
* "reset-verification" and "email-verification").
|
|
44
|
+
*/
|
|
45
|
+
profile?: (
|
|
46
|
+
/**
|
|
47
|
+
* The values passed to the `signIn` function.
|
|
48
|
+
*/
|
|
49
|
+
params: Record<string, Value | undefined>,
|
|
50
|
+
/**
|
|
51
|
+
* Convex ActionCtx in case you want to read from or write to
|
|
52
|
+
* the database.
|
|
53
|
+
*/
|
|
54
|
+
ctx: GenericActionCtxWithAuthConfig<DataModel>) => WithoutSystemFields<DocumentByName<DataModel, "user">> & {
|
|
55
|
+
email: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Performs custom validation on password provided during sign up or reset.
|
|
59
|
+
*
|
|
60
|
+
* Otherwise the default validation is used (password is not empty and
|
|
61
|
+
* at least 8 characters in length).
|
|
62
|
+
*
|
|
63
|
+
* If the provided password is invalid, implementations must throw an Error.
|
|
64
|
+
*
|
|
65
|
+
* @param password the password supplied during "signUp" or
|
|
66
|
+
* "reset-verification" flows.
|
|
67
|
+
*/
|
|
68
|
+
validatePasswordRequirements?: (password: string) => void;
|
|
69
|
+
/**
|
|
70
|
+
* Provide hashing and verification functions if you want to control
|
|
71
|
+
* how passwords are hashed.
|
|
72
|
+
*/
|
|
73
|
+
crypto?: ConvexCredentialsUserConfig["crypto"];
|
|
74
|
+
/**
|
|
75
|
+
* An Auth.js email provider used to require verification
|
|
76
|
+
* before password reset.
|
|
77
|
+
*/
|
|
78
|
+
reset?: EmailConfig | ((...args: any) => EmailConfig);
|
|
79
|
+
/**
|
|
80
|
+
* An Auth.js email provider used to require verification
|
|
81
|
+
* before sign up / sign in.
|
|
82
|
+
*/
|
|
83
|
+
verify?: EmailConfig | ((...args: any) => EmailConfig);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Email and password authentication provider.
|
|
87
|
+
*
|
|
88
|
+
* Passwords are by default hashed using Scrypt from Lucia.
|
|
89
|
+
* You can customize the hashing via the `crypto` option.
|
|
90
|
+
*
|
|
91
|
+
* Email verification is not required unless you pass
|
|
92
|
+
* an email provider to the `verify` option.
|
|
93
|
+
*/
|
|
94
|
+
export default function password<DataModel extends GenericDataModel>(config?: PasswordConfig<DataModel>): import("@robelest/convex-auth/component").ConvexCredentialsConfig;
|
|
95
|
+
//# sourceMappingURL=Password.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Password.d.ts","sourceRoot":"","sources":["../../src/providers/Password.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAA0B,EACxB,2BAA2B,EAC5B,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EACL,WAAW,EACX,8BAA8B,EAO/B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,SAAS,SAAS,gBAAgB;IAChE;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;;;OAMG;IACH,OAAO,CAAC,EAAE;IACR;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,GAAG,SAAS,CAAC;IACzC;;;OAGG;IACH,GAAG,EAAE,8BAA8B,CAAC,SAAS,CAAC,KAC3C,mBAAmB,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,GAAG;QAC5D,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF;;;;;;;;;;OAUG;IACH,4BAA4B,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D;;;OAGG;IACH,MAAM,CAAC,EAAE,2BAA2B,CAAC,QAAQ,CAAC,CAAC;IAC/C;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,WAAW,CAAC,CAAC;IACtD;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,WAAW,CAAC,CAAC;CACxD;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,SAAS,SAAS,gBAAgB,EACjE,MAAM,GAAE,cAAc,CAAC,SAAS,CAAM,qEA8HvC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configure {@link Password} provider given a {@link PasswordConfig}.
|
|
3
|
+
*
|
|
4
|
+
* The `Password` provider supports the following flows, determined
|
|
5
|
+
* by the `flow` parameter:
|
|
6
|
+
*
|
|
7
|
+
* - `"signUp"`: Create a new account with a password.
|
|
8
|
+
* - `"signIn"`: Sign in with an existing account and password.
|
|
9
|
+
* - `"reset"`: Request a password reset.
|
|
10
|
+
* - `"reset-verification"`: Verify a password reset code and change password.
|
|
11
|
+
* - `"email-verification"`: If email verification is enabled and `code` is
|
|
12
|
+
* included in params, verify an OTP.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* import Password from "@robelest/convex-auth/providers/Password";
|
|
16
|
+
* import { convexAuth } from "@robelest/convex-auth/component";
|
|
17
|
+
*
|
|
18
|
+
* export const { auth, signIn, signOut, store } = convexAuth({
|
|
19
|
+
* providers: [Password],
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @module
|
|
24
|
+
*/
|
|
25
|
+
import convexCredentials from "@robelest/convex-auth/providers/ConvexCredentials";
|
|
26
|
+
import { createAccount, invalidateSessions, modifyAccountCredentials, retrieveAccount, signInViaProvider, } from "@robelest/convex-auth/component";
|
|
27
|
+
import { Scrypt } from "lucia";
|
|
28
|
+
/**
|
|
29
|
+
* Email and password authentication provider.
|
|
30
|
+
*
|
|
31
|
+
* Passwords are by default hashed using Scrypt from Lucia.
|
|
32
|
+
* You can customize the hashing via the `crypto` option.
|
|
33
|
+
*
|
|
34
|
+
* Email verification is not required unless you pass
|
|
35
|
+
* an email provider to the `verify` option.
|
|
36
|
+
*/
|
|
37
|
+
export default function password(config = {}) {
|
|
38
|
+
const provider = config.id ?? "password";
|
|
39
|
+
return convexCredentials({
|
|
40
|
+
id: "password",
|
|
41
|
+
authorize: async (params, ctx) => {
|
|
42
|
+
const flow = params.flow;
|
|
43
|
+
const passwordToValidate = flow === "signUp"
|
|
44
|
+
? params.password
|
|
45
|
+
: flow === "reset-verification"
|
|
46
|
+
? params.newPassword
|
|
47
|
+
: null;
|
|
48
|
+
if (passwordToValidate !== null) {
|
|
49
|
+
if (config.validatePasswordRequirements !== undefined) {
|
|
50
|
+
config.validatePasswordRequirements(passwordToValidate);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
validateDefaultPasswordRequirements(passwordToValidate);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const profile = config.profile?.(params, ctx) ?? defaultProfile(params);
|
|
57
|
+
const { email } = profile;
|
|
58
|
+
const secret = params.password;
|
|
59
|
+
let account;
|
|
60
|
+
let user;
|
|
61
|
+
if (flow === "signUp") {
|
|
62
|
+
if (secret === undefined) {
|
|
63
|
+
throw new Error("Missing `password` param for `signUp` flow");
|
|
64
|
+
}
|
|
65
|
+
const created = await createAccount(ctx, {
|
|
66
|
+
provider,
|
|
67
|
+
account: { id: email, secret },
|
|
68
|
+
profile: profile,
|
|
69
|
+
shouldLinkViaEmail: config.verify !== undefined,
|
|
70
|
+
shouldLinkViaPhone: false,
|
|
71
|
+
});
|
|
72
|
+
({ account, user } = created);
|
|
73
|
+
}
|
|
74
|
+
else if (flow === "signIn") {
|
|
75
|
+
if (secret === undefined) {
|
|
76
|
+
throw new Error("Missing `password` param for `signIn` flow");
|
|
77
|
+
}
|
|
78
|
+
const retrieved = await retrieveAccount(ctx, {
|
|
79
|
+
provider,
|
|
80
|
+
account: { id: email, secret },
|
|
81
|
+
});
|
|
82
|
+
if (retrieved === null) {
|
|
83
|
+
throw new Error("Invalid credentials");
|
|
84
|
+
}
|
|
85
|
+
({ account, user } = retrieved);
|
|
86
|
+
// START: Optional, support password reset
|
|
87
|
+
}
|
|
88
|
+
else if (flow === "reset") {
|
|
89
|
+
if (!config.reset) {
|
|
90
|
+
throw new Error(`Password reset is not enabled for ${provider}`);
|
|
91
|
+
}
|
|
92
|
+
const { account } = await retrieveAccount(ctx, {
|
|
93
|
+
provider,
|
|
94
|
+
account: { id: email },
|
|
95
|
+
});
|
|
96
|
+
return await signInViaProvider(ctx, config.reset, {
|
|
97
|
+
accountId: account._id,
|
|
98
|
+
params,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
else if (flow === "reset-verification") {
|
|
102
|
+
if (!config.reset) {
|
|
103
|
+
throw new Error(`Password reset is not enabled for ${provider}`);
|
|
104
|
+
}
|
|
105
|
+
if (params.newPassword === undefined) {
|
|
106
|
+
throw new Error("Missing `newPassword` param for `reset-verification` flow");
|
|
107
|
+
}
|
|
108
|
+
const result = await signInViaProvider(ctx, config.reset, { params });
|
|
109
|
+
if (result === null) {
|
|
110
|
+
throw new Error("Invalid code");
|
|
111
|
+
}
|
|
112
|
+
const { userId, sessionId } = result;
|
|
113
|
+
const secret = params.newPassword;
|
|
114
|
+
await modifyAccountCredentials(ctx, {
|
|
115
|
+
provider,
|
|
116
|
+
account: { id: email, secret },
|
|
117
|
+
});
|
|
118
|
+
await invalidateSessions(ctx, { userId, except: [sessionId] });
|
|
119
|
+
return { userId, sessionId };
|
|
120
|
+
// END
|
|
121
|
+
// START: Optional, email verification during sign in
|
|
122
|
+
}
|
|
123
|
+
else if (flow === "email-verification") {
|
|
124
|
+
if (!config.verify) {
|
|
125
|
+
throw new Error(`Email verification is not enabled for ${provider}`);
|
|
126
|
+
}
|
|
127
|
+
const { account } = await retrieveAccount(ctx, {
|
|
128
|
+
provider,
|
|
129
|
+
account: { id: email },
|
|
130
|
+
});
|
|
131
|
+
return await signInViaProvider(ctx, config.verify, {
|
|
132
|
+
accountId: account._id,
|
|
133
|
+
params,
|
|
134
|
+
});
|
|
135
|
+
// END
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
throw new Error("Missing `flow` param, it must be one of " +
|
|
139
|
+
'"signUp", "signIn", "reset", "reset-verification" or ' +
|
|
140
|
+
'"email-verification"!');
|
|
141
|
+
}
|
|
142
|
+
// START: Optional, email verification during sign in
|
|
143
|
+
if (config.verify && !account.emailVerified) {
|
|
144
|
+
return await signInViaProvider(ctx, config.verify, {
|
|
145
|
+
accountId: account._id,
|
|
146
|
+
params,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
// END
|
|
150
|
+
return { userId: user._id };
|
|
151
|
+
},
|
|
152
|
+
crypto: {
|
|
153
|
+
async hashSecret(password) {
|
|
154
|
+
return await new Scrypt().hash(password);
|
|
155
|
+
},
|
|
156
|
+
async verifySecret(password, hash) {
|
|
157
|
+
return await new Scrypt().verify(hash, password);
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
extraProviders: [config.reset, config.verify],
|
|
161
|
+
...config,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function validateDefaultPasswordRequirements(password) {
|
|
165
|
+
if (!password || password.length < 8) {
|
|
166
|
+
throw new Error("Invalid password");
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function defaultProfile(params) {
|
|
170
|
+
return {
|
|
171
|
+
email: params.email,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=Password.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Password.js","sourceRoot":"","sources":["../../src/providers/Password.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,iBAEN,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAIL,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EACf,iBAAiB,GAClB,MAAM,iCAAiC,CAAC;AAOzC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AA4D/B;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,SAAoC,EAAE;IAEtC,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,IAAI,UAAU,CAAC;IACzC,OAAO,iBAAiB,CAAY;QAClC,EAAE,EAAE,UAAU;QACd,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;YAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAc,CAAC;YACnC,MAAM,kBAAkB,GACtB,IAAI,KAAK,QAAQ;gBACf,CAAC,CAAE,MAAM,CAAC,QAAmB;gBAC7B,CAAC,CAAC,IAAI,KAAK,oBAAoB;oBAC7B,CAAC,CAAE,MAAM,CAAC,WAAsB;oBAChC,CAAC,CAAC,IAAI,CAAC;YACb,IAAI,kBAAkB,KAAK,IAAI,EAAE,CAAC;gBAChC,IAAI,MAAM,CAAC,4BAA4B,KAAK,SAAS,EAAE,CAAC;oBACtD,MAAM,CAAC,4BAA4B,CAAC,kBAAkB,CAAC,CAAC;gBAC1D,CAAC;qBAAM,CAAC;oBACN,mCAAmC,CAAC,kBAAkB,CAAC,CAAC;gBAC1D,CAAC;YACH,CAAC;YACD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,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