@gatwech/core 0.0.10 → 1.0.0-beta.18

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.
Files changed (130) hide show
  1. package/dist/api/index.d.mts +2 -2
  2. package/dist/context/index.d.mts +2 -2
  3. package/dist/db/adapter/index.d.mts +2 -2
  4. package/dist/db/index.d.mts +2 -2
  5. package/dist/env/index.d.mts +1 -1
  6. package/dist/env/index.mjs +1 -1
  7. package/dist/{env-JMSMESs1.mjs → env-4_Lym7sj.mjs} +7 -7
  8. package/dist/index-65G5U5DB.d.mts +3002 -0
  9. package/dist/{index-DLP-K0uY.d.mts → index-CmdhhvA2.d.mts} +3 -3
  10. package/dist/index.d.mts +3 -3
  11. package/dist/oauth2/index.d.mts +2 -2
  12. package/dist/social-providers/index.d.mts +3 -3
  13. package/dist/social-providers/index.mjs +71 -2412
  14. package/dist/src/api/index.d.ts +119 -0
  15. package/dist/src/async_hooks/index.d.ts +6 -0
  16. package/dist/src/context/endpoint-context.d.ts +14 -0
  17. package/dist/src/context/index.d.ts +3 -0
  18. package/dist/src/context/request-state.d.ts +13 -0
  19. package/dist/src/context/transaction.d.ts +11 -0
  20. package/dist/src/db/adapter/index.d.ts +401 -0
  21. package/{src/db/index.ts → dist/src/db/index.d.ts} +2 -18
  22. package/dist/src/db/plugin.d.ts +10 -0
  23. package/dist/src/db/schema/account.d.ts +22 -0
  24. package/dist/src/db/schema/rate-limit.d.ts +10 -0
  25. package/dist/src/db/schema/session.d.ts +17 -0
  26. package/dist/src/db/schema/shared.d.ts +6 -0
  27. package/dist/src/db/schema/user.d.ts +16 -0
  28. package/{src/db/schema/verification.ts → dist/src/db/schema/verification.d.ts} +8 -8
  29. package/dist/src/db/type.d.ts +159 -0
  30. package/dist/src/env/color-depth.d.ts +1 -0
  31. package/dist/src/env/env-impl.d.ts +29 -0
  32. package/dist/src/env/index.d.ts +3 -0
  33. package/dist/src/env/logger.d.ts +50 -0
  34. package/dist/src/error/codes.d.ts +27 -0
  35. package/dist/src/error/index.d.ts +4 -0
  36. package/dist/src/oauth2/client-credentials-token.d.ts +21 -0
  37. package/dist/src/oauth2/create-authorization-url.d.ts +21 -0
  38. package/dist/src/oauth2/index.d.ts +6 -0
  39. package/dist/src/oauth2/oauth-provider.d.ts +178 -0
  40. package/dist/src/oauth2/refresh-access-token.d.ts +20 -0
  41. package/dist/src/oauth2/utils.d.ts +3 -0
  42. package/dist/src/oauth2/validate-authorization-code.d.ts +28 -0
  43. package/dist/src/social-providers/github.d.ts +89 -0
  44. package/dist/src/social-providers/google.d.ts +82 -0
  45. package/dist/src/social-providers/index.d.ts +93 -0
  46. package/dist/src/types/context.d.ts +177 -0
  47. package/dist/src/types/cookie.d.ts +15 -0
  48. package/dist/src/types/helper.d.ts +9 -0
  49. package/dist/src/types/index.d.ts +7 -0
  50. package/dist/src/types/init-options.d.ts +1140 -0
  51. package/dist/src/types/plugin-client.d.ts +88 -0
  52. package/dist/src/types/plugin.d.ts +120 -0
  53. package/dist/src/utils/error-codes.d.ts +9 -0
  54. package/package.json +11 -5
  55. package/.turbo/turbo-build.log +0 -42
  56. package/dist/index-DjrJweYn.d.mts +0 -7312
  57. package/src/api/index.ts +0 -57
  58. package/src/async_hooks/index.ts +0 -35
  59. package/src/context/endpoint-context.ts +0 -48
  60. package/src/context/index.ts +0 -21
  61. package/src/context/request-state.test.ts +0 -346
  62. package/src/context/request-state.ts +0 -75
  63. package/src/context/transaction.ts +0 -72
  64. package/src/db/adapter/index.ts +0 -466
  65. package/src/db/plugin.ts +0 -11
  66. package/src/db/schema/account.ts +0 -34
  67. package/src/db/schema/rate-limit.ts +0 -21
  68. package/src/db/schema/session.ts +0 -17
  69. package/src/db/schema/shared.ts +0 -7
  70. package/src/db/schema/user.ts +0 -16
  71. package/src/db/type.ts +0 -180
  72. package/src/env/color-depth.ts +0 -172
  73. package/src/env/env-impl.ts +0 -124
  74. package/src/env/index.ts +0 -23
  75. package/src/env/logger.test.ts +0 -33
  76. package/src/env/logger.ts +0 -145
  77. package/src/error/codes.ts +0 -31
  78. package/src/error/index.ts +0 -11
  79. package/src/oauth2/client-credentials-token.ts +0 -102
  80. package/src/oauth2/create-authorization-url.ts +0 -85
  81. package/src/oauth2/index.ts +0 -21
  82. package/src/oauth2/oauth-provider.ts +0 -211
  83. package/src/oauth2/refresh-access-token.ts +0 -124
  84. package/src/oauth2/utils.ts +0 -36
  85. package/src/oauth2/validate-authorization-code.ts +0 -154
  86. package/src/social-providers/apple.ts +0 -213
  87. package/src/social-providers/atlassian.ts +0 -132
  88. package/src/social-providers/cognito.ts +0 -269
  89. package/src/social-providers/discord.ts +0 -169
  90. package/src/social-providers/dropbox.ts +0 -112
  91. package/src/social-providers/facebook.ts +0 -204
  92. package/src/social-providers/figma.ts +0 -115
  93. package/src/social-providers/github.ts +0 -154
  94. package/src/social-providers/gitlab.ts +0 -152
  95. package/src/social-providers/google.ts +0 -171
  96. package/src/social-providers/huggingface.ts +0 -118
  97. package/src/social-providers/index.ts +0 -124
  98. package/src/social-providers/kakao.ts +0 -178
  99. package/src/social-providers/kick.ts +0 -92
  100. package/src/social-providers/line.ts +0 -169
  101. package/src/social-providers/linear.ts +0 -120
  102. package/src/social-providers/linkedin.ts +0 -110
  103. package/src/social-providers/microsoft-entra-id.ts +0 -245
  104. package/src/social-providers/naver.ts +0 -112
  105. package/src/social-providers/notion.ts +0 -108
  106. package/src/social-providers/paybin.ts +0 -122
  107. package/src/social-providers/paypal.ts +0 -263
  108. package/src/social-providers/polar.ts +0 -107
  109. package/src/social-providers/reddit.ts +0 -122
  110. package/src/social-providers/roblox.ts +0 -110
  111. package/src/social-providers/salesforce.ts +0 -159
  112. package/src/social-providers/slack.ts +0 -111
  113. package/src/social-providers/spotify.ts +0 -93
  114. package/src/social-providers/tiktok.ts +0 -210
  115. package/src/social-providers/twitch.ts +0 -111
  116. package/src/social-providers/twitter.ts +0 -198
  117. package/src/social-providers/vk.ts +0 -126
  118. package/src/social-providers/zoom.ts +0 -217
  119. package/src/types/context.ts +0 -269
  120. package/src/types/cookie.ts +0 -7
  121. package/src/types/helper.ts +0 -6
  122. package/src/types/index.ts +0 -21
  123. package/src/types/init-options.ts +0 -1346
  124. package/src/types/plugin-client.ts +0 -100
  125. package/src/types/plugin.ts +0 -158
  126. package/src/utils/error-codes.ts +0 -51
  127. package/tsconfig.json +0 -7
  128. package/tsdown.config.ts +0 -20
  129. /package/{src/index.ts → dist/src/index.d.ts} +0 -0
  130. /package/{src/utils/index.ts → dist/src/utils/index.d.ts} +0 -0
@@ -0,0 +1,89 @@
1
+ import type { ProviderOptions } from "../oauth2";
2
+ export interface GithubProfile {
3
+ login: string;
4
+ id: string;
5
+ node_id: string;
6
+ avatar_url: string;
7
+ gravatar_id: string;
8
+ url: string;
9
+ html_url: string;
10
+ followers_url: string;
11
+ following_url: string;
12
+ gists_url: string;
13
+ starred_url: string;
14
+ subscriptions_url: string;
15
+ organizations_url: string;
16
+ repos_url: string;
17
+ events_url: string;
18
+ received_events_url: string;
19
+ type: string;
20
+ site_admin: boolean;
21
+ name: string;
22
+ company: string;
23
+ blog: string;
24
+ location: string;
25
+ email: string;
26
+ hireable: boolean;
27
+ bio: string;
28
+ twitter_username: string;
29
+ public_repos: string;
30
+ public_gists: string;
31
+ followers: string;
32
+ following: string;
33
+ created_at: string;
34
+ updated_at: string;
35
+ private_gists: string;
36
+ total_private_repos: string;
37
+ owned_private_repos: string;
38
+ disk_usage: string;
39
+ collaborators: string;
40
+ two_factor_authentication: boolean;
41
+ plan: {
42
+ name: string;
43
+ space: string;
44
+ private_repos: string;
45
+ collaborators: string;
46
+ };
47
+ }
48
+ export interface GithubOptions extends ProviderOptions<GithubProfile> {
49
+ clientId: string;
50
+ }
51
+ export declare const github: (options: GithubOptions) => {
52
+ id: "github";
53
+ name: string;
54
+ createAuthorizationURL({ state, scopes, loginHint, redirectURI }: {
55
+ state: string;
56
+ codeVerifier: string;
57
+ scopes?: string[] | undefined;
58
+ redirectURI: string;
59
+ display?: string | undefined;
60
+ loginHint?: string | undefined;
61
+ }): Promise<URL>;
62
+ validateAuthorizationCode: ({ code, redirectURI }: {
63
+ code: string;
64
+ redirectURI: string;
65
+ codeVerifier?: string | undefined;
66
+ deviceId?: string | undefined;
67
+ }) => Promise<import("../oauth2").OAuth2Tokens>;
68
+ refreshAccessToken: (refreshToken: string) => Promise<import("../oauth2").OAuth2Tokens>;
69
+ getUserInfo(token: import("../oauth2").OAuth2Tokens & {
70
+ user?: {
71
+ name?: {
72
+ firstName?: string;
73
+ lastName?: string;
74
+ };
75
+ email?: string;
76
+ } | undefined;
77
+ }): Promise<{
78
+ user: {
79
+ id: string;
80
+ name?: string;
81
+ email?: string | null;
82
+ image?: string;
83
+ emailVerified: boolean;
84
+ [key: string]: any;
85
+ };
86
+ data: any;
87
+ } | null>;
88
+ options: GithubOptions;
89
+ };
@@ -0,0 +1,82 @@
1
+ import type { ProviderOptions } from "../oauth2";
2
+ export interface GoogleProfile {
3
+ aud: string;
4
+ azp: string;
5
+ email: string;
6
+ email_verified: boolean;
7
+ exp: number;
8
+ /**
9
+ * The family name of the user, or last name in most
10
+ * Western languages.
11
+ */
12
+ family_name: string;
13
+ /**
14
+ * The given name of the user, or first name in most
15
+ * Western languages.
16
+ */
17
+ given_name: string;
18
+ hd?: string | undefined;
19
+ iat: number;
20
+ iss: string;
21
+ jti?: string | undefined;
22
+ locale?: string | undefined;
23
+ name: string;
24
+ nbf?: number | undefined;
25
+ picture: string;
26
+ sub: string;
27
+ }
28
+ export interface GoogleOptions extends ProviderOptions<GoogleProfile> {
29
+ clientId: string;
30
+ /**
31
+ * The access type to use for the authorization code request
32
+ */
33
+ accessType?: ("offline" | "online") | undefined;
34
+ /**
35
+ * The display mode to use for the authorization code request
36
+ */
37
+ display?: ("page" | "popup" | "touch" | "wap") | undefined;
38
+ /**
39
+ * The hosted domain of the user
40
+ */
41
+ hd?: string | undefined;
42
+ }
43
+ export declare const google: (options: GoogleOptions) => {
44
+ id: "google";
45
+ name: string;
46
+ createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, loginHint, display, }: {
47
+ state: string;
48
+ codeVerifier: string;
49
+ scopes?: string[] | undefined;
50
+ redirectURI: string;
51
+ display?: string | undefined;
52
+ loginHint?: string | undefined;
53
+ }): Promise<URL>;
54
+ validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
55
+ code: string;
56
+ redirectURI: string;
57
+ codeVerifier?: string | undefined;
58
+ deviceId?: string | undefined;
59
+ }) => Promise<import("../oauth2").OAuth2Tokens>;
60
+ refreshAccessToken: (refreshToken: string) => Promise<import("../oauth2").OAuth2Tokens>;
61
+ verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
62
+ getUserInfo(token: import("../oauth2").OAuth2Tokens & {
63
+ user?: {
64
+ name?: {
65
+ firstName?: string;
66
+ lastName?: string;
67
+ };
68
+ email?: string;
69
+ } | undefined;
70
+ }): Promise<{
71
+ user: {
72
+ id: string;
73
+ name?: string;
74
+ email?: string | null;
75
+ image?: string;
76
+ emailVerified: boolean;
77
+ [key: string]: any;
78
+ };
79
+ data: any;
80
+ } | null>;
81
+ options: GoogleOptions;
82
+ };
@@ -0,0 +1,93 @@
1
+ import * as z from "zod";
2
+ export declare const socialProviders: {
3
+ github: (options: import("./github").GithubOptions) => {
4
+ id: "github";
5
+ name: string;
6
+ createAuthorizationURL({ state, scopes, loginHint, redirectURI }: {
7
+ state: string;
8
+ codeVerifier: string;
9
+ scopes?: string[] | undefined;
10
+ redirectURI: string;
11
+ display?: string | undefined;
12
+ loginHint?: string | undefined;
13
+ }): Promise<URL>;
14
+ validateAuthorizationCode: ({ code, redirectURI }: {
15
+ code: string;
16
+ redirectURI: string;
17
+ codeVerifier?: string | undefined;
18
+ deviceId?: string | undefined;
19
+ }) => Promise<import("../oauth2").OAuth2Tokens>;
20
+ refreshAccessToken: (refreshToken: string) => Promise<import("../oauth2").OAuth2Tokens>;
21
+ getUserInfo(token: import("../oauth2").OAuth2Tokens & {
22
+ user?: {
23
+ name?: {
24
+ firstName?: string;
25
+ lastName?: string;
26
+ };
27
+ email?: string;
28
+ } | undefined;
29
+ }): Promise<{
30
+ user: {
31
+ id: string;
32
+ name?: string;
33
+ email?: string | null;
34
+ image?: string;
35
+ emailVerified: boolean;
36
+ [key: string]: any;
37
+ };
38
+ data: any;
39
+ } | null>;
40
+ options: import("./github").GithubOptions;
41
+ };
42
+ google: (options: import("./google").GoogleOptions) => {
43
+ id: "google";
44
+ name: string;
45
+ createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, loginHint, display, }: {
46
+ state: string;
47
+ codeVerifier: string;
48
+ scopes?: string[] | undefined;
49
+ redirectURI: string;
50
+ display?: string | undefined;
51
+ loginHint?: string | undefined;
52
+ }): Promise<URL>;
53
+ validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
54
+ code: string;
55
+ redirectURI: string;
56
+ codeVerifier?: string | undefined;
57
+ deviceId?: string | undefined;
58
+ }) => Promise<import("../oauth2").OAuth2Tokens>;
59
+ refreshAccessToken: (refreshToken: string) => Promise<import("../oauth2").OAuth2Tokens>;
60
+ verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
61
+ getUserInfo(token: import("../oauth2").OAuth2Tokens & {
62
+ user?: {
63
+ name?: {
64
+ firstName?: string;
65
+ lastName?: string;
66
+ };
67
+ email?: string;
68
+ } | undefined;
69
+ }): Promise<{
70
+ user: {
71
+ id: string;
72
+ name?: string;
73
+ email?: string | null;
74
+ image?: string;
75
+ emailVerified: boolean;
76
+ [key: string]: any;
77
+ };
78
+ data: any;
79
+ } | null>;
80
+ options: import("./google").GoogleOptions;
81
+ };
82
+ };
83
+ export declare const socialProviderList: ["github", ...(keyof typeof socialProviders)[]];
84
+ export declare const SocialProviderListEnum: z.ZodType<SocialProviderList[number] | (string & {})>;
85
+ export type SocialProvider = z.infer<typeof SocialProviderListEnum>;
86
+ export type SocialProviders = {
87
+ [K in SocialProviderList[number]]?: Parameters<(typeof socialProviders)[K]>[0] & {
88
+ enabled?: boolean | undefined;
89
+ };
90
+ };
91
+ export * from "./github";
92
+ export * from "./google";
93
+ export type SocialProviderList = typeof socialProviderList;
@@ -0,0 +1,177 @@
1
+ import type { CookieOptions, EndpointContext } from "better-call";
2
+ import type { Account, PayvoAuthDBSchema, DBPreservedModels, SecondaryStorage, Session, User, Verification } from "../db";
3
+ import type { DBAdapter, Where } from "../db/adapter";
4
+ import { createLogger } from "../env";
5
+ import type { OAuthProvider } from "../oauth2";
6
+ import type { PayvoAuthCookies } from "./cookie";
7
+ import type { LiteralUnion } from "./helper";
8
+ import type { PayvoAuthOptions, PayvoAuthRateLimitOptions } from "./init-options";
9
+ export type GenericEndpointContext<Options extends PayvoAuthOptions = PayvoAuthOptions> = EndpointContext<string, any> & {
10
+ context: AuthContext<Options>;
11
+ };
12
+ export interface InternalAdapter<Options extends PayvoAuthOptions = PayvoAuthOptions> {
13
+ createOAuthUser(user: Omit<User, "id" | "createdAt" | "updatedAt">, account: Omit<Account, "userId" | "id" | "createdAt" | "updatedAt"> & Partial<Account>): Promise<{
14
+ user: User;
15
+ account: Account;
16
+ }>;
17
+ createUser<T extends Record<string, any>>(user: Omit<User, "id" | "createdAt" | "updatedAt" | "emailVerified"> & Partial<User> & Record<string, any>): Promise<T & User>;
18
+ createAccount<T extends Record<string, any>>(account: Omit<Account, "id" | "createdAt" | "updatedAt"> & Partial<Account> & T): Promise<T & Account>;
19
+ listSessions(userId: string): Promise<Session[]>;
20
+ listUsers(limit?: number | undefined, offset?: number | undefined, sortBy?: {
21
+ field: string;
22
+ direction: "asc" | "desc";
23
+ } | undefined, where?: Where[] | undefined): Promise<User[]>;
24
+ countTotalUsers(where?: Where[] | undefined): Promise<number>;
25
+ deleteUser(userId: string): Promise<void>;
26
+ createSession(userId: string, dontRememberMe?: boolean | undefined, override?: (Partial<Session> & Record<string, any>) | undefined, overrideAll?: boolean | undefined): Promise<Session>;
27
+ findSession(token: string): Promise<{
28
+ session: Session & Record<string, any>;
29
+ user: User & Record<string, any>;
30
+ } | null>;
31
+ findSessions(sessionTokens: string[]): Promise<{
32
+ session: Session;
33
+ user: User;
34
+ }[]>;
35
+ updateSession(sessionToken: string, session: Partial<Session> & Record<string, any>): Promise<Session | null>;
36
+ deleteSession(token: string): Promise<void>;
37
+ deleteAccounts(userId: string): Promise<void>;
38
+ deleteAccount(accountId: string): Promise<void>;
39
+ deleteSessions(userIdOrSessionTokens: string | string[]): Promise<void>;
40
+ findOAuthUser(email: string, accountId: string, providerId: string): Promise<{
41
+ user: User;
42
+ accounts: Account[];
43
+ } | null>;
44
+ findUserByEmail(email: string, options?: {
45
+ includeAccounts: boolean;
46
+ } | undefined): Promise<{
47
+ user: User;
48
+ accounts: Account[];
49
+ } | null>;
50
+ findUserById(userId: string): Promise<User | null>;
51
+ linkAccount(account: Omit<Account, "id" | "createdAt" | "updatedAt"> & Partial<Account>): Promise<Account>;
52
+ updateUser(userId: string, data: Partial<User> & Record<string, any>): Promise<any>;
53
+ updateUserByEmail(email: string, data: Partial<User & Record<string, any>>): Promise<User>;
54
+ updatePassword(userId: string, password: string): Promise<void>;
55
+ findAccounts(userId: string): Promise<Account[]>;
56
+ findAccount(accountId: string): Promise<Account | null>;
57
+ findAccountByProviderId(accountId: string, providerId: string): Promise<Account | null>;
58
+ findAccountByUserId(userId: string): Promise<Account[]>;
59
+ updateAccount(id: string, data: Partial<Account>): Promise<Account>;
60
+ createVerificationValue(data: Omit<Verification, "createdAt" | "id" | "updatedAt"> & Partial<Verification>): Promise<Verification>;
61
+ findVerificationValue(identifier: string): Promise<Verification | null>;
62
+ deleteVerificationValue(id: string): Promise<void>;
63
+ deleteVerificationByIdentifier(identifier: string): Promise<void>;
64
+ updateVerificationValue(id: string, data: Partial<Verification>): Promise<Verification>;
65
+ }
66
+ type CreateCookieGetterFn = (cookieName: string, overrideAttributes?: Partial<CookieOptions> | undefined) => {
67
+ name: string;
68
+ attributes: CookieOptions;
69
+ };
70
+ type CheckPasswordFn<Options extends PayvoAuthOptions = PayvoAuthOptions> = (userId: string, ctx: GenericEndpointContext<Options>) => Promise<boolean>;
71
+ export type AuthContext<Options extends PayvoAuthOptions = PayvoAuthOptions> = {
72
+ options: Options;
73
+ appName: string;
74
+ baseURL: string;
75
+ trustedOrigins: string[];
76
+ oauthConfig: {
77
+ /**
78
+ * This is dangerous and should only be used in dev or staging environments.
79
+ */
80
+ skipStateCookieCheck?: boolean | undefined;
81
+ /**
82
+ * Strategy for storing OAuth state
83
+ *
84
+ * - "cookie": Store state in an encrypted cookie (stateless)
85
+ * - "database": Store state in the database
86
+ *
87
+ * @default "cookie"
88
+ */
89
+ storeStateStrategy: "database" | "cookie";
90
+ };
91
+ /**
92
+ * New session that will be set after the request
93
+ * meaning: there is a `set-cookie` header that will set
94
+ * the session cookie. This is the fetched session. And it's set
95
+ * by `setNewSession` method.
96
+ */
97
+ newSession: {
98
+ session: Session & Record<string, any>;
99
+ user: User & Record<string, any>;
100
+ } | null;
101
+ session: {
102
+ session: Session & Record<string, any>;
103
+ user: User & Record<string, any>;
104
+ } | null;
105
+ setNewSession: (session: {
106
+ session: Session & Record<string, any>;
107
+ user: User & Record<string, any>;
108
+ } | null) => void;
109
+ socialProviders: OAuthProvider[];
110
+ authCookies: PayvoAuthCookies;
111
+ logger: ReturnType<typeof createLogger>;
112
+ rateLimit: {
113
+ enabled: boolean;
114
+ window: number;
115
+ max: number;
116
+ storage: "memory" | "database" | "secondary-storage";
117
+ } & PayvoAuthRateLimitOptions;
118
+ adapter: DBAdapter<Options>;
119
+ internalAdapter: InternalAdapter<Options>;
120
+ createAuthCookie: CreateCookieGetterFn;
121
+ secret: string;
122
+ sessionConfig: {
123
+ updateAge: number;
124
+ expiresIn: number;
125
+ freshAge: number;
126
+ cookieRefreshCache: false | {
127
+ enabled: true;
128
+ updateAge: number;
129
+ };
130
+ };
131
+ generateId: (options: {
132
+ model: LiteralUnion<DBPreservedModels, string>;
133
+ size?: number | undefined;
134
+ }) => string | false;
135
+ secondaryStorage: SecondaryStorage | undefined;
136
+ password: {
137
+ hash: (password: string) => Promise<string>;
138
+ verify: (data: {
139
+ password: string;
140
+ hash: string;
141
+ }) => Promise<boolean>;
142
+ config: {
143
+ minPasswordLength: number;
144
+ maxPasswordLength: number;
145
+ };
146
+ checkPassword: CheckPasswordFn<Options>;
147
+ };
148
+ tables: PayvoAuthDBSchema;
149
+ runMigrations: () => Promise<void>;
150
+ publishTelemetry: (event: {
151
+ type: string;
152
+ anonymousId?: string | undefined;
153
+ payload: Record<string, any>;
154
+ }) => Promise<void>;
155
+ /**
156
+ * This skips the origin check for all requests.
157
+ *
158
+ * set to true by default for `test` environments and `false`
159
+ * for other environments.
160
+ *
161
+ * It's inferred from the `options.advanced?.disableCSRFCheck`
162
+ * option or `options.advanced?.disableOriginCheck` option.
163
+ *
164
+ * @default false
165
+ */
166
+ skipOriginCheck: boolean;
167
+ /**
168
+ * This skips the CSRF check for all requests.
169
+ *
170
+ * This is inferred from the `options.advanced?.
171
+ * disableCSRFCheck` option.
172
+ *
173
+ * @default false
174
+ */
175
+ skipCSRFCheck: boolean;
176
+ };
177
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { CookieOptions } from "better-call";
2
+ export type PayvoAuthCookies = {
3
+ sessionToken: {
4
+ name: string;
5
+ options: CookieOptions;
6
+ };
7
+ sessionData: {
8
+ name: string;
9
+ options: CookieOptions;
10
+ };
11
+ dontRememberToken: {
12
+ name: string;
13
+ options: CookieOptions;
14
+ };
15
+ };
@@ -0,0 +1,9 @@
1
+ export type Primitive = string | number | symbol | bigint | boolean | null | undefined;
2
+ export type Awaitable<T> = T | Promise<T>;
3
+ export type AwaitableFunction<T> = T | (() => Awaitable<T>);
4
+ export type LiteralString = "" | (string & Record<never, never>);
5
+ export type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
6
+ export type Prettify<T> = {
7
+ [K in keyof T]: T[K];
8
+ } & {};
9
+ export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
@@ -0,0 +1,7 @@
1
+ export type { StandardSchemaV1 } from "@standard-schema/spec";
2
+ export type { AuthContext, GenericEndpointContext, InternalAdapter, } from "./context";
3
+ export type { PayvoAuthCookies } from "./cookie";
4
+ export type * from "./helper";
5
+ export type { PayvoAuthAdvancedOptions, PayvoAuthOptions, PayvoAuthRateLimitOptions, GenerateIdFn, } from "./init-options";
6
+ export type { PayvoAuthPlugin, HookEndpointContext } from "./plugin";
7
+ export type { PayvoAuthClientOptions, PayvoAuthClientPlugin, ClientAtomListener, ClientStore, } from "./plugin-client";