@absolutejs/auth 0.69.4 → 0.69.5

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 (110) 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 +245 -0
  7. package/dist/adaptive/types.d.ts +62 -0
  8. package/dist/agents/idJag.d.ts +49 -0
  9. package/dist/agents/inMemoryStores.d.ts +4 -0
  10. package/dist/agents/index.d.ts +13 -0
  11. package/dist/agents/oidcAdapter.d.ts +20 -0
  12. package/dist/agents/postgresStores.d.ts +1176 -0
  13. package/dist/agents/registrationClient.d.ts +50 -0
  14. package/dist/apikeys/inMemoryStores.d.ts +4 -0
  15. package/dist/apikeys/postgresStores.d.ts +359 -0
  16. package/dist/audit/export.d.ts +2 -0
  17. package/dist/audit/inMemoryAuditStore.d.ts +2 -0
  18. package/dist/audit/integrity.d.ts +19 -0
  19. package/dist/audit/postgresAuditStore.d.ts +116 -0
  20. package/dist/audit/siem.d.ts +11 -0
  21. package/dist/cli/import/auth0.d.ts +2 -0
  22. package/dist/cli/import/clerk.d.ts +2 -0
  23. package/dist/cli/import/index.d.ts +10 -0
  24. package/dist/cli/import/lucia.d.ts +2 -0
  25. package/dist/cli/import/nextauth.d.ts +2 -0
  26. package/dist/cli/import/supabase.d.ts +2 -0
  27. package/dist/cli/import/types.d.ts +27 -0
  28. package/dist/cli/migrate.d.ts +2 -0
  29. package/dist/client/components/react/SignIn.d.ts +32 -0
  30. package/dist/client/components/react/SignUp.d.ts +29 -0
  31. package/dist/client/components/react/UserButton.d.ts +36 -0
  32. package/dist/client/createAuthClient.d.ts +311 -0
  33. package/dist/client/index.d.ts +6 -0
  34. package/dist/client/mobile.d.ts +87 -0
  35. package/dist/client/passkeyHelpers.d.ts +19 -0
  36. package/dist/client/react.d.ts +87 -0
  37. package/dist/client/runtimeTransport.d.ts +3 -0
  38. package/dist/client/sessionExpiry.d.ts +37 -0
  39. package/dist/client/solid.d.ts +86 -0
  40. package/dist/client/svelte.d.ts +86 -0
  41. package/dist/client/vue.d.ts +88 -0
  42. package/dist/compliance/redaction.d.ts +8 -0
  43. package/dist/fga/config.d.ts +53 -0
  44. package/dist/fga/inMemoryStores.d.ts +3 -0
  45. package/dist/fga/postgresStores.d.ts +116 -0
  46. package/dist/fga/redisCheckCache.d.ts +11 -0
  47. package/dist/fga/schema.d.ts +2 -0
  48. package/dist/fga/types.d.ts +28 -0
  49. package/dist/fingerprint-client/index.d.ts +26 -0
  50. package/dist/htmx/index.d.ts +2 -0
  51. package/dist/index.d.ts +4042 -0
  52. package/dist/linkedProviders/index.d.ts +3 -0
  53. package/dist/lockout/inMemoryLockoutStore.d.ts +2 -0
  54. package/dist/lockout/postgresLockoutStore.d.ts +71 -0
  55. package/dist/lockout/redisLockoutStore.d.ts +3 -0
  56. package/dist/manifest.d.ts +19 -0
  57. package/dist/manifest.json +386 -0
  58. package/dist/mfa/postgresMfaStore.d.ts +266 -0
  59. package/dist/migrations/generate.d.ts +2 -0
  60. package/dist/migrations/index.d.ts +6 -0
  61. package/dist/migrations/runner.d.ts +22 -0
  62. package/dist/migrations/types.d.ts +14 -0
  63. package/dist/oidc/clientIdMetadata.d.ts +28 -0
  64. package/dist/oidc/inMemoryStores.d.ts +12 -0
  65. package/dist/oidc/inMemoryVciStores.d.ts +3 -0
  66. package/dist/oidc/index.d.ts +14 -0
  67. package/dist/oidc/operator.d.ts +14 -0
  68. package/dist/oidc/postgresStores.d.ts +1361 -0
  69. package/dist/oidc/vciRoutes.d.ts +56 -0
  70. package/dist/organizations/inMemoryOrganizationStore.d.ts +2 -0
  71. package/dist/organizations/postgresOrganizationStore.d.ts +340 -0
  72. package/dist/passwordless/inMemoryPasswordlessTokenStore.d.ts +2 -0
  73. package/dist/passwordless/postgresPasswordlessTokenStore.d.ts +56 -0
  74. package/dist/plugins/denyDisposableEmail.d.ts +7 -0
  75. package/dist/plugins/discordAlert.d.ts +7 -0
  76. package/dist/plugins/geoBlock.d.ts +8 -0
  77. package/dist/plugins/index.d.ts +12 -0
  78. package/dist/plugins/pagerdutyAlert.d.ts +9 -0
  79. package/dist/plugins/posthogIdentify.d.ts +7 -0
  80. package/dist/plugins/slackAlert.d.ts +7 -0
  81. package/dist/portal/inMemorySetupSessionStore.d.ts +2 -0
  82. package/dist/portal/postgresSetupSessionStore.d.ts +116 -0
  83. package/dist/providers/index.d.ts +2 -0
  84. package/dist/roles/inMemoryRoleStore.d.ts +2 -0
  85. package/dist/roles/postgresRoleStore.d.ts +86 -0
  86. package/dist/roles/resolver.d.ts +17 -0
  87. package/dist/saml.d.ts +1 -0
  88. package/dist/scim/inMemoryScimTokenStore.d.ts +2 -0
  89. package/dist/scim/postgresScimTokenStore.d.ts +86 -0
  90. package/dist/server.d.ts +34 -0
  91. package/dist/sso/inMemorySamlServiceProviderStore.d.ts +2 -0
  92. package/dist/sso/inMemorySsoConnectionStore.d.ts +2 -0
  93. package/dist/sso/nodeSamlAdapter.d.ts +8 -0
  94. package/dist/sso/postgresSamlServiceProviderStore.d.ts +101 -0
  95. package/dist/sso/postgresSsoConnectionStore.d.ts +117 -0
  96. package/dist/sso/samlIdpRoutes.d.ts +268 -0
  97. package/dist/vault/index.d.ts +5 -0
  98. package/dist/vc/inMemoryVpStores.d.ts +2 -0
  99. package/dist/vc/openid4vp.d.ts +82 -0
  100. package/dist/vc/postgresVcStores.d.ts +300 -0
  101. package/dist/vc/statusList.d.ts +29 -0
  102. package/dist/vc/statusListRoutes.d.ts +169 -0
  103. package/dist/vc/vpRoutes.d.ts +224 -0
  104. package/dist/webauthn/inMemoryWebAuthnCredentialStore.d.ts +2 -0
  105. package/dist/webauthn/postgresWebAuthnCredentialStore.d.ts +146 -0
  106. package/dist/webauthn/simpleWebAuthnAdapter.d.ts +3 -0
  107. package/dist/webauthn.d.ts +1 -0
  108. package/dist/webhooks/inMemoryStore.d.ts +2 -0
  109. package/dist/webhooks/postgresStore.d.ts +116 -0
  110. package/package.json +3 -3
@@ -0,0 +1,11 @@
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>;
@@ -0,0 +1,29 @@
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";
@@ -0,0 +1,34 @@
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>;
@@ -0,0 +1,2 @@
1
+ export type DeviceSignals = Record<string, unknown>;
2
+ export declare const fingerprintDevice: (signals: DeviceSignals) => Promise<string>;
@@ -0,0 +1,3 @@
1
+ import type { KnownDeviceStore, LoginHistoryStore } from './types';
2
+ export declare const createInMemoryKnownDeviceStore: () => KnownDeviceStore;
3
+ export declare const createInMemoryLoginHistoryStore: () => LoginHistoryStore;
@@ -0,0 +1,245 @@
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;
@@ -0,0 +1,62 @@
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
+ };
@@ -0,0 +1,49 @@
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>;
@@ -0,0 +1,4 @@
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;
@@ -0,0 +1,13 @@
1
+ export * from './config';
2
+ export * from './types';
3
+ export * from './registration';
4
+ export * from './registrationClient';
5
+ export * from './idJag';
6
+ export * from './oauthGuide';
7
+ export * from '../oidc/clientIdMetadata';
8
+ export { createOidcAgentCredentialVerifier } from './oidcAdapter';
9
+ export { agentHasScopes, resolveAgentPrincipal } from './principal';
10
+ export { agentAuthChallenge, agentAuthContextPlugin } from './context';
11
+ export { agentAuthPlugin } from './routes';
12
+ export { createInMemoryAgentDelegationStore, createInMemoryAgentIdentityRegistrationStore, createInMemoryAgentRegistrationStore } from './inMemoryStores';
13
+ export { agentDelegationsTable, agentDelegationsBunSqlTable, agentIdentityRegistrationsTable, agentIdentityRegistrationsBunSqlTable, agentRegistrationsTable, agentRegistrationsBunSqlTable, createBunSqlDrizzleAgentDelegationStore, createBunSqlDrizzleAgentIdentityRegistrationStore, createBunSqlDrizzleAgentRegistrationStore, createNeonAgentDelegationStore, createNeonAgentIdentityRegistrationStore, createNeonAgentRegistrationStore, createDrizzleAgentDelegationStore, createPostgresAgentDelegationStore, createPostgresAgentIdentityRegistrationStore, createPostgresAgentRegistrationStore } from './postgresStores';
@@ -0,0 +1,20 @@
1
+ import { type SigningKeyIdentity } from '../oidc/keys';
2
+ import type { AgentCredentialVerifier } from './types';
3
+ type OidcAgentCredentialVerifierKeys = {
4
+ publicJwk: JsonWebKey;
5
+ publicKeys?: never;
6
+ } | {
7
+ publicJwk?: never;
8
+ publicKeys: readonly SigningKeyIdentity[];
9
+ };
10
+ /** Adapter for Absolute Auth's RFC 9068-style JWT access tokens. It validates
11
+ * signature, issuer, audience, expiry, and extracts the OAuth client as the
12
+ * agent identity while retaining `sub` as the authorizing user. */
13
+ export declare const createOidcAgentCredentialVerifier: ({ issuer, isUsedDpopJti, maxDpopAgeMs, publicJwk, publicKeys, requireDpop, resource }: {
14
+ issuer: string;
15
+ isUsedDpopJti?: (jti: string) => boolean | Promise<boolean>;
16
+ maxDpopAgeMs?: number;
17
+ requireDpop?: boolean;
18
+ resource: string;
19
+ } & OidcAgentCredentialVerifierKeys) => AgentCredentialVerifier;
20
+ export {};