@absolutejs/auth 0.54.5 → 0.54.6
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.
- package/README.md +58 -0
- package/dist/agents/config.d.ts +28 -0
- package/dist/agents/inMemoryStores.d.ts +3 -0
- package/dist/agents/index.d.ts +7 -0
- package/dist/agents/index.js +11299 -0
- package/dist/agents/index.js.map +113 -0
- package/dist/agents/oidcAdapter.d.ts +9 -0
- package/dist/agents/postgresStores.d.ts +290 -0
- package/dist/agents/principal.d.ts +4 -0
- package/dist/agents/routes.d.ts +96 -0
- package/dist/agents/types.d.ts +70 -0
- package/dist/audit/types.d.ts +1 -1
- package/dist/cli/migrate.js +368 -333
- package/dist/cli/migrate.js.map +5 -4
- package/dist/index.d.ts +152 -2
- package/dist/index.js +650 -205
- package/dist/index.js.map +14 -8
- package/dist/migrations/index.d.ts +1 -1
- package/dist/oidc/config.d.ts +9 -1
- package/dist/oidc/registration.d.ts +8 -1
- package/dist/oidc/routes.d.ts +4 -2
- package/dist/oidc/types.d.ts +3 -0
- package/dist/types.d.ts +5 -0
- package/package.json +10 -2
|
@@ -0,0 +1,9 @@
|
|
|
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, publicJwk, resource }: {
|
|
6
|
+
issuer: string;
|
|
7
|
+
publicJwk: JsonWebKey;
|
|
8
|
+
resource: string;
|
|
9
|
+
}) => AgentCredentialVerifier;
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { type AnyPgDatabase } from '../stores/postgres';
|
|
2
|
+
import type { AgentDelegationStatus, AgentDelegationStore, AgentRegistrationStatus, AgentRegistrationStore } from './types';
|
|
3
|
+
export declare const agentDelegationsTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
4
|
+
name: "auth_agent_delegations";
|
|
5
|
+
schema: undefined;
|
|
6
|
+
columns: {
|
|
7
|
+
agent_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_delegations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
|
|
8
|
+
name: string;
|
|
9
|
+
tableName: "auth_agent_delegations";
|
|
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
|
+
authorization_details: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_delegations", import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgJsonbBuilder, Record<string, unknown>[]>, {
|
|
23
|
+
name: string;
|
|
24
|
+
tableName: "auth_agent_delegations";
|
|
25
|
+
dataType: "object json";
|
|
26
|
+
data: Record<string, unknown>[];
|
|
27
|
+
driverParam: unknown;
|
|
28
|
+
notNull: false;
|
|
29
|
+
hasDefault: false;
|
|
30
|
+
isPrimaryKey: false;
|
|
31
|
+
isAutoincrement: false;
|
|
32
|
+
hasRuntimeDefault: false;
|
|
33
|
+
enumValues: undefined;
|
|
34
|
+
identity: undefined;
|
|
35
|
+
generated: undefined;
|
|
36
|
+
}>;
|
|
37
|
+
created_at_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_delegations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
|
|
38
|
+
name: string;
|
|
39
|
+
tableName: "auth_agent_delegations";
|
|
40
|
+
dataType: "number int53";
|
|
41
|
+
data: number;
|
|
42
|
+
driverParam: string | number;
|
|
43
|
+
notNull: true;
|
|
44
|
+
hasDefault: false;
|
|
45
|
+
isPrimaryKey: false;
|
|
46
|
+
isAutoincrement: false;
|
|
47
|
+
hasRuntimeDefault: false;
|
|
48
|
+
enumValues: undefined;
|
|
49
|
+
identity: undefined;
|
|
50
|
+
generated: undefined;
|
|
51
|
+
}>;
|
|
52
|
+
delegation_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_delegations", import("drizzle-orm/pg-core").SetIsPrimaryKey<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
|
|
53
|
+
name: string;
|
|
54
|
+
tableName: "auth_agent_delegations";
|
|
55
|
+
dataType: "string";
|
|
56
|
+
data: string;
|
|
57
|
+
driverParam: string;
|
|
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
|
+
expires_at_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_delegations", import("drizzle-orm/pg-core").PgBigInt53Builder, {
|
|
68
|
+
name: string;
|
|
69
|
+
tableName: "auth_agent_delegations";
|
|
70
|
+
dataType: "number int53";
|
|
71
|
+
data: number;
|
|
72
|
+
driverParam: string | number;
|
|
73
|
+
notNull: false;
|
|
74
|
+
hasDefault: false;
|
|
75
|
+
isPrimaryKey: false;
|
|
76
|
+
isAutoincrement: false;
|
|
77
|
+
hasRuntimeDefault: false;
|
|
78
|
+
enumValues: undefined;
|
|
79
|
+
identity: undefined;
|
|
80
|
+
generated: undefined;
|
|
81
|
+
}>;
|
|
82
|
+
organization_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_delegations", import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, {
|
|
83
|
+
name: string;
|
|
84
|
+
tableName: "auth_agent_delegations";
|
|
85
|
+
dataType: "string";
|
|
86
|
+
data: string;
|
|
87
|
+
driverParam: string;
|
|
88
|
+
notNull: false;
|
|
89
|
+
hasDefault: false;
|
|
90
|
+
isPrimaryKey: false;
|
|
91
|
+
isAutoincrement: false;
|
|
92
|
+
hasRuntimeDefault: false;
|
|
93
|
+
enumValues: undefined;
|
|
94
|
+
identity: undefined;
|
|
95
|
+
generated: undefined;
|
|
96
|
+
}>;
|
|
97
|
+
scopes: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_delegations", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgJsonbBuilder, string[]>>>, {
|
|
98
|
+
name: string;
|
|
99
|
+
tableName: "auth_agent_delegations";
|
|
100
|
+
dataType: "object json";
|
|
101
|
+
data: string[];
|
|
102
|
+
driverParam: unknown;
|
|
103
|
+
notNull: true;
|
|
104
|
+
hasDefault: true;
|
|
105
|
+
isPrimaryKey: false;
|
|
106
|
+
isAutoincrement: false;
|
|
107
|
+
hasRuntimeDefault: false;
|
|
108
|
+
enumValues: undefined;
|
|
109
|
+
identity: undefined;
|
|
110
|
+
generated: undefined;
|
|
111
|
+
}>;
|
|
112
|
+
status: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_delegations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, AgentDelegationStatus>>, {
|
|
113
|
+
name: string;
|
|
114
|
+
tableName: "auth_agent_delegations";
|
|
115
|
+
dataType: "string";
|
|
116
|
+
data: AgentDelegationStatus;
|
|
117
|
+
driverParam: string;
|
|
118
|
+
notNull: true;
|
|
119
|
+
hasDefault: false;
|
|
120
|
+
isPrimaryKey: false;
|
|
121
|
+
isAutoincrement: false;
|
|
122
|
+
hasRuntimeDefault: false;
|
|
123
|
+
enumValues: undefined;
|
|
124
|
+
identity: undefined;
|
|
125
|
+
generated: undefined;
|
|
126
|
+
}>;
|
|
127
|
+
updated_at_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_delegations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
|
|
128
|
+
name: string;
|
|
129
|
+
tableName: "auth_agent_delegations";
|
|
130
|
+
dataType: "number int53";
|
|
131
|
+
data: number;
|
|
132
|
+
driverParam: string | number;
|
|
133
|
+
notNull: true;
|
|
134
|
+
hasDefault: false;
|
|
135
|
+
isPrimaryKey: false;
|
|
136
|
+
isAutoincrement: false;
|
|
137
|
+
hasRuntimeDefault: false;
|
|
138
|
+
enumValues: undefined;
|
|
139
|
+
identity: undefined;
|
|
140
|
+
generated: undefined;
|
|
141
|
+
}>;
|
|
142
|
+
user_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_delegations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
|
|
143
|
+
name: string;
|
|
144
|
+
tableName: "auth_agent_delegations";
|
|
145
|
+
dataType: "string";
|
|
146
|
+
data: string;
|
|
147
|
+
driverParam: string;
|
|
148
|
+
notNull: true;
|
|
149
|
+
hasDefault: false;
|
|
150
|
+
isPrimaryKey: false;
|
|
151
|
+
isAutoincrement: false;
|
|
152
|
+
hasRuntimeDefault: false;
|
|
153
|
+
enumValues: undefined;
|
|
154
|
+
identity: undefined;
|
|
155
|
+
generated: undefined;
|
|
156
|
+
}>;
|
|
157
|
+
};
|
|
158
|
+
dialect: "pg";
|
|
159
|
+
}>;
|
|
160
|
+
export declare const agentRegistrationsTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
161
|
+
name: "auth_agent_registrations";
|
|
162
|
+
schema: undefined;
|
|
163
|
+
columns: {
|
|
164
|
+
agent_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_registrations", import("drizzle-orm/pg-core").SetIsPrimaryKey<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
|
|
165
|
+
name: string;
|
|
166
|
+
tableName: "auth_agent_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
|
+
allowed_scopes: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_registrations", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgJsonbBuilder, string[]>>>, {
|
|
180
|
+
name: string;
|
|
181
|
+
tableName: "auth_agent_registrations";
|
|
182
|
+
dataType: "object json";
|
|
183
|
+
data: string[];
|
|
184
|
+
driverParam: unknown;
|
|
185
|
+
notNull: true;
|
|
186
|
+
hasDefault: true;
|
|
187
|
+
isPrimaryKey: false;
|
|
188
|
+
isAutoincrement: false;
|
|
189
|
+
hasRuntimeDefault: false;
|
|
190
|
+
enumValues: undefined;
|
|
191
|
+
identity: undefined;
|
|
192
|
+
generated: undefined;
|
|
193
|
+
}>;
|
|
194
|
+
client_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_registrations", import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, {
|
|
195
|
+
name: string;
|
|
196
|
+
tableName: "auth_agent_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
|
+
created_at_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_registrations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
|
|
210
|
+
name: string;
|
|
211
|
+
tableName: "auth_agent_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
|
+
metadata: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_registrations", import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgJsonbBuilder, Record<string, unknown>>, {
|
|
225
|
+
name: string;
|
|
226
|
+
tableName: "auth_agent_registrations";
|
|
227
|
+
dataType: "object json";
|
|
228
|
+
data: Record<string, unknown>;
|
|
229
|
+
driverParam: unknown;
|
|
230
|
+
notNull: false;
|
|
231
|
+
hasDefault: false;
|
|
232
|
+
isPrimaryKey: false;
|
|
233
|
+
isAutoincrement: false;
|
|
234
|
+
hasRuntimeDefault: false;
|
|
235
|
+
enumValues: undefined;
|
|
236
|
+
identity: undefined;
|
|
237
|
+
generated: undefined;
|
|
238
|
+
}>;
|
|
239
|
+
name: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_registrations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
|
|
240
|
+
name: string;
|
|
241
|
+
tableName: "auth_agent_registrations";
|
|
242
|
+
dataType: "string";
|
|
243
|
+
data: string;
|
|
244
|
+
driverParam: string;
|
|
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
|
+
status: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_registrations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, AgentRegistrationStatus>>, {
|
|
255
|
+
name: string;
|
|
256
|
+
tableName: "auth_agent_registrations";
|
|
257
|
+
dataType: "string";
|
|
258
|
+
data: AgentRegistrationStatus;
|
|
259
|
+
driverParam: string;
|
|
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
|
+
updated_at_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_agent_registrations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
|
|
270
|
+
name: string;
|
|
271
|
+
tableName: "auth_agent_registrations";
|
|
272
|
+
dataType: "number int53";
|
|
273
|
+
data: number;
|
|
274
|
+
driverParam: string | number;
|
|
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
|
+
};
|
|
285
|
+
dialect: "pg";
|
|
286
|
+
}>;
|
|
287
|
+
export declare const createNeonAgentDelegationStore: (databaseUrl: string) => AgentDelegationStore;
|
|
288
|
+
export declare const createNeonAgentRegistrationStore: (databaseUrl: string) => AgentRegistrationStore;
|
|
289
|
+
export declare const createPostgresAgentDelegationStore: <DB extends AnyPgDatabase>(db: DB) => AgentDelegationStore;
|
|
290
|
+
export declare const createPostgresAgentRegistrationStore: <DB extends AnyPgDatabase>(db: DB) => AgentRegistrationStore;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AgentAuthConfig } from './config';
|
|
2
|
+
import type { AgentPrincipal } from './types';
|
|
3
|
+
export declare const agentHasScopes: (principal: AgentPrincipal | undefined, requiredScopes: string[]) => boolean;
|
|
4
|
+
export declare const resolveAgentPrincipal: (request: Request, config: AgentAuthConfig) => Promise<AgentPrincipal | undefined>;
|
|
@@ -0,0 +1,96 @@
|
|
|
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 agentAuthPlugin: (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
|
+
}> | Elysia<"", {
|
|
46
|
+
decorator: {};
|
|
47
|
+
store: {};
|
|
48
|
+
derive: {
|
|
49
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AgentAuthFailure) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
|
|
50
|
+
};
|
|
51
|
+
resolve: {};
|
|
52
|
+
}, {
|
|
53
|
+
typebox: {};
|
|
54
|
+
error: {};
|
|
55
|
+
}, {
|
|
56
|
+
schema: {};
|
|
57
|
+
standaloneSchema: {};
|
|
58
|
+
macro: {};
|
|
59
|
+
macroFn: {};
|
|
60
|
+
parser: {};
|
|
61
|
+
response: import("elysia").ExtractErrorFromHandle<{
|
|
62
|
+
readonly protectAgent: <AuthReturn, AuthFailReturn>(requiredScopes: string[], handleAuth: (principal: AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AgentAuthFailure) => AuthFailReturn | Promise<AuthFailReturn>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn>>>;
|
|
63
|
+
}>;
|
|
64
|
+
}, {
|
|
65
|
+
[x: string]: {
|
|
66
|
+
get: {
|
|
67
|
+
body: unknown;
|
|
68
|
+
params: {};
|
|
69
|
+
query: unknown;
|
|
70
|
+
headers: unknown;
|
|
71
|
+
response: {
|
|
72
|
+
200: {
|
|
73
|
+
resource: string;
|
|
74
|
+
scopes_supported: string[];
|
|
75
|
+
resource_name?: string | undefined;
|
|
76
|
+
resource_logo_uri?: string | undefined;
|
|
77
|
+
authorization_servers: string[];
|
|
78
|
+
bearer_methods_supported: string[];
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
}, {
|
|
84
|
+
derive: {};
|
|
85
|
+
resolve: {};
|
|
86
|
+
schema: {};
|
|
87
|
+
standaloneSchema: {};
|
|
88
|
+
response: {};
|
|
89
|
+
}, {
|
|
90
|
+
derive: {};
|
|
91
|
+
resolve: {};
|
|
92
|
+
schema: {};
|
|
93
|
+
standaloneSchema: {};
|
|
94
|
+
response: {};
|
|
95
|
+
}>;
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export type AgentRegistrationStatus = 'active' | 'revoked';
|
|
2
|
+
export type AgentDelegationStatus = 'active' | 'revoked';
|
|
3
|
+
/** A durable identity for an agent client. This is deliberately protocol-neutral:
|
|
4
|
+
* `clientId` can refer to an OAuth client, while adapters for other protocols can
|
|
5
|
+
* use `agentId` without manufacturing OAuth metadata. */
|
|
6
|
+
export type AgentRegistration = {
|
|
7
|
+
agentId: string;
|
|
8
|
+
allowedScopes: string[];
|
|
9
|
+
clientId?: string;
|
|
10
|
+
createdAt: number;
|
|
11
|
+
metadata?: Record<string, unknown>;
|
|
12
|
+
name: string;
|
|
13
|
+
status: AgentRegistrationStatus;
|
|
14
|
+
updatedAt: number;
|
|
15
|
+
};
|
|
16
|
+
export type AgentRegistrationStore = {
|
|
17
|
+
findByAgentId: (agentId: string) => Promise<AgentRegistration | undefined>;
|
|
18
|
+
findByClientId: (clientId: string) => Promise<AgentRegistration | undefined>;
|
|
19
|
+
listRegistrations: () => Promise<AgentRegistration[]>;
|
|
20
|
+
saveRegistration: (registration: AgentRegistration) => Promise<void>;
|
|
21
|
+
};
|
|
22
|
+
/** A user's explicit grant to an agent. Authorization details use RFC 9396's
|
|
23
|
+
* open object shape so applications can express transaction constraints without
|
|
24
|
+
* forcing them into coarse OAuth scope strings. */
|
|
25
|
+
export type AgentDelegation = {
|
|
26
|
+
agentId: string;
|
|
27
|
+
authorizationDetails?: Record<string, unknown>[];
|
|
28
|
+
createdAt: number;
|
|
29
|
+
delegationId: string;
|
|
30
|
+
expiresAt?: number;
|
|
31
|
+
organizationId?: string;
|
|
32
|
+
scopes: string[];
|
|
33
|
+
status: AgentDelegationStatus;
|
|
34
|
+
updatedAt: number;
|
|
35
|
+
userId: string;
|
|
36
|
+
};
|
|
37
|
+
export type AgentDelegationStore = {
|
|
38
|
+
findActiveDelegation: (query: {
|
|
39
|
+
agentId: string;
|
|
40
|
+
now?: number;
|
|
41
|
+
organizationId?: string;
|
|
42
|
+
userId: string;
|
|
43
|
+
}) => Promise<AgentDelegation | undefined>;
|
|
44
|
+
findByDelegationId: (delegationId: string) => Promise<AgentDelegation | undefined>;
|
|
45
|
+
listDelegations: (agentId?: string) => Promise<AgentDelegation[]>;
|
|
46
|
+
saveDelegation: (delegation: AgentDelegation) => Promise<void>;
|
|
47
|
+
};
|
|
48
|
+
/** The normalized result produced by a wire-protocol adapter. The core never
|
|
49
|
+
* handles raw provider assertions; it authorizes only this verified shape. */
|
|
50
|
+
export type VerifiedAgentCredential = {
|
|
51
|
+
agentId: string;
|
|
52
|
+
claims?: Record<string, unknown>;
|
|
53
|
+
expiresAt?: number;
|
|
54
|
+
organizationId?: string;
|
|
55
|
+
resource?: string;
|
|
56
|
+
scopes: string[];
|
|
57
|
+
userId?: string;
|
|
58
|
+
};
|
|
59
|
+
export type AgentCredentialVerifier = (request: Request) => Promise<VerifiedAgentCredential | undefined>;
|
|
60
|
+
export type AgentPrincipal = {
|
|
61
|
+
agentId: string;
|
|
62
|
+
authorizationDetails?: Record<string, unknown>[];
|
|
63
|
+
delegationId?: string;
|
|
64
|
+
kind: 'agent';
|
|
65
|
+
name: string;
|
|
66
|
+
organizationId?: string;
|
|
67
|
+
scopes: string[];
|
|
68
|
+
trust: 'delegated' | 'registered';
|
|
69
|
+
userId?: string;
|
|
70
|
+
};
|
package/dist/audit/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OrganizationId } from '../tenancy';
|
|
2
|
-
export type AuditEventType = 'account_deleted' | 'authorization_denied' | 'credentials_login' | 'credentials_login_failed' | 'data_exported' | 'email_verified' | 'identity_conflict' | 'impersonation_ended' | 'impersonation_started' | 'invitation_accepted' | 'invitation_created' | 'logout' | 'membership_removed' | 'mfa_challenge' | 'mfa_challenge_failed' | 'mfa_enrolled' | 'oauth_login' | 'organization_created' | 'password_reset' | 'passwordless_login' | 'register' | 'role_assigned' | 'scim_provision' | 'scim_token_created' | 'session_revoked' | 'setup_session_created' | 'sso_connection_configured' | 'sso_login' | 'token_refreshed' | 'token_revoked' | 'webauthn_authenticated' | 'webauthn_registered';
|
|
2
|
+
export type AuditEventType = 'account_deleted' | 'agent_credential_issued' | 'agent_delegated' | 'agent_registered' | 'agent_revoked' | 'authorization_denied' | 'credentials_login' | 'credentials_login_failed' | 'data_exported' | 'email_verified' | 'identity_conflict' | 'impersonation_ended' | 'impersonation_started' | 'invitation_accepted' | 'invitation_created' | 'logout' | 'membership_removed' | 'mfa_challenge' | 'mfa_challenge_failed' | 'mfa_enrolled' | 'oauth_login' | 'organization_created' | 'password_reset' | 'passwordless_login' | 'register' | 'role_assigned' | 'scim_provision' | 'scim_token_created' | 'session_revoked' | 'setup_session_created' | 'sso_connection_configured' | 'sso_login' | 'token_refreshed' | 'token_revoked' | 'webauthn_authenticated' | 'webauthn_registered';
|
|
3
3
|
export type AuditEvent = {
|
|
4
4
|
at: number;
|
|
5
5
|
ip?: string;
|