@absolutejs/auth 0.27.0-beta.0 → 0.27.0-beta.10

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 (45) hide show
  1. package/dist/abuse/captcha.d.ts +11 -0
  2. package/dist/abuse/config.d.ts +29 -0
  3. package/dist/adaptive/config.d.ts +34 -0
  4. package/dist/adaptive/fingerprint.d.ts +2 -0
  5. package/dist/adaptive/inMemoryStores.d.ts +3 -0
  6. package/dist/adaptive/postgresStores.d.ts +293 -0
  7. package/dist/adaptive/types.d.ts +62 -0
  8. package/dist/apikeys/config.d.ts +64 -0
  9. package/dist/apikeys/inMemoryStores.d.ts +4 -0
  10. package/dist/apikeys/postgresStores.d.ts +507 -0
  11. package/dist/apikeys/routes.d.ts +83 -0
  12. package/dist/apikeys/types.d.ts +53 -0
  13. package/dist/audit/export.d.ts +2 -0
  14. package/dist/audit/integrity.d.ts +19 -0
  15. package/dist/audit/siem.d.ts +11 -0
  16. package/dist/audit/types.d.ts +2 -1
  17. package/dist/credentials/config.d.ts +1 -0
  18. package/dist/credentials/emailValidation.d.ts +9 -0
  19. package/dist/credentials/login.d.ts +2 -1
  20. package/dist/credentials/passwordPolicy.d.ts +1 -0
  21. package/dist/credentials/routes.d.ts +1 -0
  22. package/dist/fga/config.d.ts +53 -0
  23. package/dist/fga/inMemoryStores.d.ts +3 -0
  24. package/dist/fga/postgresStores.d.ts +144 -0
  25. package/dist/fga/schema.d.ts +2 -0
  26. package/dist/fga/types.d.ts +28 -0
  27. package/dist/index.d.ts +6311 -3
  28. package/dist/index.js +4000 -1652
  29. package/dist/index.js.map +52 -24
  30. package/dist/mfa/rotation.d.ts +17 -0
  31. package/dist/mfa/types.d.ts +1 -0
  32. package/dist/oidc/config.d.ts +71 -0
  33. package/dist/oidc/dpop.d.ts +12 -0
  34. package/dist/oidc/inMemoryStores.d.ts +4 -0
  35. package/dist/oidc/keys.d.ts +21 -0
  36. package/dist/oidc/postgresStores.d.ts +573 -0
  37. package/dist/oidc/routes.d.ts +142 -0
  38. package/dist/oidc/types.d.ts +42 -0
  39. package/dist/portal/routes.d.ts +1 -1
  40. package/dist/session/anonymous.d.ts +11 -0
  41. package/dist/session/impersonation.d.ts +29 -0
  42. package/dist/session/multiSession.d.ts +25 -0
  43. package/dist/session/promote.d.ts +3 -1
  44. package/dist/types.d.ts +32 -0
  45. package/package.json +1 -1
@@ -19,6 +19,7 @@ export type CredentialEmailMessage = {
19
19
  type: CredentialEmailType;
20
20
  };
21
21
  export type CredentialsConfig<UserType> = {
22
+ checkBreachesOnLogin?: boolean;
22
23
  credentialStore: CredentialStore;
23
24
  getUserByEmail: (email: string) => Promise<UserType | null | undefined> | UserType | null | undefined;
24
25
  isMfaRequired?: (user: UserType) => boolean | Promise<boolean>;
@@ -0,0 +1,9 @@
1
+ export type EmailValidationResult = {
2
+ ok: boolean;
3
+ reason?: 'disposable' | 'invalid_format' | 'no_mx';
4
+ };
5
+ export declare const isDisposableEmail: (email: string, extraDomains?: Iterable<string>) => boolean;
6
+ export declare const validateEmailDeliverability: (email: string, options?: {
7
+ checkMx?: boolean;
8
+ disposableDomains?: Iterable<string>;
9
+ }) => Promise<EmailValidationResult>;
@@ -1,6 +1,6 @@
1
1
  import { Elysia } from 'elysia';
2
2
  import { type CredentialRouteProps } from './config';
3
- export declare const credentialsLogin: <UserType>({ authSessionStore, credentialStore, getUserByEmail, isMfaRequired, lockoutGuard, loginRoute, onCredentialsLoginError, onCredentialsLoginSuccess, requireEmailVerification, sessionDurationMs }: CredentialRouteProps<UserType>) => Elysia<"", {
3
+ export declare const credentialsLogin: <UserType>({ authSessionStore, checkBreachesOnLogin, credentialStore, getUserByEmail, isMfaRequired, lockoutGuard, loginRoute, onCredentialsLoginError, onCredentialsLoginSuccess, requireEmailVerification, sessionDurationMs }: CredentialRouteProps<UserType>) => Elysia<"", {
4
4
  decorator: {};
5
5
  store: {
6
6
  session: import("..").SessionRecord<UserType>;
@@ -32,6 +32,7 @@ export declare const credentialsLogin: <UserType>({ authSessionStore, credential
32
32
  200: {
33
33
  readonly status: "mfa_required";
34
34
  } | {
35
+ readonly passwordCompromised: boolean;
35
36
  readonly status: "authenticated";
36
37
  };
37
38
  401: "Invalid email or password";
@@ -12,3 +12,4 @@ export type PasswordPolicyResult = {
12
12
  violations: PasswordPolicyViolation[];
13
13
  };
14
14
  export declare const evaluatePassword: (password: string, policy?: PasswordPolicy) => Promise<PasswordPolicyResult>;
15
+ export declare const isPasswordCompromised: (password: string) => Promise<boolean>;
@@ -100,6 +100,7 @@ export declare const credentialRoutes: <UserType>(config: CredentialRouteProps<U
100
100
  200: {
101
101
  readonly status: "mfa_required";
102
102
  } | {
103
+ readonly passwordCompromised: boolean;
103
104
  readonly status: "authenticated";
104
105
  };
105
106
  401: "Invalid email or password";
@@ -0,0 +1,53 @@
1
+ import type { FgaSchema, Warrant, WarrantStore } from './types';
2
+ export type FgaCache = {
3
+ clear: () => void;
4
+ get: (key: string) => boolean | undefined;
5
+ set: (key: string, value: boolean) => void;
6
+ };
7
+ export type FgaConfig = {
8
+ cache?: FgaCache;
9
+ maxDepth?: number;
10
+ schema: FgaSchema;
11
+ warrantStore: WarrantStore;
12
+ };
13
+ export type CheckQuery = {
14
+ relation: string;
15
+ resourceId: string;
16
+ resourceType: string;
17
+ subjectId: string;
18
+ subjectType: string;
19
+ };
20
+ export type Subject = {
21
+ subjectId: string;
22
+ subjectType: string;
23
+ };
24
+ export type ObjectQuery = {
25
+ relation: string;
26
+ resourceType: string;
27
+ subjectId: string;
28
+ subjectType: string;
29
+ };
30
+ export declare const check: (config: FgaConfig, query: CheckQuery) => Promise<boolean>;
31
+ export declare const createInMemoryCheckCache: ({ maxEntries, ttlMs }?: {
32
+ maxEntries?: number;
33
+ ttlMs?: number;
34
+ }) => FgaCache;
35
+ export declare const createFgaEngine: (config: FgaConfig) => {
36
+ check: (query: CheckQuery) => Promise<boolean>;
37
+ deleteWarrant: (warrant: Warrant) => Promise<void>;
38
+ listObjects: (query: ObjectQuery) => Promise<string[]>;
39
+ listSubjects: (query: {
40
+ relation: string;
41
+ resourceId: string;
42
+ resourceType: string;
43
+ }) => Promise<Subject[]>;
44
+ writeWarrant: (warrant: Warrant) => Promise<void>;
45
+ };
46
+ export declare const deleteWarrant: (config: FgaConfig, warrant: Warrant) => Promise<void>;
47
+ export declare const listObjects: (config: FgaConfig, query: ObjectQuery) => Promise<string[]>;
48
+ export declare const listSubjects: (config: FgaConfig, query: {
49
+ relation: string;
50
+ resourceId: string;
51
+ resourceType: string;
52
+ }) => Promise<Subject[]>;
53
+ export declare const writeWarrant: (config: FgaConfig, warrant: Warrant) => Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { Warrant, WarrantStore } from './types';
2
+ export declare const createInMemoryWarrantStore: () => WarrantStore;
3
+ export declare const warrantKey: (warrant: Warrant) => string;
@@ -0,0 +1,144 @@
1
+ import { type AnyPgDatabase } from '../stores/postgres';
2
+ import type { WarrantStore } from './types';
3
+ export declare const warrantsTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
4
+ name: "auth_fga_warrants";
5
+ schema: undefined;
6
+ columns: {
7
+ id: import("drizzle-orm/pg-core").PgColumn<{
8
+ name: "id";
9
+ tableName: "auth_fga_warrants";
10
+ dataType: "string";
11
+ columnType: "PgVarchar";
12
+ data: string;
13
+ driverParam: string;
14
+ notNull: true;
15
+ hasDefault: false;
16
+ isPrimaryKey: true;
17
+ isAutoincrement: false;
18
+ hasRuntimeDefault: false;
19
+ enumValues: [string, ...string[]];
20
+ baseColumn: never;
21
+ identity: undefined;
22
+ generated: undefined;
23
+ }, {}, {
24
+ length: 255;
25
+ }>;
26
+ relation: import("drizzle-orm/pg-core").PgColumn<{
27
+ name: "relation";
28
+ tableName: "auth_fga_warrants";
29
+ dataType: "string";
30
+ columnType: "PgVarchar";
31
+ data: string;
32
+ driverParam: string;
33
+ notNull: true;
34
+ hasDefault: false;
35
+ isPrimaryKey: false;
36
+ isAutoincrement: false;
37
+ hasRuntimeDefault: false;
38
+ enumValues: [string, ...string[]];
39
+ baseColumn: never;
40
+ identity: undefined;
41
+ generated: undefined;
42
+ }, {}, {
43
+ length: 255;
44
+ }>;
45
+ resource_id: import("drizzle-orm/pg-core").PgColumn<{
46
+ name: "resource_id";
47
+ tableName: "auth_fga_warrants";
48
+ dataType: "string";
49
+ columnType: "PgVarchar";
50
+ data: string;
51
+ driverParam: string;
52
+ notNull: true;
53
+ hasDefault: false;
54
+ isPrimaryKey: false;
55
+ isAutoincrement: false;
56
+ hasRuntimeDefault: false;
57
+ enumValues: [string, ...string[]];
58
+ baseColumn: never;
59
+ identity: undefined;
60
+ generated: undefined;
61
+ }, {}, {
62
+ length: 255;
63
+ }>;
64
+ resource_type: import("drizzle-orm/pg-core").PgColumn<{
65
+ name: "resource_type";
66
+ tableName: "auth_fga_warrants";
67
+ dataType: "string";
68
+ columnType: "PgVarchar";
69
+ data: string;
70
+ driverParam: string;
71
+ notNull: true;
72
+ hasDefault: false;
73
+ isPrimaryKey: false;
74
+ isAutoincrement: false;
75
+ hasRuntimeDefault: false;
76
+ enumValues: [string, ...string[]];
77
+ baseColumn: never;
78
+ identity: undefined;
79
+ generated: undefined;
80
+ }, {}, {
81
+ length: 255;
82
+ }>;
83
+ subject_id: import("drizzle-orm/pg-core").PgColumn<{
84
+ name: "subject_id";
85
+ tableName: "auth_fga_warrants";
86
+ dataType: "string";
87
+ columnType: "PgVarchar";
88
+ data: string;
89
+ driverParam: string;
90
+ notNull: true;
91
+ hasDefault: false;
92
+ isPrimaryKey: false;
93
+ isAutoincrement: false;
94
+ hasRuntimeDefault: false;
95
+ enumValues: [string, ...string[]];
96
+ baseColumn: never;
97
+ identity: undefined;
98
+ generated: undefined;
99
+ }, {}, {
100
+ length: 255;
101
+ }>;
102
+ subject_relation: import("drizzle-orm/pg-core").PgColumn<{
103
+ name: "subject_relation";
104
+ tableName: "auth_fga_warrants";
105
+ dataType: "string";
106
+ columnType: "PgVarchar";
107
+ data: string;
108
+ driverParam: string;
109
+ notNull: false;
110
+ hasDefault: false;
111
+ isPrimaryKey: false;
112
+ isAutoincrement: false;
113
+ hasRuntimeDefault: false;
114
+ enumValues: [string, ...string[]];
115
+ baseColumn: never;
116
+ identity: undefined;
117
+ generated: undefined;
118
+ }, {}, {
119
+ length: 255;
120
+ }>;
121
+ subject_type: import("drizzle-orm/pg-core").PgColumn<{
122
+ name: "subject_type";
123
+ tableName: "auth_fga_warrants";
124
+ dataType: "string";
125
+ columnType: "PgVarchar";
126
+ data: string;
127
+ driverParam: string;
128
+ notNull: true;
129
+ hasDefault: false;
130
+ isPrimaryKey: false;
131
+ isAutoincrement: false;
132
+ hasRuntimeDefault: false;
133
+ enumValues: [string, ...string[]];
134
+ baseColumn: never;
135
+ identity: undefined;
136
+ generated: undefined;
137
+ }, {}, {
138
+ length: 255;
139
+ }>;
140
+ };
141
+ dialect: "pg";
142
+ }>;
143
+ export declare const createNeonWarrantStore: (databaseUrl: string) => WarrantStore;
144
+ export declare const createPostgresWarrantStore: (db: AnyPgDatabase) => WarrantStore;
@@ -0,0 +1,2 @@
1
+ import type { FgaSchema } from './types';
2
+ export declare const parseSchema: (dsl: string) => FgaSchema;
@@ -0,0 +1,28 @@
1
+ export type Warrant = {
2
+ relation: string;
3
+ resourceId: string;
4
+ resourceType: string;
5
+ subjectId: string;
6
+ subjectRelation?: string;
7
+ subjectType: string;
8
+ };
9
+ export type WarrantStore = {
10
+ deleteWarrant: (warrant: Warrant) => Promise<void>;
11
+ listForResource: (resourceType: string, resourceId: string, relation: string) => Promise<Warrant[]>;
12
+ listResourceIds: (resourceType: string) => Promise<string[]>;
13
+ saveWarrant: (warrant: Warrant) => Promise<void>;
14
+ };
15
+ export type RelationRule = {
16
+ kind: 'computedUserset';
17
+ relation: string;
18
+ } | {
19
+ kind: 'self';
20
+ } | {
21
+ kind: 'tupleToUserset';
22
+ relation: string;
23
+ viaRelation: string;
24
+ } | {
25
+ kind: 'union';
26
+ rules: RelationRule[];
27
+ };
28
+ export type FgaSchema = Record<string, Record<string, RelationRule>>;