@authhero/adapter-interfaces 0.1.0 → 0.1.2

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 (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/package.json +17 -5
  4. package/CHANGELOG.md +0 -7
  5. package/src/adapters/Applications.ts +0 -31
  6. package/src/adapters/AuthenticationCodes.ts +0 -6
  7. package/src/adapters/Branding.ts +0 -6
  8. package/src/adapters/Codes.ts +0 -6
  9. package/src/adapters/Connections.ts +0 -18
  10. package/src/adapters/Domains.ts +0 -11
  11. package/src/adapters/Hooks.ts +0 -18
  12. package/src/adapters/Keys.ts +0 -7
  13. package/src/adapters/ListParams.ts +0 -10
  14. package/src/adapters/Logs.ts +0 -12
  15. package/src/adapters/OTP.ts +0 -7
  16. package/src/adapters/Passwords.ts +0 -10
  17. package/src/adapters/Sessions.ts +0 -12
  18. package/src/adapters/Tenants.ts +0 -18
  19. package/src/adapters/Tickets.ts +0 -7
  20. package/src/adapters/UniversalLoginSession.ts +0 -17
  21. package/src/adapters/Users.ts +0 -20
  22. package/src/adapters/index.ts +0 -35
  23. package/src/index.ts +0 -2
  24. package/src/types/Application.ts +0 -33
  25. package/src/types/AuthParams.ts +0 -36
  26. package/src/types/AuthenticationCode.ts +0 -14
  27. package/src/types/BaseEntity.ts +0 -6
  28. package/src/types/Branding.ts +0 -26
  29. package/src/types/Client.ts +0 -51
  30. package/src/types/Code.ts +0 -9
  31. package/src/types/Connection.ts +0 -33
  32. package/src/types/Domain.ts +0 -17
  33. package/src/types/Hook.ts +0 -17
  34. package/src/types/JWKS.ts +0 -37
  35. package/src/types/LoginState.ts +0 -8
  36. package/src/types/OTP.ts +0 -26
  37. package/src/types/Password.ts +0 -9
  38. package/src/types/Session.ts +0 -10
  39. package/src/types/SigningKey.ts +0 -55
  40. package/src/types/Tenant.ts +0 -54
  41. package/src/types/Ticket.ts +0 -22
  42. package/src/types/Token.ts +0 -75
  43. package/src/types/User.ts +0 -45
  44. package/src/types/auth0/Identity.ts +0 -27
  45. package/src/types/auth0/LogsResponse.ts +0 -90
  46. package/src/types/auth0/Query.ts +0 -42
  47. package/src/types/auth0/Totals.ts +0 -13
  48. package/src/types/auth0/UserResponse.ts +0 -24
  49. package/src/types/auth0/index.ts +0 -3
  50. package/src/types/index.ts +0 -20
  51. package/tsconfig.json +0 -9
  52. package/tsconfig.node.json +0 -4
  53. package/tsconfig.tsbuildinfo +0 -1
  54. package/vite.config.ts +0 -43
  55. /package/{build/dist → dist}/adapter-interfaces.cjs +0 -0
  56. /package/{build/dist → dist}/adapter-interfaces.iife.js +0 -0
  57. /package/{build/dist → dist}/adapter-interfaces.mjs +0 -0
package/src/types/OTP.ts DELETED
@@ -1,26 +0,0 @@
1
- import {
2
- AuthorizationResponseMode,
3
- AuthorizationResponseType,
4
- } from "./AuthParams";
5
-
6
- export interface OTP {
7
- id: string;
8
- tenant_id: string;
9
- client_id: string;
10
- email: string;
11
- code: string;
12
- ip?: string;
13
- send: "link" | "code";
14
- authParams: {
15
- nonce?: string;
16
- state?: string;
17
- scope?: string;
18
- response_type?: AuthorizationResponseType;
19
- response_mode?: AuthorizationResponseMode;
20
- redirect_uri?: string;
21
- };
22
- created_at: Date;
23
- expires_at: Date;
24
- used_at?: string;
25
- user_id?: string;
26
- }
@@ -1,9 +0,0 @@
1
- export interface PasswordResponse {
2
- valid: boolean;
3
- message: string;
4
- }
5
-
6
- export interface PasswordParams {
7
- user_id: string;
8
- password: string;
9
- }
@@ -1,10 +0,0 @@
1
- export interface Session {
2
- id: string;
3
- tenant_id: string;
4
- client_id: string;
5
- created_at: Date;
6
- expires_at: Date;
7
- used_at: Date;
8
- deleted_at?: Date;
9
- user_id: string;
10
- }
@@ -1,55 +0,0 @@
1
- import { z } from "@hono/zod-openapi";
2
-
3
- export const certificateSchema = z.object({
4
- private_key: z.string(),
5
- public_key: z.string(),
6
- kid: z.string(),
7
- created_at: z.string(),
8
- revoked_at: z.string().optional(),
9
- });
10
-
11
- export interface Certificate {
12
- private_key: string;
13
- public_key: string;
14
- kid: string;
15
- created_at: string;
16
- revoked_at?: string;
17
- }
18
-
19
- export const signingKeySchema = z.object({
20
- kid: z.string().openapi({ description: "The key id of the signing key" }),
21
- cert: z
22
- .string()
23
- .openapi({ description: "The public certificate of the signing key" }),
24
- fingerprint: z.string().openapi({ description: "The cert fingerprint" }),
25
- thumbprint: z.string().openapi({ description: "The cert thumbprint" }),
26
- pkcs7: z.string().optional().openapi({
27
- description: "The public certificate of the signing key in pkcs7 format",
28
- }),
29
- current: z
30
- .boolean()
31
- .optional()
32
- .openapi({ description: "True if the key is the current key" }),
33
- next: z
34
- .boolean()
35
- .optional()
36
- .openapi({ description: "True if the key is the next key" }),
37
- previous: z
38
- .boolean()
39
- .optional()
40
- .openapi({ description: "True if the key is the previous key" }),
41
- current_since: z.string().optional().openapi({
42
- description: "The date and time when the key became the current key",
43
- }),
44
- current_until: z.string().optional().openapi({
45
- description: "The date and time when the current key was rotated",
46
- }),
47
- revoked: z
48
- .boolean()
49
- .optional()
50
- .openapi({ description: "True if the key is revoked" }),
51
- revoked_at: z
52
- .string()
53
- .optional()
54
- .openapi({ description: "The date and time when the key was revoked" }),
55
- });
@@ -1,54 +0,0 @@
1
- import { z } from "@hono/zod-openapi";
2
-
3
- export const tenantInsertSchema = z.object({
4
- name: z.string(),
5
- audience: z.string(),
6
- sender_email: z.string().email(),
7
- sender_name: z.string(),
8
- support_url: z.string().url().optional(),
9
- logo: z.string().url().optional(),
10
- primary_color: z.string().optional(),
11
- secondary_color: z.string().optional(),
12
- language: z.string().optional(),
13
- });
14
-
15
- export const tenantSchema = tenantInsertSchema.extend({
16
- created_at: z.string().transform((val) => (val === null ? "" : val)),
17
- updated_at: z.string().transform((val) => (val === null ? "" : val)),
18
- });
19
-
20
- export interface Tenant {
21
- id: string;
22
- name: string;
23
- audience: string;
24
- sender_email: string;
25
- sender_name: string;
26
- support_url?: string;
27
- logo?: string;
28
- primary_color?: string;
29
- secondary_color?: string;
30
- language?: string;
31
- created_at: string;
32
- updated_at: string;
33
- }
34
-
35
- export const vendorSettingsSchema = z.object({
36
- logoUrl: z.string(),
37
- loginBackgroundImage: z.string().nullish(),
38
- style: z.object({
39
- primaryColor: z.string(),
40
- buttonTextColor: z.string(),
41
- primaryHoverColor: z.string(),
42
- }),
43
- supportEmail: z.string().nullable(),
44
- supportUrl: z.string().nullable(),
45
- name: z.string(),
46
- showGreyishBackground: z.boolean().optional(),
47
- termsAndConditionsUrl: z.string().nullable(),
48
- companyName: z.string().optional(),
49
- checkoutHideSocial: z.boolean().optional(),
50
- siteUrl: z.string().nullable(),
51
- manageSubscriptionsUrl: z.string().optional(),
52
- });
53
-
54
- export type VendorSettings = z.infer<typeof vendorSettingsSchema>;
@@ -1,22 +0,0 @@
1
- import {
2
- AuthorizationResponseMode,
3
- AuthorizationResponseType,
4
- } from "./AuthParams";
5
-
6
- export interface Ticket {
7
- id: string;
8
- tenant_id: string;
9
- client_id: string;
10
- email: string;
11
- authParams?: {
12
- nonce?: string;
13
- state?: string;
14
- scope?: string;
15
- response_type?: AuthorizationResponseType;
16
- response_mode?: AuthorizationResponseMode;
17
- redirect_uri?: string;
18
- };
19
- created_at: Date;
20
- expires_at: Date;
21
- used_at?: Date;
22
- }
@@ -1,75 +0,0 @@
1
- import { z } from "@hono/zod-openapi";
2
-
3
- export enum GrantType {
4
- RefreshToken = "refresh_token",
5
- AuthorizationCode = "authorization_code",
6
- ClientCredential = "client_credentials",
7
- Passwordless = "passwordless",
8
- Password = "password",
9
- }
10
-
11
- const grantTypeSchema = z.nativeEnum(GrantType);
12
-
13
- const authorizationCodeGrantTypeParamsSchema = z.object({
14
- grant_type: grantTypeSchema.refine(
15
- (val) => val === GrantType.AuthorizationCode,
16
- ),
17
- code: z.string(),
18
- client_secret: z.string(),
19
- client_id: z.string(),
20
- });
21
-
22
- export type AuthorizationCodeGrantTypeParams = z.infer<
23
- typeof authorizationCodeGrantTypeParamsSchema
24
- >;
25
-
26
- const pkceAuthorizationCodeGrantTypeParamsSchema = z.object({
27
- grant_type: grantTypeSchema.refine(
28
- (val) => val === GrantType.AuthorizationCode,
29
- ),
30
- code: z.string(),
31
- code_verifier: z.string(),
32
- client_id: z.string().optional(),
33
- redirect_uri: z.string(),
34
- });
35
-
36
- export type PKCEAuthorizationCodeGrantTypeParams = z.infer<
37
- typeof pkceAuthorizationCodeGrantTypeParamsSchema
38
- >;
39
-
40
- const clientCredentialGrantTypeParamsSchema = z.object({
41
- grant_type: grantTypeSchema.refine(
42
- (val) => val === GrantType.ClientCredential,
43
- ),
44
- scope: z.string().optional(),
45
- client_secret: z.string(),
46
- client_id: z.string(),
47
- audience: z.string().optional(),
48
- });
49
-
50
- export type ClientCredentialsGrantTypeParams = z.infer<
51
- typeof clientCredentialGrantTypeParamsSchema
52
- >;
53
-
54
- const tokenResponseSchema = z.object({
55
- access_token: z.string(),
56
- id_token: z.string().optional(),
57
- scope: z.string().optional(),
58
- state: z.string().optional(),
59
- refresh_token: z.string().optional(),
60
- token_type: z.string(),
61
- expires_in: z.number(),
62
- });
63
- export type TokenResponse = z.infer<typeof tokenResponseSchema>;
64
-
65
- const codeResponseSchema = z.object({
66
- code: z.string(),
67
- state: z.string().optional(),
68
- });
69
- export type CodeResponse = z.infer<typeof codeResponseSchema>;
70
-
71
- export {
72
- authorizationCodeGrantTypeParamsSchema,
73
- pkceAuthorizationCodeGrantTypeParamsSchema,
74
- clientCredentialGrantTypeParamsSchema,
75
- };
package/src/types/User.ts DELETED
@@ -1,45 +0,0 @@
1
- import { z } from "@hono/zod-openapi";
2
- import { baseEntitySchema } from "./BaseEntity";
3
- import { identitySchema } from "./auth0/Identity";
4
-
5
- export const baseUserSchema = z.object({
6
- email: z.string().optional(),
7
- username: z.string().optional(),
8
- given_name: z.string().optional(),
9
- family_name: z.string().optional(),
10
- nickname: z.string().optional(),
11
- name: z.string().optional(),
12
- picture: z.string().optional(),
13
- locale: z.string().optional(),
14
- linked_to: z.string().optional(),
15
- profileData: z.string().optional(),
16
- user_id: z.string().optional(),
17
- });
18
-
19
- export type BaseUser = z.infer<typeof baseUserSchema>;
20
-
21
- export const userInsertSchema = baseUserSchema.extend({
22
- email_verified: z.boolean().default(false),
23
- verify_email: z.boolean().optional(),
24
- last_ip: z.string().optional(),
25
- last_login: z.string().optional(),
26
- user_id: z.string().optional(),
27
- provider: z.string().default("email"),
28
- connection: z.string().default("email"),
29
- });
30
-
31
- export const userSchema = userInsertSchema
32
- .extend(baseEntitySchema.shape)
33
- .extend({
34
- user_id: z.string(),
35
- // TODO: this not might be correct if you use the username
36
- email: z.string(),
37
- is_social: z.boolean(),
38
- login_count: z.number(),
39
- identities: z.array(identitySchema).optional(),
40
- });
41
-
42
- export type User = z.infer<typeof userSchema>;
43
-
44
- // TODO: Add the login_count and other properties
45
- export const auth0UserResponseSchema = userSchema;
@@ -1,27 +0,0 @@
1
- import { z } from "@hono/zod-openapi";
2
-
3
- export const profileDataSchema = z
4
- .object({
5
- email: z.string().optional(),
6
- email_verified: z.boolean().optional(),
7
- name: z.string().optional(),
8
- username: z.string().optional(),
9
- given_name: z.string().optional(),
10
- phone_number: z.string().optional(),
11
- phone_verified: z.boolean().optional(),
12
- family_name: z.string().optional(),
13
- })
14
- .catchall(z.any());
15
-
16
- export const identitySchema = z.object({
17
- connection: z.string(),
18
- user_id: z.string(),
19
- provider: z.string(),
20
- isSocial: z.boolean(),
21
- access_token: z.string().optional(),
22
- access_token_secret: z.string().optional(),
23
- refresh_token: z.string().optional(),
24
- profileData: profileDataSchema.optional(),
25
- });
26
-
27
- export type Identity = z.infer<typeof identitySchema>;
@@ -1,90 +0,0 @@
1
- import { z } from "@hono/zod-openapi";
2
-
3
- export enum LogTypes {
4
- SUCCESS_API_OPERATION = "sapi",
5
- //
6
- SUCCESS_SILENT_AUTH = "ssa",
7
- FAILED_SILENT_AUTH = "fsa",
8
- //
9
- SUCCESS_SIGNUP = "ss",
10
- FAILED_SIGNUP = "fs",
11
- //
12
- SUCCESS_LOGIN = "s",
13
- FAILED_LOGIN = "f",
14
- FAILED_LOGIN_INCORRECT_PASSWORD = "fp",
15
- // we don't have this in the logs yet
16
- // FAILED_LOGIN_INVALID_EMAIL_USERNAME = "fu",
17
- //
18
- SUCCESS_LOGOUT = "slo",
19
- SUCCESS_CROSS_ORIGIN_AUTHENTICATION = "scoa",
20
- FAILED_CROSS_ORIGIN_AUTHENTICATION = "fcoa",
21
- SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN = "seacft",
22
- SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN = "serft",
23
- CODE_LINK_SENT = "cls",
24
- // TODO - not implemented - just for completion as we do get this in our latest auth0 logs
25
- NOT_IMPLEMENTED_1 = "seccft",
26
- }
27
-
28
- // Enum for LogTypes
29
- const LogType = z.enum([
30
- "sapi", // SUCCESS_API_OPERATION
31
- "ssa", // SUCCESS_SILENT_AUTH - omitted for brevity and since it's clear from context
32
- "fsa", // FAILED_SILENT_AUTH
33
- "ss", // SUCCESS_SIGNUP
34
- "ssa", /// SUCCESS_SILENT_AUTH
35
- "fs",
36
- "s", // SUCCESS_LOGIN
37
- "f", // FAILED_LOGIN
38
- "fp", // FAILED_LOGIN_INCORRECT_PASSWORD
39
- // FAILED_LOGIN_INVALID_EMAIL_USERNAME = "fu", - we don't have this in the logs yet
40
- "slo", // SUCCESS_LOGOUT
41
- "scoa", // SUCCESS_CROSS_ORIGIN_AUTHENTICATION
42
- "fcoa", // FAILED_CROSS_ORIGIN_AUTHENTICATION
43
- "seccft", // NOT_IMPLEMENTED_1 - not implemented - just for completion as we do get this in our latest auth0 logs
44
- "cls", // NOT_IMPLEMENTED_2
45
- "seacft", // SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN
46
- "serft",
47
- ]);
48
-
49
- export type LogType = z.infer<typeof LogType>;
50
-
51
- export const Auth0Client = z.object({
52
- name: z.string(),
53
- version: z.string(),
54
- env: z
55
- .object({
56
- node: z.string().optional(),
57
- })
58
- .optional(),
59
- });
60
-
61
- export const logSchema = z.object({
62
- type: LogType,
63
- date: z.string(),
64
- description: z.string().optional(),
65
- log_id: z.string().optional(),
66
- _id: z.string().optional(),
67
- ip: z.string(),
68
- user_agent: z.string(),
69
- details: z.any().optional(), // Using z.any() as a placeholder for "details" type
70
- isMobile: z.boolean(),
71
- user_id: z.string().optional(),
72
- user_name: z.string().optional(),
73
- connection: z.string().optional(),
74
- connection_id: z.string().optional(),
75
- client_id: z.string().optional(),
76
- client_name: z.string().optional(),
77
- audience: z.string().optional(),
78
- scope: z.array(z.string()).optional(),
79
- strategy: z.string().optional(),
80
- strategy_type: z.string().optional(),
81
- hostname: z.string().optional(),
82
- auth0_client: Auth0Client.optional(),
83
- });
84
-
85
- export type Log = z.infer<typeof logSchema>;
86
-
87
- export type LogsResponse = Log & {
88
- log_id: string;
89
- _id: string;
90
- };
@@ -1,42 +0,0 @@
1
- import { z } from "@hono/zod-openapi";
2
-
3
- export const auth0QuerySchema = z.object({
4
- page: z
5
- .string()
6
- .min(0)
7
- .optional()
8
- .default("0")
9
- .transform((p) => parseInt(p, 10))
10
- .openapi({
11
- description: "The page number where 0 is the first page",
12
- }),
13
- per_page: z
14
- .string()
15
- .min(1)
16
- .optional()
17
- .default("10")
18
- .transform((p) => parseInt(p, 10))
19
- .openapi({
20
- description: "The number of items per page",
21
- }),
22
- include_totals: z
23
- .string()
24
- .optional()
25
- .default("false")
26
- .transform((it) => it === "true")
27
- .openapi({
28
- description:
29
- "If the total number of items should be included in the response",
30
- }),
31
- sort: z
32
- .string()
33
- .regex(/^.+:(-1|1)$/)
34
- .optional()
35
- .openapi({
36
- description:
37
- "A property that should have the format 'string:-1' or 'string:1'",
38
- }),
39
- q: z.string().optional().openapi({
40
- description: "A lucene query string used to filter the results",
41
- }),
42
- });
@@ -1,13 +0,0 @@
1
- import { z } from "@hono/zod-openapi";
2
-
3
- export const totalsSchema = z.object({
4
- start: z.number(),
5
- limit: z.number(),
6
- length: z.number(),
7
- });
8
-
9
- export interface Totals {
10
- start: number;
11
- limit: number;
12
- length: number;
13
- }
@@ -1,24 +0,0 @@
1
- import { z } from "@hono/zod-openapi";
2
- import { BaseUser, baseUserSchema } from "../User";
3
-
4
- export interface PostUsersBody extends BaseUser {
5
- password?: string;
6
- // Whether this user will receive a verification email after creation (true) or no email (false). Overrides behavior of email_verified parameter.
7
- verify_email?: boolean;
8
- username?: string;
9
- connection?: string;
10
- email_verified?: boolean;
11
- }
12
-
13
- export const userResponseSchema = baseUserSchema
14
- .extend({
15
- email: z.string(),
16
- login_count: z.number(),
17
- multifactor: z.array(z.string()).optional(),
18
- last_ip: z.string().optional(),
19
- last_login: z.string().optional(),
20
- user_id: z.string(),
21
- })
22
- .catchall(z.any());
23
-
24
- export type UserResponse = z.infer<typeof userResponseSchema>;
@@ -1,3 +0,0 @@
1
- export * from "./Totals";
2
- export * from "./UserResponse";
3
- export * from "./LogsResponse";
@@ -1,20 +0,0 @@
1
- export * from "./Application";
2
- export * from "./AuthenticationCode";
3
- export * from "./AuthParams";
4
- export * from "./Token";
5
- export * from "./LoginState";
6
- export * from "./Client";
7
- export * from "./Token";
8
- export * from "./SigningKey";
9
- export * from "./Session";
10
- export * from "./OTP";
11
- export * from "./Ticket";
12
- export * from "./Code";
13
- export * from "./Password";
14
- export * from "./User";
15
- export * from "./auth0";
16
- export * from "./Branding";
17
- export * from "./Domain";
18
- export * from "./Hook";
19
- export * from "./Tenant";
20
- export * from "./Connection";
package/tsconfig.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- // "noEmit": true,
5
- "baseUrl": "."
6
- },
7
- "include": ["src"],
8
- "references": [{ "path": "./tsconfig.node.json" }]
9
- }
@@ -1,4 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.node.json",
3
- "include": ["vite.config.ts"]
4
- }