@absolutejs/auth 0.55.6 → 0.55.7

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 (215) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +120 -15
  3. package/dist/index.js.map +6 -5
  4. package/dist/server.js +119 -15
  5. package/dist/server.js.map +6 -5
  6. package/package.json +1 -1
  7. package/dist/abuse/captcha.d.ts +0 -11
  8. package/dist/abuse/config.d.ts +0 -29
  9. package/dist/actions.d.ts +0 -27
  10. package/dist/adaptive/config.d.ts +0 -34
  11. package/dist/adaptive/fingerprint.d.ts +0 -2
  12. package/dist/adaptive/inMemoryStores.d.ts +0 -3
  13. package/dist/adaptive/postgresStores.d.ts +0 -245
  14. package/dist/adaptive/types.d.ts +0 -62
  15. package/dist/agents/config.d.ts +0 -44
  16. package/dist/agents/context.d.ts +0 -46
  17. package/dist/agents/idJag.d.ts +0 -49
  18. package/dist/agents/inMemoryStores.d.ts +0 -4
  19. package/dist/agents/oidcAdapter.d.ts +0 -12
  20. package/dist/agents/postgresStores.d.ts +0 -569
  21. package/dist/agents/principal.d.ts +0 -4
  22. package/dist/agents/registration.d.ts +0 -162
  23. package/dist/agents/registrationClient.d.ts +0 -50
  24. package/dist/agents/routes.d.ts +0 -321
  25. package/dist/agents/types.d.ts +0 -129
  26. package/dist/apikeys/config.d.ts +0 -64
  27. package/dist/apikeys/inMemoryStores.d.ts +0 -4
  28. package/dist/apikeys/postgresStores.d.ts +0 -359
  29. package/dist/apikeys/routes.d.ts +0 -83
  30. package/dist/apikeys/types.d.ts +0 -53
  31. package/dist/audit/config.d.ts +0 -9
  32. package/dist/audit/export.d.ts +0 -2
  33. package/dist/audit/inMemoryAuditStore.d.ts +0 -2
  34. package/dist/audit/integrity.d.ts +0 -19
  35. package/dist/audit/postgresAuditStore.d.ts +0 -116
  36. package/dist/audit/siem.d.ts +0 -11
  37. package/dist/audit/types.d.ts +0 -19
  38. package/dist/audit/wrap.d.ts +0 -9
  39. package/dist/authContext.d.ts +0 -193
  40. package/dist/authorization/config.d.ts +0 -19
  41. package/dist/authorization/protectPermission.d.ts +0 -52
  42. package/dist/compliance/cipher.d.ts +0 -5
  43. package/dist/compliance/config.d.ts +0 -18
  44. package/dist/compliance/redaction.d.ts +0 -8
  45. package/dist/compliance/routes.d.ts +0 -89
  46. package/dist/constants.d.ts +0 -10
  47. package/dist/credentials/backgroundOps.d.ts +0 -45
  48. package/dist/credentials/config.d.ts +0 -68
  49. package/dist/credentials/emailValidation.d.ts +0 -9
  50. package/dist/credentials/emailVerification.d.ts +0 -83
  51. package/dist/credentials/import.d.ts +0 -34
  52. package/dist/credentials/inMemoryCredentialStore.d.ts +0 -2
  53. package/dist/credentials/legacyHashers.d.ts +0 -3
  54. package/dist/credentials/login.d.ts +0 -76
  55. package/dist/credentials/passwordPolicy.d.ts +0 -15
  56. package/dist/credentials/passwordReset.d.ts +0 -87
  57. package/dist/credentials/postgresCredentialStore.d.ts +0 -235
  58. package/dist/credentials/register.d.ts +0 -54
  59. package/dist/credentials/routes.d.ts +0 -201
  60. package/dist/credentials/types.d.ts +0 -26
  61. package/dist/crypto.d.ts +0 -32
  62. package/dist/errors.d.ts +0 -12
  63. package/dist/federation/tokenStore.d.ts +0 -29
  64. package/dist/fga/config.d.ts +0 -53
  65. package/dist/fga/inMemoryStores.d.ts +0 -3
  66. package/dist/fga/postgresStores.d.ts +0 -116
  67. package/dist/fga/redisCheckCache.d.ts +0 -11
  68. package/dist/fga/schema.d.ts +0 -2
  69. package/dist/fga/types.d.ts +0 -28
  70. package/dist/htmx/configuredRoutes.d.ts +0 -542
  71. package/dist/htmx/renderers.d.ts +0 -8
  72. package/dist/htmx/routes.d.ts +0 -514
  73. package/dist/htmx/types.d.ts +0 -129
  74. package/dist/linkedProviders/inMemoryStores.d.ts +0 -9
  75. package/dist/linkedProviders/neonStores.d.ts +0 -484
  76. package/dist/linkedProviders/oauthResolver.d.ts +0 -9
  77. package/dist/linkedProviders/resolver.d.ts +0 -22
  78. package/dist/lockout/config.d.ts +0 -17
  79. package/dist/lockout/inMemoryLockoutStore.d.ts +0 -2
  80. package/dist/lockout/postgresLockoutStore.d.ts +0 -71
  81. package/dist/lockout/redisLockoutStore.d.ts +0 -3
  82. package/dist/lockout/types.d.ts +0 -12
  83. package/dist/mfa/backupCodes.d.ts +0 -5
  84. package/dist/mfa/challenge.d.ts +0 -70
  85. package/dist/mfa/config.d.ts +0 -50
  86. package/dist/mfa/gate.d.ts +0 -2
  87. package/dist/mfa/inMemoryMfaStore.d.ts +0 -2
  88. package/dist/mfa/management.d.ts +0 -106
  89. package/dist/mfa/postgresMfaStore.d.ts +0 -206
  90. package/dist/mfa/rotation.d.ts +0 -17
  91. package/dist/mfa/routes.d.ts +0 -234
  92. package/dist/mfa/secret.d.ts +0 -2
  93. package/dist/mfa/sms.d.ts +0 -105
  94. package/dist/mfa/totp.d.ts +0 -91
  95. package/dist/mfa/types.d.ts +0 -23
  96. package/dist/migrations/generate.d.ts +0 -2
  97. package/dist/migrations/index.d.ts +0 -5
  98. package/dist/migrations/runner.d.ts +0 -13
  99. package/dist/migrations/types.d.ts +0 -14
  100. package/dist/oidc/clientAuth.d.ts +0 -19
  101. package/dist/oidc/clientIdMetadata.d.ts +0 -32
  102. package/dist/oidc/config.d.ts +0 -295
  103. package/dist/oidc/dpop.d.ts +0 -23
  104. package/dist/oidc/inMemoryStores.d.ts +0 -11
  105. package/dist/oidc/inMemoryVciStores.d.ts +0 -3
  106. package/dist/oidc/jar.d.ts +0 -14
  107. package/dist/oidc/keys.d.ts +0 -25
  108. package/dist/oidc/logout.d.ts +0 -38
  109. package/dist/oidc/mtls.d.ts +0 -11
  110. package/dist/oidc/par.d.ts +0 -28
  111. package/dist/oidc/postgresStores.d.ts +0 -1187
  112. package/dist/oidc/registration.d.ts +0 -138
  113. package/dist/oidc/routes.d.ts +0 -568
  114. package/dist/oidc/types.d.ts +0 -143
  115. package/dist/oidc/userinfo.d.ts +0 -21
  116. package/dist/oidc/vci.d.ts +0 -159
  117. package/dist/oidc/vciRoutes.d.ts +0 -92
  118. package/dist/organizations/config.d.ts +0 -46
  119. package/dist/organizations/inMemoryOrganizationStore.d.ts +0 -2
  120. package/dist/organizations/operations.d.ts +0 -39
  121. package/dist/organizations/postgresOrganizationStore.d.ts +0 -340
  122. package/dist/organizations/routes.d.ts +0 -299
  123. package/dist/organizations/types.d.ts +0 -45
  124. package/dist/passwordless/config.d.ts +0 -43
  125. package/dist/passwordless/inMemoryPasswordlessTokenStore.d.ts +0 -2
  126. package/dist/passwordless/postgresPasswordlessTokenStore.d.ts +0 -56
  127. package/dist/passwordless/routes.d.ts +0 -163
  128. package/dist/passwordless/types.d.ts +0 -9
  129. package/dist/pluginIdentity.d.ts +0 -2
  130. package/dist/portal/config.d.ts +0 -34
  131. package/dist/portal/inMemorySetupSessionStore.d.ts +0 -2
  132. package/dist/portal/operations.d.ts +0 -10
  133. package/dist/portal/postgresSetupSessionStore.d.ts +0 -116
  134. package/dist/portal/routes.d.ts +0 -160
  135. package/dist/portal/types.d.ts +0 -16
  136. package/dist/providers/clients.d.ts +0 -1818
  137. package/dist/providersFromEnv.d.ts +0 -19
  138. package/dist/roles/config.d.ts +0 -27
  139. package/dist/roles/inMemoryRoleStore.d.ts +0 -2
  140. package/dist/roles/operations.d.ts +0 -8
  141. package/dist/roles/postgresRoleStore.d.ts +0 -86
  142. package/dist/roles/resolver.d.ts +0 -17
  143. package/dist/roles/routes.d.ts +0 -106
  144. package/dist/roles/types.d.ts +0 -14
  145. package/dist/routes/authorize.d.ts +0 -102
  146. package/dist/routes/callback.d.ts +0 -64
  147. package/dist/routes/profile.d.ts +0 -70
  148. package/dist/routes/protectRoute.d.ts +0 -51
  149. package/dist/routes/refresh.d.ts +0 -74
  150. package/dist/routes/revoke.d.ts +0 -73
  151. package/dist/routes/sessions.d.ts +0 -103
  152. package/dist/routes/signout.d.ts +0 -70
  153. package/dist/routes/stepUp.d.ts +0 -48
  154. package/dist/routes/userStatus.d.ts +0 -72
  155. package/dist/scim/config.d.ts +0 -57
  156. package/dist/scim/extensions.d.ts +0 -30
  157. package/dist/scim/inMemoryScimTokenStore.d.ts +0 -2
  158. package/dist/scim/postgresScimTokenStore.d.ts +0 -86
  159. package/dist/scim/routes.d.ts +0 -366
  160. package/dist/scim/serialize.d.ts +0 -83
  161. package/dist/scim/types.d.ts +0 -54
  162. package/dist/session/access.d.ts +0 -33
  163. package/dist/session/anonymous.d.ts +0 -12
  164. package/dist/session/cleanup.d.ts +0 -45
  165. package/dist/session/impersonation.d.ts +0 -34
  166. package/dist/session/inMemoryStore.d.ts +0 -7
  167. package/dist/session/multiSession.d.ts +0 -27
  168. package/dist/session/neonStore.d.ts +0 -513
  169. package/dist/session/promote.d.ts +0 -23
  170. package/dist/session/redisStore.d.ts +0 -6
  171. package/dist/session/sessionsConfig.d.ts +0 -9
  172. package/dist/session/state.d.ts +0 -33
  173. package/dist/session/types.d.ts +0 -21
  174. package/dist/session/userSessions.d.ts +0 -19
  175. package/dist/sso/config.d.ts +0 -149
  176. package/dist/sso/discoveryRoute.d.ts +0 -63
  177. package/dist/sso/inMemorySamlServiceProviderStore.d.ts +0 -2
  178. package/dist/sso/inMemorySsoConnectionStore.d.ts +0 -2
  179. package/dist/sso/oidcRoutes.d.ts +0 -98
  180. package/dist/sso/postgresSamlServiceProviderStore.d.ts +0 -101
  181. package/dist/sso/postgresSsoConnectionStore.d.ts +0 -116
  182. package/dist/sso/samlIdpRoutes.d.ts +0 -139
  183. package/dist/sso/samlRoutes.d.ts +0 -179
  184. package/dist/sso/types.d.ts +0 -53
  185. package/dist/stores/postgres.d.ts +0 -5
  186. package/dist/stores/redis.d.ts +0 -5
  187. package/dist/telemetry/tracing.d.ts +0 -15
  188. package/dist/tenancy.d.ts +0 -9
  189. package/dist/typeGuards.d.ts +0 -6
  190. package/dist/typebox.d.ts +0 -4
  191. package/dist/types.d.ts +0 -421
  192. package/dist/utils.d.ts +0 -45
  193. package/dist/vault/config.d.ts +0 -20
  194. package/dist/vault/inMemoryVaultStore.d.ts +0 -2
  195. package/dist/vault/postgresVaultStore.d.ts +0 -86
  196. package/dist/vault/types.d.ts +0 -14
  197. package/dist/vc/inMemoryVpStores.d.ts +0 -2
  198. package/dist/vc/openid4vp.d.ts +0 -82
  199. package/dist/vc/postgresVcStores.d.ts +0 -300
  200. package/dist/vc/sdJwt.d.ts +0 -37
  201. package/dist/vc/statusList.d.ts +0 -29
  202. package/dist/vc/statusListRoutes.d.ts +0 -63
  203. package/dist/vc/vpRoutes.d.ts +0 -120
  204. package/dist/webauthn/adapter.d.ts +0 -59
  205. package/dist/webauthn/config.d.ts +0 -36
  206. package/dist/webauthn/inMemoryWebAuthnCredentialStore.d.ts +0 -2
  207. package/dist/webauthn/postgresWebAuthnCredentialStore.d.ts +0 -146
  208. package/dist/webauthn/routes.d.ts +0 -155
  209. package/dist/webauthn/types.d.ts +0 -17
  210. package/dist/webhooks/config.d.ts +0 -34
  211. package/dist/webhooks/dispatcher.d.ts +0 -3
  212. package/dist/webhooks/inMemoryStore.d.ts +0 -2
  213. package/dist/webhooks/postgresStore.d.ts +0 -116
  214. package/dist/webhooks/sign.d.ts +0 -11
  215. package/dist/webhooks/types.d.ts +0 -25
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.55.6",
2
+ "version": "0.55.7",
3
3
  "name": "@absolutejs/auth",
4
4
  "description": "An authorization library for absolutejs",
5
5
  "repository": {
@@ -1,11 +0,0 @@
1
- import type { AbuseContext } from './config';
2
- export declare const verifyHcaptcha: ({ secret }: {
3
- secret: string;
4
- }) => (token: string | undefined, context: AbuseContext) => Promise<boolean>;
5
- export declare const verifyRecaptcha: ({ minScore, secret }: {
6
- minScore?: number;
7
- secret: string;
8
- }) => (token: string | undefined, context: AbuseContext) => Promise<boolean>;
9
- export declare const verifyTurnstile: ({ secret }: {
10
- secret: string;
11
- }) => (token: string | undefined, context: AbuseContext) => Promise<boolean>;
@@ -1,29 +0,0 @@
1
- export type AbuseAction = 'allow' | 'challenge' | 'deny';
2
- export type AbuseSignal = 'blocked_ip' | 'bot' | 'captcha_failed' | 'not_allowlisted';
3
- export type BotClass = 'agent' | 'bot' | 'crawler' | 'human';
4
- export type AbuseContext = {
5
- captchaToken?: string;
6
- ip?: string;
7
- userAgent?: string;
8
- };
9
- export type AbuseReason = {
10
- action: AbuseAction;
11
- signal: AbuseSignal;
12
- };
13
- export type AbuseAssessment = {
14
- action: AbuseAction;
15
- reasons: AbuseReason[];
16
- };
17
- export type AbuseConfig = {
18
- botAction?: AbuseAction;
19
- captchaAction?: AbuseAction;
20
- classifyBot?: (context: AbuseContext) => BotClass | Promise<BotClass>;
21
- ipAllow?: string[];
22
- ipDeny?: string[];
23
- verifyCaptcha?: (token: string | undefined, context: AbuseContext) => boolean | Promise<boolean>;
24
- };
25
- export declare const assessAbuse: (config: AbuseConfig, context: AbuseContext) => Promise<AbuseAssessment>;
26
- export declare const createAbuseGuard: (config: AbuseConfig) => {
27
- assess: (context: AbuseContext) => Promise<AbuseAssessment>;
28
- };
29
- export declare const defaultBotClassifier: (context: AbuseContext) => "bot" | "crawler" | "human";
package/dist/actions.d.ts DELETED
@@ -1,27 +0,0 @@
1
- export type AuthEventName = 'postLogin' | 'postLogout' | 'postMfa' | 'postOauthCallback' | 'postRegister' | 'preLogin' | 'preRegister';
2
- export type AuthActionContext<UserType> = {
3
- email?: string;
4
- event: AuthEventName;
5
- ip?: string;
6
- metadata?: Record<string, unknown>;
7
- user?: UserType;
8
- userAgent?: string;
9
- };
10
- export type AuthActionResult = {
11
- kind: 'deny';
12
- reason: string;
13
- } | {
14
- kind: 'pass';
15
- } | {
16
- kind: 'redirect';
17
- url: string;
18
- };
19
- export type AuthAction<UserType> = {
20
- event: AuthEventName | AuthEventName[];
21
- handler: (context: AuthActionContext<UserType>) => AuthActionResult | Promise<AuthActionResult>;
22
- name: string;
23
- };
24
- export type AuthPipeline<UserType> = {
25
- run: (event: AuthEventName, context: Omit<AuthActionContext<UserType>, 'event'>) => Promise<AuthActionResult>;
26
- };
27
- export declare const createActionPipeline: <UserType>(actions: AuthAction<UserType>[]) => AuthPipeline<UserType>;
@@ -1,34 +0,0 @@
1
- import type { KnownDeviceStore, LoginHistoryStore, RiskAction, RiskAssessment, RiskContext, RiskSignal, RiskThresholds, RiskWeights, WeightedRiskAssessment } from './types';
2
- export type AdaptiveConfig = {
3
- historyLimit?: number;
4
- knownDeviceStore: KnownDeviceStore;
5
- loginHistoryStore: LoginHistoryStore;
6
- maxTravelKmh?: number;
7
- offHours?: {
8
- end: number;
9
- start: number;
10
- };
11
- rules?: Partial<Record<RiskSignal, RiskAction>>;
12
- velocityMaxAttempts?: number;
13
- velocityWindowMs?: number;
14
- };
15
- export declare const assessRisk: (config: AdaptiveConfig, context: RiskContext) => Promise<RiskAssessment>;
16
- export declare const createRiskEngine: (config: AdaptiveConfig) => {
17
- assessRisk: (context: RiskContext) => Promise<RiskAssessment>;
18
- recordAttempt: (context: RiskContext & {
19
- outcome: RiskAction;
20
- }) => Promise<void>;
21
- scoreRisk: (context: RiskContext, options?: {
22
- thresholds?: RiskThresholds;
23
- weights?: RiskWeights;
24
- }) => Promise<WeightedRiskAssessment>;
25
- trustDevice: (userId: string, deviceId: string, label?: string) => Promise<void>;
26
- };
27
- export declare const recordLoginAttempt: (config: AdaptiveConfig, context: RiskContext & {
28
- outcome: RiskAction;
29
- }) => Promise<void>;
30
- export declare const scoreRisk: (config: AdaptiveConfig & {
31
- thresholds?: RiskThresholds;
32
- weights?: RiskWeights;
33
- }, context: RiskContext) => Promise<WeightedRiskAssessment>;
34
- export declare const trustDevice: (config: AdaptiveConfig, userId: string, deviceId: string, label?: string) => Promise<void>;
@@ -1,2 +0,0 @@
1
- export type DeviceSignals = Record<string, unknown>;
2
- export declare const fingerprintDevice: (signals: DeviceSignals) => Promise<string>;
@@ -1,3 +0,0 @@
1
- import type { KnownDeviceStore, LoginHistoryStore } from './types';
2
- export declare const createInMemoryKnownDeviceStore: () => KnownDeviceStore;
3
- export declare const createInMemoryLoginHistoryStore: () => LoginHistoryStore;
@@ -1,245 +0,0 @@
1
- import { type AnyPgDatabase } from '../stores/postgres';
2
- import type { KnownDeviceStore, LoginHistoryStore } from './types';
3
- export declare const knownDevicesTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
4
- name: "auth_known_devices";
5
- schema: undefined;
6
- columns: {
7
- device_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_known_devices", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
8
- name: string;
9
- tableName: "auth_known_devices";
10
- dataType: "string";
11
- data: string;
12
- driverParam: string;
13
- notNull: true;
14
- hasDefault: false;
15
- isPrimaryKey: false;
16
- isAutoincrement: false;
17
- hasRuntimeDefault: false;
18
- enumValues: undefined;
19
- identity: undefined;
20
- generated: undefined;
21
- }>;
22
- first_seen_at_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_known_devices", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
23
- name: string;
24
- tableName: "auth_known_devices";
25
- dataType: "number int53";
26
- data: number;
27
- driverParam: string | number;
28
- notNull: true;
29
- hasDefault: false;
30
- isPrimaryKey: false;
31
- isAutoincrement: false;
32
- hasRuntimeDefault: false;
33
- enumValues: undefined;
34
- identity: undefined;
35
- generated: undefined;
36
- }>;
37
- label: import("drizzle-orm/pg-core").PgBuildColumn<"auth_known_devices", import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, {
38
- name: string;
39
- tableName: "auth_known_devices";
40
- dataType: "string";
41
- data: string;
42
- driverParam: string;
43
- notNull: false;
44
- hasDefault: false;
45
- isPrimaryKey: false;
46
- isAutoincrement: false;
47
- hasRuntimeDefault: false;
48
- enumValues: undefined;
49
- identity: undefined;
50
- generated: undefined;
51
- }>;
52
- last_seen_at_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_known_devices", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
53
- name: string;
54
- tableName: "auth_known_devices";
55
- dataType: "number int53";
56
- data: number;
57
- driverParam: string | number;
58
- notNull: true;
59
- hasDefault: false;
60
- isPrimaryKey: false;
61
- isAutoincrement: false;
62
- hasRuntimeDefault: false;
63
- enumValues: undefined;
64
- identity: undefined;
65
- generated: undefined;
66
- }>;
67
- trusted: import("drizzle-orm/pg-core").PgBuildColumn<"auth_known_devices", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBooleanBuilder>>, {
68
- name: string;
69
- tableName: "auth_known_devices";
70
- dataType: "boolean";
71
- data: boolean;
72
- driverParam: boolean;
73
- notNull: true;
74
- hasDefault: true;
75
- isPrimaryKey: false;
76
- isAutoincrement: false;
77
- hasRuntimeDefault: false;
78
- enumValues: undefined;
79
- identity: undefined;
80
- generated: undefined;
81
- }>;
82
- user_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_known_devices", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
83
- name: string;
84
- tableName: "auth_known_devices";
85
- dataType: "string";
86
- data: string;
87
- driverParam: string;
88
- notNull: true;
89
- hasDefault: false;
90
- isPrimaryKey: false;
91
- isAutoincrement: false;
92
- hasRuntimeDefault: false;
93
- enumValues: undefined;
94
- identity: undefined;
95
- generated: undefined;
96
- }>;
97
- };
98
- dialect: "pg";
99
- }>;
100
- export declare const loginHistoryTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
101
- name: "auth_login_history";
102
- schema: undefined;
103
- columns: {
104
- attempt_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_login_history", import("drizzle-orm/pg-core").SetIsPrimaryKey<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
105
- name: string;
106
- tableName: "auth_login_history";
107
- dataType: "string";
108
- data: string;
109
- driverParam: string;
110
- notNull: true;
111
- hasDefault: false;
112
- isPrimaryKey: false;
113
- isAutoincrement: false;
114
- hasRuntimeDefault: false;
115
- enumValues: undefined;
116
- identity: undefined;
117
- generated: undefined;
118
- }>;
119
- country: import("drizzle-orm/pg-core").PgBuildColumn<"auth_login_history", import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, {
120
- name: string;
121
- tableName: "auth_login_history";
122
- dataType: "string";
123
- data: string;
124
- driverParam: string;
125
- notNull: false;
126
- hasDefault: false;
127
- isPrimaryKey: false;
128
- isAutoincrement: false;
129
- hasRuntimeDefault: false;
130
- enumValues: undefined;
131
- identity: undefined;
132
- generated: undefined;
133
- }>;
134
- device_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_login_history", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
135
- name: string;
136
- tableName: "auth_login_history";
137
- dataType: "string";
138
- data: string;
139
- driverParam: string;
140
- notNull: true;
141
- hasDefault: false;
142
- isPrimaryKey: false;
143
- isAutoincrement: false;
144
- hasRuntimeDefault: false;
145
- enumValues: undefined;
146
- identity: undefined;
147
- generated: undefined;
148
- }>;
149
- ip_address: import("drizzle-orm/pg-core").PgBuildColumn<"auth_login_history", import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, {
150
- name: string;
151
- tableName: "auth_login_history";
152
- dataType: "string";
153
- data: string;
154
- driverParam: string;
155
- notNull: false;
156
- hasDefault: false;
157
- isPrimaryKey: false;
158
- isAutoincrement: false;
159
- hasRuntimeDefault: false;
160
- enumValues: undefined;
161
- identity: undefined;
162
- generated: undefined;
163
- }>;
164
- latitude: import("drizzle-orm/pg-core").PgBuildColumn<"auth_login_history", import("drizzle-orm/pg-core").PgDoublePrecisionBuilder, {
165
- name: string;
166
- tableName: "auth_login_history";
167
- dataType: "number double";
168
- data: number;
169
- driverParam: string | number;
170
- notNull: false;
171
- hasDefault: false;
172
- isPrimaryKey: false;
173
- isAutoincrement: false;
174
- hasRuntimeDefault: false;
175
- enumValues: undefined;
176
- identity: undefined;
177
- generated: undefined;
178
- }>;
179
- longitude: import("drizzle-orm/pg-core").PgBuildColumn<"auth_login_history", import("drizzle-orm/pg-core").PgDoublePrecisionBuilder, {
180
- name: string;
181
- tableName: "auth_login_history";
182
- dataType: "number double";
183
- data: number;
184
- driverParam: string | number;
185
- notNull: false;
186
- hasDefault: false;
187
- isPrimaryKey: false;
188
- isAutoincrement: false;
189
- hasRuntimeDefault: false;
190
- enumValues: undefined;
191
- identity: undefined;
192
- generated: undefined;
193
- }>;
194
- outcome: import("drizzle-orm/pg-core").PgBuildColumn<"auth_login_history", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
195
- name: string;
196
- tableName: "auth_login_history";
197
- dataType: "string";
198
- data: string;
199
- driverParam: string;
200
- notNull: true;
201
- hasDefault: false;
202
- isPrimaryKey: false;
203
- isAutoincrement: false;
204
- hasRuntimeDefault: false;
205
- enumValues: undefined;
206
- identity: undefined;
207
- generated: undefined;
208
- }>;
209
- timestamp_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_login_history", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
210
- name: string;
211
- tableName: "auth_login_history";
212
- dataType: "number int53";
213
- data: number;
214
- driverParam: string | number;
215
- notNull: true;
216
- hasDefault: false;
217
- isPrimaryKey: false;
218
- isAutoincrement: false;
219
- hasRuntimeDefault: false;
220
- enumValues: undefined;
221
- identity: undefined;
222
- generated: undefined;
223
- }>;
224
- user_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_login_history", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
225
- name: string;
226
- tableName: "auth_login_history";
227
- dataType: "string";
228
- data: string;
229
- driverParam: string;
230
- notNull: true;
231
- hasDefault: false;
232
- isPrimaryKey: false;
233
- isAutoincrement: false;
234
- hasRuntimeDefault: false;
235
- enumValues: undefined;
236
- identity: undefined;
237
- generated: undefined;
238
- }>;
239
- };
240
- dialect: "pg";
241
- }>;
242
- export declare const createNeonKnownDeviceStore: (databaseUrl: string) => KnownDeviceStore;
243
- export declare const createNeonLoginHistoryStore: (databaseUrl: string) => LoginHistoryStore;
244
- export declare const createPostgresKnownDeviceStore: <DB extends AnyPgDatabase>(db: DB) => KnownDeviceStore;
245
- export declare const createPostgresLoginHistoryStore: <DB extends AnyPgDatabase>(db: DB) => LoginHistoryStore;
@@ -1,62 +0,0 @@
1
- export type RiskAction = 'allow' | 'deny' | 'step_up';
2
- export type RiskSignal = 'impossible_travel' | 'new_country' | 'new_device' | 'off_hours' | 'proxy' | 'velocity';
3
- export type GeoPoint = {
4
- country?: string;
5
- latitude?: number;
6
- longitude?: number;
7
- };
8
- export type RiskContext = {
9
- deviceId: string;
10
- geo?: GeoPoint;
11
- ipAddress?: string;
12
- isProxy?: boolean;
13
- localHour?: number;
14
- now?: number;
15
- userId: string;
16
- };
17
- export type RiskReason = {
18
- action: RiskAction;
19
- signal: RiskSignal;
20
- };
21
- export type RiskAssessment = {
22
- action: RiskAction;
23
- reasons: RiskReason[];
24
- };
25
- export type RiskWeights = Partial<Record<RiskSignal, number>>;
26
- export type RiskThresholds = {
27
- deny: number;
28
- stepUp: number;
29
- };
30
- export type WeightedRiskAssessment = {
31
- action: RiskAction;
32
- reasons: RiskReason[];
33
- score: number;
34
- };
35
- export type KnownDevice = {
36
- deviceId: string;
37
- firstSeenAt: number;
38
- label?: string;
39
- lastSeenAt: number;
40
- trusted: boolean;
41
- userId: string;
42
- };
43
- export type KnownDeviceStore = {
44
- findDevice: (userId: string, deviceId: string) => Promise<KnownDevice | undefined>;
45
- listDevices: (userId: string) => Promise<KnownDevice[]>;
46
- saveDevice: (device: KnownDevice) => Promise<void>;
47
- };
48
- export type LoginAttempt = {
49
- attemptId: string;
50
- country?: string;
51
- deviceId: string;
52
- ipAddress?: string;
53
- latitude?: number;
54
- longitude?: number;
55
- outcome: RiskAction;
56
- timestamp: number;
57
- userId: string;
58
- };
59
- export type LoginHistoryStore = {
60
- listRecent: (userId: string, limit: number) => Promise<LoginAttempt[]>;
61
- recordAttempt: (attempt: LoginAttempt) => Promise<void>;
62
- };
@@ -1,44 +0,0 @@
1
- import type { RouteString } from '../types';
2
- import type { AgentCredentialVerifier, AgentDelegationStore, AgentRegistrationStore } from './types';
3
- import type { AgentRegistrationProtocolConfig } from './registration';
4
- export declare const DEFAULT_AGENT_RESOURCE_METADATA_ROUTE: RouteString;
5
- export type AgentRegistrationDiscoveryMetadata = {
6
- claim_endpoint: string;
7
- identity_assertion: {
8
- assertion_types_supported: string[];
9
- };
10
- identity_endpoint: string;
11
- identity_types_supported: string[];
12
- skill: string;
13
- };
14
- export type AgentAuthConfig = {
15
- /** Permit registered agents to authenticate without a user delegation. Secure
16
- * default is false; enable for machine-only resources. */
17
- allowUndelegated?: boolean;
18
- /** Open auth.md agent-registration support. Implemented natively by Absolute
19
- * Auth and projected through OAuth discovery; no WorkOS service is required. */
20
- agentRegistration?: AgentRegistrationProtocolConfig;
21
- authorizationServer: string;
22
- delegationStore: AgentDelegationStore;
23
- logoUri?: string;
24
- metadataRoute?: RouteString;
25
- /** Authorization-server route prefix. Defaults to `/oauth2`; used to derive
26
- * the authoritative token endpoint advertised by the generated guide. */
27
- oidcRoute?: RouteString;
28
- registrationStore: AgentRegistrationStore;
29
- /** Treat clients created through RFC 7591 DCR as agent registrations. Explicitly
30
- * opt-in because a deployment may also use DCR for ordinary relying parties. */
31
- registerDynamicClients?: boolean;
32
- resource: string;
33
- resourceName?: string;
34
- scopes: string[];
35
- verifyCredential: AgentCredentialVerifier;
36
- };
37
- export declare const agentProtectedResourceMetadata: (config: Pick<AgentAuthConfig, "authorizationServer" | "logoUri" | "resource" | "resourceName" | "scopes">) => {
38
- resource: string;
39
- scopes_supported: string[];
40
- resource_name?: string | undefined;
41
- resource_logo_uri?: string | undefined;
42
- authorization_servers: string[];
43
- bearer_methods_supported: string[];
44
- };
@@ -1,46 +0,0 @@
1
- import { Elysia } from 'elysia';
2
- import { type AgentAuthConfig } from './config';
3
- import type { AgentPrincipal } from './types';
4
- type AgentAuthFailure = {
5
- code: 'Forbidden' | 'Unauthorized';
6
- message: 'Agent is not authenticated' | 'Insufficient agent scopes';
7
- };
8
- export declare const agentAuthChallenge: ({ config, error, requiredScopes }: {
9
- config: AgentAuthConfig;
10
- error?: "invalid_token" | "insufficient_scope";
11
- requiredScopes?: string[];
12
- }) => string;
13
- export declare const agentResourceMetadataUrl: (config: AgentAuthConfig) => string;
14
- export declare const agentAuthContextPlugin: (config?: AgentAuthConfig) => Elysia<"", {
15
- decorator: {};
16
- store: {};
17
- derive: {
18
- readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AgentAuthFailure) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
19
- };
20
- resolve: {};
21
- }, {
22
- typebox: {};
23
- error: {};
24
- }, {
25
- schema: {};
26
- standaloneSchema: {};
27
- macro: {};
28
- macroFn: {};
29
- parser: {};
30
- response: import("elysia").ExtractErrorFromHandle<{
31
- readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AgentAuthFailure) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
32
- }>;
33
- }, {}, {
34
- derive: {};
35
- resolve: {};
36
- schema: {};
37
- standaloneSchema: {};
38
- response: {};
39
- }, {
40
- derive: {};
41
- resolve: {};
42
- schema: {};
43
- standaloneSchema: {};
44
- response: {};
45
- }>;
46
- export {};
@@ -1,49 +0,0 @@
1
- import { type SigningKey } from '../oidc/keys';
2
- import type { VerifiedAgentIdentityAssertion } from './types';
3
- export type AgentIdentityAssertionJtiStore = {
4
- /** Atomically records an issuer+jti pair. Returns false for a replay. */
5
- recordIfFresh: (issuer: string, jti: string, expiresAt: number) => Promise<boolean>;
6
- };
7
- export declare const createInMemoryAgentIdentityAssertionJtiStore: () => AgentIdentityAssertionJtiStore;
8
- export type AgentIdentityAssertionUser = {
9
- authenticatedAt: number;
10
- email?: string;
11
- emailVerified?: boolean;
12
- methods?: string[];
13
- name?: string;
14
- phoneNumber?: string;
15
- phoneNumberVerified?: boolean;
16
- subject: string;
17
- };
18
- /** Native provider-side ID-JAG issuance. The caller owns the user consent UI
19
- * and must authorize the requested audience before invoking this helper. */
20
- export declare const issueAgentIdentityAssertion: ({ agentContextId, agentPlatform, audience, clientId, issuer, now, resource, signingKey, ttlMs, user }: {
21
- agentContextId?: string;
22
- agentPlatform?: string;
23
- audience: string;
24
- clientId: string;
25
- issuer: string;
26
- now?: number;
27
- resource?: string;
28
- signingKey: SigningKey;
29
- ttlMs?: number;
30
- user: AgentIdentityAssertionUser;
31
- }) => Promise<{
32
- assertion: string;
33
- assertionType: "urn:ietf:params:oauth:token-type:id-jag";
34
- expiresAt: number;
35
- }>;
36
- /** Builds a fail-closed service-side verifier. Issuer resolution is injected so
37
- * the application can use pinned configuration, CIMD, or an egress-guarded
38
- * JWKS resolver without this package performing ambient network access. */
39
- export declare const createAgentIdentityAssertionVerifier: ({ audience, clockSkewMs, jtiStore, maxAssertionLifetimeMs, maxAuthenticationAgeMs, resolveIssuer }: {
40
- audience: string;
41
- clockSkewMs?: number;
42
- jtiStore: AgentIdentityAssertionJtiStore;
43
- maxAssertionLifetimeMs?: number;
44
- maxAuthenticationAgeMs?: number;
45
- resolveIssuer: (issuer: string) => Promise<{
46
- allowedClientIds?: string[];
47
- publicJwk: JsonWebKey;
48
- } | undefined>;
49
- }) => (assertion: string, now?: number) => Promise<VerifiedAgentIdentityAssertion | undefined>;
@@ -1,4 +0,0 @@
1
- import type { AgentDelegationStore, AgentIdentityRegistrationStore, AgentRegistrationStore } from './types';
2
- export declare const createInMemoryAgentDelegationStore: () => AgentDelegationStore;
3
- export declare const createInMemoryAgentIdentityRegistrationStore: () => AgentIdentityRegistrationStore;
4
- export declare const createInMemoryAgentRegistrationStore: () => AgentRegistrationStore;
@@ -1,12 +0,0 @@
1
- import type { AgentCredentialVerifier } from './types';
2
- /** Adapter for Absolute Auth's RFC 9068-style JWT access tokens. It validates
3
- * signature, issuer, audience, expiry, and extracts the OAuth client as the
4
- * agent identity while retaining `sub` as the authorizing user. */
5
- export declare const createOidcAgentCredentialVerifier: ({ issuer, isUsedDpopJti, maxDpopAgeMs, publicJwk, requireDpop, resource }: {
6
- issuer: string;
7
- isUsedDpopJti?: (jti: string) => boolean | Promise<boolean>;
8
- maxDpopAgeMs?: number;
9
- publicJwk: JsonWebKey;
10
- requireDpop?: boolean;
11
- resource: string;
12
- }) => AgentCredentialVerifier;