@absolutejs/auth 0.54.9 → 0.55.1

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.
@@ -1,5 +1,5 @@
1
1
  import { type AnyPgDatabase } from '../stores/postgres';
2
- import type { AgentDelegationStatus, AgentDelegationStore, AgentRegistrationStatus, AgentRegistrationStore } from './types';
2
+ import type { AgentDelegationStatus, AgentDelegationStore, AgentIdentityRegistrationKind, AgentIdentityRegistrationStatus, AgentIdentityRegistrationStore, AgentRegistrationStatus, AgentRegistrationStore } from './types';
3
3
  export declare const agentDelegationsTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
4
4
  name: "auth_agent_delegations";
5
5
  schema: undefined;
@@ -157,6 +157,283 @@ export declare const agentDelegationsTable: import("drizzle-orm/pg-core").PgTabl
157
157
  };
158
158
  dialect: "pg";
159
159
  }>;
160
+ export declare const agentIdentityRegistrationsTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
161
+ name: "auth_agent_identity_registrations";
162
+ schema: undefined;
163
+ columns: {
164
+ agent_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
165
+ name: string;
166
+ tableName: "auth_agent_identity_registrations";
167
+ dataType: "string";
168
+ data: string;
169
+ driverParam: string;
170
+ notNull: true;
171
+ hasDefault: false;
172
+ isPrimaryKey: false;
173
+ isAutoincrement: false;
174
+ hasRuntimeDefault: false;
175
+ enumValues: undefined;
176
+ identity: undefined;
177
+ generated: undefined;
178
+ }>;
179
+ claim_attempt: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgJsonbBuilder, import("./types").AgentClaimAttempt | undefined>, {
180
+ name: string;
181
+ tableName: "auth_agent_identity_registrations";
182
+ dataType: "object json";
183
+ data: import("./types").AgentClaimAttempt | undefined;
184
+ driverParam: unknown;
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
+ claim_attempt_token_hash: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, {
195
+ name: string;
196
+ tableName: "auth_agent_identity_registrations";
197
+ dataType: "string";
198
+ data: string;
199
+ driverParam: string;
200
+ notNull: false;
201
+ hasDefault: false;
202
+ isPrimaryKey: false;
203
+ isAutoincrement: false;
204
+ hasRuntimeDefault: false;
205
+ enumValues: undefined;
206
+ identity: undefined;
207
+ generated: undefined;
208
+ }>;
209
+ claim_expires_at_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
210
+ name: string;
211
+ tableName: "auth_agent_identity_registrations";
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
+ claim_token_hash: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
225
+ name: string;
226
+ tableName: "auth_agent_identity_registrations";
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
+ created_at_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
240
+ name: string;
241
+ tableName: "auth_agent_identity_registrations";
242
+ dataType: "number int53";
243
+ data: number;
244
+ driverParam: string | number;
245
+ notNull: true;
246
+ hasDefault: false;
247
+ isPrimaryKey: false;
248
+ isAutoincrement: false;
249
+ hasRuntimeDefault: false;
250
+ enumValues: undefined;
251
+ identity: undefined;
252
+ generated: undefined;
253
+ }>;
254
+ expires_at_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
255
+ name: string;
256
+ tableName: "auth_agent_identity_registrations";
257
+ dataType: "number int53";
258
+ data: number;
259
+ driverParam: string | number;
260
+ notNull: true;
261
+ hasDefault: false;
262
+ isPrimaryKey: false;
263
+ isAutoincrement: false;
264
+ hasRuntimeDefault: false;
265
+ enumValues: undefined;
266
+ identity: undefined;
267
+ generated: undefined;
268
+ }>;
269
+ kind: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, AgentIdentityRegistrationKind>>, {
270
+ name: string;
271
+ tableName: "auth_agent_identity_registrations";
272
+ dataType: "string";
273
+ data: AgentIdentityRegistrationKind;
274
+ driverParam: string;
275
+ notNull: true;
276
+ hasDefault: false;
277
+ isPrimaryKey: false;
278
+ isAutoincrement: false;
279
+ hasRuntimeDefault: false;
280
+ enumValues: undefined;
281
+ identity: undefined;
282
+ generated: undefined;
283
+ }>;
284
+ last_polled_at_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").PgBigInt53Builder, {
285
+ name: string;
286
+ tableName: "auth_agent_identity_registrations";
287
+ dataType: "number int53";
288
+ data: number;
289
+ driverParam: string | number;
290
+ notNull: false;
291
+ hasDefault: false;
292
+ isPrimaryKey: false;
293
+ isAutoincrement: false;
294
+ hasRuntimeDefault: false;
295
+ enumValues: undefined;
296
+ identity: undefined;
297
+ generated: undefined;
298
+ }>;
299
+ login_hint: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, {
300
+ name: string;
301
+ tableName: "auth_agent_identity_registrations";
302
+ dataType: "string";
303
+ data: string;
304
+ driverParam: string;
305
+ notNull: false;
306
+ hasDefault: false;
307
+ isPrimaryKey: false;
308
+ isAutoincrement: false;
309
+ hasRuntimeDefault: false;
310
+ enumValues: undefined;
311
+ identity: undefined;
312
+ generated: undefined;
313
+ }>;
314
+ registration_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").SetIsPrimaryKey<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
315
+ name: string;
316
+ tableName: "auth_agent_identity_registrations";
317
+ dataType: "string";
318
+ data: string;
319
+ driverParam: string;
320
+ notNull: true;
321
+ hasDefault: false;
322
+ isPrimaryKey: false;
323
+ isAutoincrement: false;
324
+ hasRuntimeDefault: false;
325
+ enumValues: undefined;
326
+ identity: undefined;
327
+ generated: undefined;
328
+ }>;
329
+ status: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, AgentIdentityRegistrationStatus>>, {
330
+ name: string;
331
+ tableName: "auth_agent_identity_registrations";
332
+ dataType: "string";
333
+ data: AgentIdentityRegistrationStatus;
334
+ driverParam: string;
335
+ notNull: true;
336
+ hasDefault: false;
337
+ isPrimaryKey: false;
338
+ isAutoincrement: false;
339
+ hasRuntimeDefault: false;
340
+ enumValues: undefined;
341
+ identity: undefined;
342
+ generated: undefined;
343
+ }>;
344
+ updated_at_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
345
+ name: string;
346
+ tableName: "auth_agent_identity_registrations";
347
+ dataType: "number int53";
348
+ data: number;
349
+ driverParam: string | number;
350
+ notNull: true;
351
+ hasDefault: false;
352
+ isPrimaryKey: false;
353
+ isAutoincrement: false;
354
+ hasRuntimeDefault: false;
355
+ enumValues: undefined;
356
+ identity: undefined;
357
+ generated: undefined;
358
+ }>;
359
+ upstream_client_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, {
360
+ name: string;
361
+ tableName: "auth_agent_identity_registrations";
362
+ dataType: "string";
363
+ data: string;
364
+ driverParam: string;
365
+ notNull: false;
366
+ hasDefault: false;
367
+ isPrimaryKey: false;
368
+ isAutoincrement: false;
369
+ hasRuntimeDefault: false;
370
+ enumValues: undefined;
371
+ identity: undefined;
372
+ generated: undefined;
373
+ }>;
374
+ upstream_issuer: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, {
375
+ name: string;
376
+ tableName: "auth_agent_identity_registrations";
377
+ dataType: "string";
378
+ data: string;
379
+ driverParam: string;
380
+ notNull: false;
381
+ hasDefault: false;
382
+ isPrimaryKey: false;
383
+ isAutoincrement: false;
384
+ hasRuntimeDefault: false;
385
+ enumValues: undefined;
386
+ identity: undefined;
387
+ generated: undefined;
388
+ }>;
389
+ upstream_subject: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, {
390
+ name: string;
391
+ tableName: "auth_agent_identity_registrations";
392
+ dataType: "string";
393
+ data: string;
394
+ driverParam: string;
395
+ notNull: false;
396
+ hasDefault: false;
397
+ isPrimaryKey: false;
398
+ isAutoincrement: false;
399
+ hasRuntimeDefault: false;
400
+ enumValues: undefined;
401
+ identity: undefined;
402
+ generated: undefined;
403
+ }>;
404
+ user_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, {
405
+ name: string;
406
+ tableName: "auth_agent_identity_registrations";
407
+ dataType: "string";
408
+ data: string;
409
+ driverParam: string;
410
+ notNull: false;
411
+ hasDefault: false;
412
+ isPrimaryKey: false;
413
+ isAutoincrement: false;
414
+ hasRuntimeDefault: false;
415
+ enumValues: undefined;
416
+ identity: undefined;
417
+ generated: undefined;
418
+ }>;
419
+ version: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_identity_registrations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgIntegerBuilder>, {
420
+ name: string;
421
+ tableName: "auth_agent_identity_registrations";
422
+ dataType: "number int32";
423
+ data: number;
424
+ driverParam: string | number;
425
+ notNull: true;
426
+ hasDefault: false;
427
+ isPrimaryKey: false;
428
+ isAutoincrement: false;
429
+ hasRuntimeDefault: false;
430
+ enumValues: undefined;
431
+ identity: undefined;
432
+ generated: undefined;
433
+ }>;
434
+ };
435
+ dialect: "pg";
436
+ }>;
160
437
  export declare const agentRegistrationsTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
161
438
  name: "auth_agent_registrations";
162
439
  schema: undefined;
@@ -285,6 +562,8 @@ export declare const agentRegistrationsTable: import("drizzle-orm/pg-core").PgTa
285
562
  dialect: "pg";
286
563
  }>;
287
564
  export declare const createNeonAgentDelegationStore: (databaseUrl: string) => AgentDelegationStore;
565
+ export declare const createNeonAgentIdentityRegistrationStore: (databaseUrl: string) => AgentIdentityRegistrationStore;
288
566
  export declare const createNeonAgentRegistrationStore: (databaseUrl: string) => AgentRegistrationStore;
289
567
  export declare const createPostgresAgentDelegationStore: <DB extends AnyPgDatabase>(db: DB) => AgentDelegationStore;
568
+ export declare const createPostgresAgentIdentityRegistrationStore: <DB extends AnyPgDatabase>(db: DB) => AgentIdentityRegistrationStore;
290
569
  export declare const createPostgresAgentRegistrationStore: <DB extends AnyPgDatabase>(db: DB) => AgentRegistrationStore;
@@ -0,0 +1,162 @@
1
+ import type { AccessTokenStore } from '../apikeys/types';
2
+ import { type SigningKey } from '../oidc/keys';
3
+ import type { RouteString } from '../types';
4
+ import type { AgentAuthConfig, AgentRegistrationDiscoveryMetadata } from './config';
5
+ import type { AgentIdentityRegistration, AgentIdentityRegistrationKind, AgentIdentityRegistrationStore, VerifiedAgentIdentityAssertion } from './types';
6
+ export declare const AGENT_CLAIM_GRANT_TYPE: "urn:workos:agent-auth:grant-type:claim";
7
+ export declare const AGENT_IDENTITY_ASSERTION_GRANT_TYPE: "urn:ietf:params:oauth:grant-type:jwt-bearer";
8
+ export declare const AGENT_IDENTITY_ASSERTION_TYPE: "urn:ietf:params:oauth:token-type:id-jag";
9
+ export type AgentRegistrationAuthenticatedUser = {
10
+ email?: string;
11
+ userId: string;
12
+ };
13
+ export type AgentRegistrationProtocolConfig = {
14
+ accessTokenStore: AccessTokenStore;
15
+ allowAnonymous?: boolean;
16
+ allowServiceAuth?: boolean;
17
+ assertionTtlMs?: number;
18
+ attemptTtlMs?: number;
19
+ claimRoute?: RouteString;
20
+ claimTtlMs?: number;
21
+ completeRoute?: RouteString;
22
+ guideRoute?: RouteString;
23
+ identityRoute?: RouteString;
24
+ identityStore: AgentIdentityRegistrationStore;
25
+ maxAuthenticationAgeMs?: number;
26
+ maxCodeAttempts?: number;
27
+ pollIntervalSeconds?: number;
28
+ postClaimScopes: string[];
29
+ preClaimScopes?: string[];
30
+ resolveAuthenticatedUser: (request: Request) => Promise<AgentRegistrationAuthenticatedUser | undefined>;
31
+ /** Match a cryptographically verified upstream identity to local state. A
32
+ * userId permits immediate registration; omitting it requires a user claim. */
33
+ resolveVerifiedIdentity?: (identity: VerifiedAgentIdentityAssertion) => Promise<{
34
+ userId?: string;
35
+ } | undefined>;
36
+ /** Bulk-revokes access tokens for an agent. Required for anonymous
37
+ * registration and recommended for immediate cleanup on any revocation. It
38
+ * must be idempotent because atomic state updates may be retried. */
39
+ revokeAccessTokens?: (agentId: string) => Promise<void>;
40
+ signingKey: SigningKey;
41
+ tokenTtlMs?: number;
42
+ verifyIdentityAssertion?: (assertion: string) => Promise<VerifiedAgentIdentityAssertion | undefined>;
43
+ };
44
+ export type AgentRegistrationEndpoints = {
45
+ claimEndpoint: string;
46
+ completeEndpoint: string;
47
+ guide: string;
48
+ identityEndpoint: string;
49
+ tokenEndpoint: string;
50
+ };
51
+ export declare const agentRegistrationDiscoveryMetadata: (config: AgentAuthConfig) => AgentRegistrationDiscoveryMetadata;
52
+ export declare const agentRegistrationEndpoints: (config: AgentAuthConfig) => AgentRegistrationEndpoints;
53
+ /** Generates the agent-readable companion document. Endpoint URLs and support
54
+ * flags come from the same structured configuration used for discovery, so the
55
+ * prose cannot silently drift from the authorization server metadata. */
56
+ export declare const generateAgentRegistrationGuide: (config: AgentAuthConfig) => string;
57
+ declare const createFlow: ({ agentId, kind, loginHint, now, registration, status, upstream, userId, withAttempt }: {
58
+ agentId: string;
59
+ kind: AgentIdentityRegistrationKind;
60
+ loginHint?: string;
61
+ now: number;
62
+ registration: AgentRegistrationProtocolConfig;
63
+ status: AgentIdentityRegistration["status"];
64
+ upstream?: AgentIdentityRegistration["upstream"];
65
+ userId?: string;
66
+ withAttempt?: string;
67
+ }) => Promise<{
68
+ attempt: {
69
+ attempt: {
70
+ attempts: number;
71
+ email: string;
72
+ expiresAt: number;
73
+ tokenHash: string;
74
+ userCodeHash: string;
75
+ };
76
+ attemptToken: string;
77
+ expiresAt: number;
78
+ userCode: string;
79
+ } | undefined;
80
+ claimToken: string;
81
+ flow: AgentIdentityRegistration;
82
+ }>;
83
+ export declare const issueAgentServiceAssertion: (config: AgentAuthConfig, flow: AgentIdentityRegistration, now?: number) => Promise<{
84
+ assertion: string;
85
+ expiresAt: number;
86
+ }>;
87
+ declare const ceremony: (config: AgentAuthConfig, flow: AgentIdentityRegistration, attempt: NonNullable<Awaited<ReturnType<typeof createFlow>>["attempt"]>) => {
88
+ expires_in: number;
89
+ interval: number;
90
+ user_code: string;
91
+ verification_uri: string;
92
+ };
93
+ export type StartAgentRegistrationInput = {
94
+ type: 'anonymous';
95
+ } | {
96
+ loginHint: string;
97
+ type: 'service_auth';
98
+ } | {
99
+ assertion: string;
100
+ assertionType: typeof AGENT_IDENTITY_ASSERTION_TYPE;
101
+ type: 'identity_assertion';
102
+ };
103
+ export type StartAgentRegistrationResult = {
104
+ error: string;
105
+ message?: string;
106
+ status: 400 | 401 | 403;
107
+ } | {
108
+ assertionExpires: number;
109
+ claim?: ReturnType<typeof ceremony>;
110
+ claimToken?: string;
111
+ claimTokenExpires?: number;
112
+ identityAssertion?: string;
113
+ preClaimScopes?: string[];
114
+ postClaimScopes: string[];
115
+ registrationId: string;
116
+ registrationType: AgentIdentityRegistrationKind;
117
+ status: 200;
118
+ };
119
+ export declare const startAgentRegistration: (config: AgentAuthConfig, input: StartAgentRegistrationInput, now?: number) => Promise<StartAgentRegistrationResult>;
120
+ export type BeginAgentClaimResult = {
121
+ error: 'claim_expired' | 'invalid_claim_token';
122
+ status: 400;
123
+ } | {
124
+ error: 'concurrent_update';
125
+ status: 409;
126
+ } | {
127
+ claimAttempt: ReturnType<typeof ceremony>;
128
+ status: 200;
129
+ };
130
+ export declare const beginAgentClaim: (config: AgentAuthConfig, input: {
131
+ claimToken: string;
132
+ email: string;
133
+ }, now?: number) => Promise<BeginAgentClaimResult>;
134
+ export type CompleteAgentClaimResult = {
135
+ error: 'claim_expired' | 'concurrent_update' | 'invalid_claim_attempt' | 'user_code_invalid' | 'wrong_user';
136
+ status: 400 | 403 | 409 | 429;
137
+ } | {
138
+ status: 204;
139
+ };
140
+ export declare const completeAgentClaim: (config: AgentAuthConfig, input: {
141
+ attemptToken: string;
142
+ request: Request;
143
+ userCode: string;
144
+ }, now?: number) => Promise<CompleteAgentClaimResult>;
145
+ export type AgentTokenGrantResult = {
146
+ body: Record<string, unknown>;
147
+ status: 200;
148
+ } | {
149
+ body: {
150
+ error: string;
151
+ };
152
+ status: 400;
153
+ };
154
+ export declare const createAgentRegistrationCredentialVerifier: (accessTokenStore: AccessTokenStore, identityStore?: AgentIdentityRegistrationStore) => (request: Request) => Promise<{
155
+ agentId: string;
156
+ expiresAt: number;
157
+ scopes: string[];
158
+ userId: string | undefined;
159
+ } | undefined>;
160
+ export declare const handleAgentTokenGrant: (config: AgentAuthConfig, body: Record<string, string | undefined>, now?: number) => Promise<AgentTokenGrantResult | undefined>;
161
+ export declare const revokeAgentIdentityRegistration: (config: AgentAuthConfig, registrationId: string, now?: number) => Promise<boolean>;
162
+ export {};
@@ -0,0 +1,50 @@
1
+ type JsonObject = Record<string, unknown>;
2
+ export type DiscoveredAgentRegistration = {
3
+ agentAuth: {
4
+ claimEndpoint: string;
5
+ identityAssertionTypes: string[];
6
+ identityEndpoint: string;
7
+ identityTypes: string[];
8
+ skill: string;
9
+ };
10
+ authorizationServer: string;
11
+ resource: string;
12
+ resourceMetadataUrl: string;
13
+ scopes: string[];
14
+ tokenEndpoint: string;
15
+ };
16
+ export type AgentRegistrationClientOptions = {
17
+ allowInsecureLocalhost?: boolean;
18
+ maxResponseBytes?: number;
19
+ request?: typeof fetch;
20
+ };
21
+ /** Discovers agent registration using RFC 9728 followed by RFC 8414. Network
22
+ * policy is injected through `request`; redirects are rejected by default. */
23
+ export declare const createAgentRegistrationClient: (discovery: DiscoveredAgentRegistration, options?: AgentRegistrationClientOptions) => {
24
+ beginAnonymous: () => Promise<{
25
+ body: JsonObject;
26
+ response: Response;
27
+ }>;
28
+ beginServiceAuth: (loginHint: string) => Promise<{
29
+ body: JsonObject;
30
+ response: Response;
31
+ }>;
32
+ beginVerified: (assertion: string) => Promise<{
33
+ body: JsonObject;
34
+ response: Response;
35
+ }>;
36
+ claim: (claimToken: string, email: string) => Promise<{
37
+ body: JsonObject;
38
+ response: Response;
39
+ }>;
40
+ exchangeAssertion: (assertion: string) => Promise<{
41
+ body: JsonObject;
42
+ response: Response;
43
+ }>;
44
+ pollClaim: (claimToken: string) => Promise<{
45
+ body: JsonObject;
46
+ response: Response;
47
+ }>;
48
+ };
49
+ export declare const discoverAgentRegistration: (resource: string, options?: AgentRegistrationClientOptions) => Promise<DiscoveredAgentRegistration>;
50
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { Elysia } from 'elysia';
2
2
  import { type AgentAuthConfig } from './config';
3
3
  import type { AgentPrincipal } from './types';
4
+ import { agentRegistrationDiscoveryMetadata } from './registration';
4
5
  type AgentAuthFailure = {
5
6
  code: 'Forbidden' | 'Unauthorized';
6
7
  message: 'Agent is not authenticated' | 'Insufficient agent scopes';
@@ -11,6 +12,39 @@ export declare const agentAuthChallenge: ({ config, error, requiredScopes }: {
11
12
  requiredScopes?: string[];
12
13
  }) => string;
13
14
  export declare const agentResourceMetadataUrl: (config: AgentAuthConfig) => string;
15
+ export { agentRegistrationDiscoveryMetadata };
16
+ export declare const agentAuthContextPlugin: (config?: AgentAuthConfig) => Elysia<"", {
17
+ decorator: {};
18
+ store: {};
19
+ derive: {};
20
+ resolve: {};
21
+ }, {
22
+ typebox: {};
23
+ error: {};
24
+ }, {
25
+ schema: {};
26
+ standaloneSchema: {};
27
+ macro: {};
28
+ macroFn: {};
29
+ parser: {};
30
+ response: {};
31
+ }, {}, {
32
+ derive: {};
33
+ resolve: {};
34
+ schema: {};
35
+ standaloneSchema: {};
36
+ response: {};
37
+ }, {
38
+ derive: {
39
+ readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AgentAuthFailure) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
40
+ };
41
+ resolve: {};
42
+ schema: {};
43
+ standaloneSchema: {};
44
+ response: import("elysia").ExtractErrorFromHandle<{
45
+ readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AgentAuthFailure) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
46
+ }>;
47
+ }>;
14
48
  export declare const agentAuthPlugin: (config?: AgentAuthConfig) => Elysia<"", {
15
49
  decorator: {};
16
50
  store: {};
@@ -92,5 +126,114 @@ export declare const agentAuthPlugin: (config?: AgentAuthConfig) => Elysia<"", {
92
126
  schema: {};
93
127
  standaloneSchema: {};
94
128
  response: {};
129
+ }> | Elysia<"", {
130
+ decorator: {};
131
+ store: {};
132
+ derive: {
133
+ readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AgentAuthFailure) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
134
+ };
135
+ resolve: {};
136
+ }, {
137
+ typebox: {};
138
+ error: {};
139
+ }, {
140
+ schema: {};
141
+ standaloneSchema: {};
142
+ macro: {};
143
+ macroFn: {};
144
+ parser: {};
145
+ response: import("elysia").ExtractErrorFromHandle<{
146
+ readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AgentAuthFailure) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
147
+ }>;
148
+ }, {
149
+ [x: string]: {
150
+ get: {
151
+ body: unknown;
152
+ params: {};
153
+ query: unknown;
154
+ headers: unknown;
155
+ response: {
156
+ 200: {
157
+ resource: string;
158
+ scopes_supported: string[];
159
+ resource_name?: string | undefined;
160
+ resource_logo_uri?: string | undefined;
161
+ authorization_servers: string[];
162
+ bearer_methods_supported: string[];
163
+ };
164
+ };
165
+ };
166
+ };
167
+ } & {
168
+ [x: string]: {
169
+ get: {
170
+ body: unknown;
171
+ params: {};
172
+ query: unknown;
173
+ headers: unknown;
174
+ response: {
175
+ 200: Response;
176
+ };
177
+ };
178
+ };
179
+ } & {
180
+ [x: string]: {
181
+ get: {
182
+ body: unknown;
183
+ params: {};
184
+ query: unknown;
185
+ headers: unknown;
186
+ response: {
187
+ 200: Response;
188
+ };
189
+ };
190
+ };
191
+ } & {
192
+ [x: string]: {
193
+ post: {
194
+ body: unknown;
195
+ params: {};
196
+ query: unknown;
197
+ headers: unknown;
198
+ response: {
199
+ 200: Response;
200
+ };
201
+ };
202
+ };
203
+ } & {
204
+ [x: string]: {
205
+ post: {
206
+ body: unknown;
207
+ params: {};
208
+ query: unknown;
209
+ headers: unknown;
210
+ response: {
211
+ 200: Response;
212
+ };
213
+ };
214
+ };
215
+ } & {
216
+ [x: string]: {
217
+ post: {
218
+ body: unknown;
219
+ params: {};
220
+ query: unknown;
221
+ headers: unknown;
222
+ response: {
223
+ 200: Response;
224
+ };
225
+ };
226
+ };
227
+ }, {
228
+ derive: {};
229
+ resolve: {};
230
+ schema: {};
231
+ standaloneSchema: {};
232
+ response: {};
233
+ }, {
234
+ derive: {};
235
+ resolve: {};
236
+ schema: {};
237
+ standaloneSchema: {};
238
+ response: {};
95
239
  }>;
96
- export {};