@voltro/protocol 0.83.1 → 0.85.0
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/CHANGELOG.md +1191 -0
- package/THIRD-PARTY-NOTICES.md +1 -57
- package/dist/apikey.d.ts +32 -34
- package/dist/index.d.ts +1276 -1349
- package/dist/index.js +1022 -733
- package/dist/inspect.d.ts +88 -88
- package/dist/inspect.js +103 -53
- package/dist/jwt.d.ts +32 -34
- package/dist/rest.d.ts +72 -57
- package/dist/rest.js +287 -208
- package/dist/{restFormat-EZ8k9ZcQ.js → restFormat-BlgTLxm1.js} +108 -114
- package/dist/{scopes-Di756ENh.js → scopes-ClywBij8.js} +167 -137
- package/dist/session.d.ts +90 -96
- package/dist/session.js +1 -1
- package/package.json +4 -8
package/dist/session.d.ts
CHANGED
|
@@ -170,53 +170,51 @@ export declare type SessionPayload = typeof SessionPayload_2.Type;
|
|
|
170
170
|
|
|
171
171
|
declare const SessionPayload_2: Schema.Struct<{
|
|
172
172
|
/** Payload format version. Required and pinned — see the header. */
|
|
173
|
-
v: Schema.Literal<
|
|
173
|
+
readonly v: Schema.Literal<2>;
|
|
174
174
|
/** WHO, never WHAT-THEY-MAY-DO. `SubjectIdentity` has no `scopes` field. */
|
|
175
|
-
subject: Schema.Union<[Schema.Struct<{
|
|
176
|
-
type: Schema.Literal<
|
|
177
|
-
id:
|
|
178
|
-
tenantId:
|
|
179
|
-
metadata: Schema.optional<Schema
|
|
175
|
+
readonly subject: Schema.Union<readonly [Schema.Struct<{
|
|
176
|
+
readonly type: Schema.Literal<"user">;
|
|
177
|
+
readonly id: Schema.String;
|
|
178
|
+
readonly tenantId: Schema.String;
|
|
179
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
180
180
|
}>, Schema.Struct<{
|
|
181
|
-
type: Schema.Literal<
|
|
182
|
-
id:
|
|
183
|
-
tenantId:
|
|
184
|
-
metadata: Schema.optional<Schema
|
|
181
|
+
readonly type: Schema.Literal<"apiKey">;
|
|
182
|
+
readonly id: Schema.String;
|
|
183
|
+
readonly tenantId: Schema.String;
|
|
184
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
185
185
|
}>, Schema.Struct<{
|
|
186
|
-
type: Schema.Literal<
|
|
187
|
-
id:
|
|
188
|
-
tenantId:
|
|
189
|
-
metadata: Schema.optional<Schema
|
|
190
|
-
auditActorId: Schema.
|
|
191
|
-
exact: true;
|
|
192
|
-
}>;
|
|
186
|
+
readonly type: Schema.Literal<"serviceAccount">;
|
|
187
|
+
readonly id: Schema.String;
|
|
188
|
+
readonly tenantId: Schema.String;
|
|
189
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
190
|
+
readonly auditActorId: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
193
191
|
}>, Schema.Struct<{
|
|
194
|
-
type: Schema.Literal<
|
|
195
|
-
id:
|
|
196
|
-
tenantId: Schema.NullOr<
|
|
197
|
-
credentialRejected: Schema.optional<
|
|
192
|
+
readonly type: Schema.Literal<"anonymous">;
|
|
193
|
+
readonly id: Schema.Null;
|
|
194
|
+
readonly tenantId: Schema.NullOr<Schema.String>;
|
|
195
|
+
readonly credentialRejected: Schema.optional<Schema.String>;
|
|
198
196
|
}>, Schema.Struct<{
|
|
199
|
-
type: Schema.Literal<
|
|
200
|
-
id:
|
|
201
|
-
tenantId:
|
|
202
|
-
metadata: Schema.optional<Schema
|
|
197
|
+
readonly type: Schema.Literal<"system">;
|
|
198
|
+
readonly id: Schema.String;
|
|
199
|
+
readonly tenantId: Schema.Null;
|
|
200
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
203
201
|
}>, Schema.Struct<{
|
|
204
|
-
type: Schema.Literal<
|
|
205
|
-
id:
|
|
206
|
-
tenantId:
|
|
207
|
-
metadata: Schema.optional<Schema
|
|
208
|
-
service:
|
|
202
|
+
readonly type: Schema.Literal<"service">;
|
|
203
|
+
readonly id: Schema.String;
|
|
204
|
+
readonly tenantId: Schema.Null;
|
|
205
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
206
|
+
readonly service: Schema.String;
|
|
209
207
|
}>]>;
|
|
210
208
|
/** Unix seconds when this session expires. Verify rejects past expiry. */
|
|
211
|
-
exp:
|
|
209
|
+
readonly exp: Schema.Number;
|
|
212
210
|
/** Unix seconds when this session was issued. Drives sliding-window
|
|
213
211
|
* auto-renewal: verify signals a renew once `now - iat` passes the
|
|
214
212
|
* renewal threshold (default 70% of the session's lifetime). */
|
|
215
|
-
iat:
|
|
213
|
+
readonly iat: Schema.Number;
|
|
216
214
|
/** Key id of the signing secret. Stamped from the current key on sign;
|
|
217
215
|
* read on verify to pick which secret to check first. Absent on
|
|
218
216
|
* values minted with a bare-string secret (single-key path). */
|
|
219
|
-
kid: Schema.optional<
|
|
217
|
+
readonly kid: Schema.optional<Schema.String>;
|
|
220
218
|
}>;
|
|
221
219
|
|
|
222
220
|
declare type SessionPayload = typeof SessionPayload_2.Type;
|
|
@@ -278,33 +276,31 @@ export declare interface SignOptions {
|
|
|
278
276
|
*/
|
|
279
277
|
export declare const signSession: (subject: Subject | SubjectIdentity, secret: string | KeyedSecret, options?: SignOptions) => string;
|
|
280
278
|
|
|
281
|
-
declare const Subject: Schema.Union<[Schema.Struct<{
|
|
282
|
-
type: Schema.Literal<
|
|
283
|
-
id:
|
|
284
|
-
tenantId:
|
|
285
|
-
scopes: Schema.optional<Schema
|
|
286
|
-
metadata: Schema.optional<Schema
|
|
279
|
+
declare const Subject: Schema.Union<readonly [Schema.Struct<{
|
|
280
|
+
readonly type: Schema.Literal<"user">;
|
|
281
|
+
readonly id: Schema.String;
|
|
282
|
+
readonly tenantId: Schema.String;
|
|
283
|
+
readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
|
|
284
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
287
285
|
}>, Schema.Struct<{
|
|
288
|
-
type: Schema.Literal<
|
|
289
|
-
id:
|
|
290
|
-
tenantId:
|
|
291
|
-
scopes: Schema.optional<Schema
|
|
292
|
-
metadata: Schema.optional<Schema
|
|
286
|
+
readonly type: Schema.Literal<"apiKey">;
|
|
287
|
+
readonly id: Schema.String;
|
|
288
|
+
readonly tenantId: Schema.String;
|
|
289
|
+
readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
|
|
290
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
293
291
|
}>, Schema.Struct<{
|
|
294
|
-
type: Schema.Literal<
|
|
295
|
-
id:
|
|
296
|
-
tenantId:
|
|
292
|
+
readonly type: Schema.Literal<"serviceAccount">;
|
|
293
|
+
readonly id: Schema.String;
|
|
294
|
+
readonly tenantId: Schema.String;
|
|
297
295
|
/** Application actor used for audit columns; null means machine work with
|
|
298
296
|
* no application actor. Identity only, never a permission grant. */
|
|
299
|
-
auditActorId: Schema.
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
scopes: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
303
|
-
metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
297
|
+
readonly auditActorId: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
298
|
+
readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
|
|
299
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
304
300
|
}>, Schema.Struct<{
|
|
305
|
-
type: Schema.Literal<
|
|
306
|
-
id:
|
|
307
|
-
tenantId: Schema.NullOr<
|
|
301
|
+
readonly type: Schema.Literal<"anonymous">;
|
|
302
|
+
readonly id: Schema.Null;
|
|
303
|
+
readonly tenantId: Schema.NullOr<Schema.String>;
|
|
308
304
|
/**
|
|
309
305
|
* Set when this caller PRESENTED a credential and it was rejected — an
|
|
310
306
|
* expired token above all. Absent when they presented none.
|
|
@@ -321,47 +317,45 @@ declare const Subject: Schema.Union<[Schema.Struct<{
|
|
|
321
317
|
* must not break an `openAccess` procedure that needs no session at all. The
|
|
322
318
|
* fact travels, and only a guard that actually refuses spends it.
|
|
323
319
|
*/
|
|
324
|
-
credentialRejected: Schema.optional<
|
|
320
|
+
readonly credentialRejected: Schema.optional<Schema.String>;
|
|
325
321
|
}>, Schema.Struct<{
|
|
326
|
-
type: Schema.Literal<
|
|
327
|
-
id:
|
|
328
|
-
tenantId:
|
|
329
|
-
scopes: Schema.optional<Schema
|
|
330
|
-
metadata: Schema.optional<Schema
|
|
322
|
+
readonly type: Schema.Literal<"system">;
|
|
323
|
+
readonly id: Schema.String;
|
|
324
|
+
readonly tenantId: Schema.Null;
|
|
325
|
+
readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
|
|
326
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
331
327
|
}>, Schema.Struct<{
|
|
332
|
-
type: Schema.Literal<
|
|
333
|
-
id:
|
|
328
|
+
readonly type: Schema.Literal<"service">;
|
|
329
|
+
readonly id: Schema.String;
|
|
334
330
|
/** The calling app's name, as the callee lists it in `serviceCallers`. */
|
|
335
|
-
service:
|
|
336
|
-
tenantId:
|
|
337
|
-
scopes: Schema.optional<Schema
|
|
338
|
-
metadata: Schema.optional<Schema
|
|
331
|
+
readonly service: Schema.String;
|
|
332
|
+
readonly tenantId: Schema.Null;
|
|
333
|
+
readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
|
|
334
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
339
335
|
}>]>;
|
|
340
336
|
|
|
341
337
|
declare type Subject = typeof Subject.Type;
|
|
342
338
|
|
|
343
|
-
declare const SubjectIdentity: Schema.Union<[Schema.Struct<{
|
|
344
|
-
type: Schema.Literal<
|
|
345
|
-
id:
|
|
346
|
-
tenantId:
|
|
347
|
-
metadata: Schema.optional<Schema
|
|
339
|
+
declare const SubjectIdentity: Schema.Union<readonly [Schema.Struct<{
|
|
340
|
+
readonly type: Schema.Literal<"user">;
|
|
341
|
+
readonly id: Schema.String;
|
|
342
|
+
readonly tenantId: Schema.String;
|
|
343
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
348
344
|
}>, Schema.Struct<{
|
|
349
|
-
type: Schema.Literal<
|
|
350
|
-
id:
|
|
351
|
-
tenantId:
|
|
352
|
-
metadata: Schema.optional<Schema
|
|
345
|
+
readonly type: Schema.Literal<"apiKey">;
|
|
346
|
+
readonly id: Schema.String;
|
|
347
|
+
readonly tenantId: Schema.String;
|
|
348
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
353
349
|
}>, Schema.Struct<{
|
|
354
|
-
type: Schema.Literal<
|
|
355
|
-
id:
|
|
356
|
-
tenantId:
|
|
357
|
-
metadata: Schema.optional<Schema
|
|
358
|
-
auditActorId: Schema.
|
|
359
|
-
exact: true;
|
|
360
|
-
}>;
|
|
350
|
+
readonly type: Schema.Literal<"serviceAccount">;
|
|
351
|
+
readonly id: Schema.String;
|
|
352
|
+
readonly tenantId: Schema.String;
|
|
353
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
354
|
+
readonly auditActorId: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
361
355
|
}>, Schema.Struct<{
|
|
362
|
-
type: Schema.Literal<
|
|
363
|
-
id:
|
|
364
|
-
tenantId: Schema.NullOr<
|
|
356
|
+
readonly type: Schema.Literal<"anonymous">;
|
|
357
|
+
readonly id: Schema.Null;
|
|
358
|
+
readonly tenantId: Schema.NullOr<Schema.String>;
|
|
365
359
|
/**
|
|
366
360
|
* Set when this caller PRESENTED a credential and it was rejected — an
|
|
367
361
|
* expired token above all. Absent when they presented none.
|
|
@@ -378,18 +372,18 @@ declare const SubjectIdentity: Schema.Union<[Schema.Struct<{
|
|
|
378
372
|
* must not break an `openAccess` procedure that needs no session at all. The
|
|
379
373
|
* fact travels, and only a guard that actually refuses spends it.
|
|
380
374
|
*/
|
|
381
|
-
credentialRejected: Schema.optional<
|
|
375
|
+
readonly credentialRejected: Schema.optional<Schema.String>;
|
|
382
376
|
}>, Schema.Struct<{
|
|
383
|
-
type: Schema.Literal<
|
|
384
|
-
id:
|
|
385
|
-
tenantId:
|
|
386
|
-
metadata: Schema.optional<Schema
|
|
377
|
+
readonly type: Schema.Literal<"system">;
|
|
378
|
+
readonly id: Schema.String;
|
|
379
|
+
readonly tenantId: Schema.Null;
|
|
380
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
387
381
|
}>, Schema.Struct<{
|
|
388
|
-
type: Schema.Literal<
|
|
389
|
-
id:
|
|
390
|
-
tenantId:
|
|
391
|
-
metadata: Schema.optional<Schema
|
|
392
|
-
service:
|
|
382
|
+
readonly type: Schema.Literal<"service">;
|
|
383
|
+
readonly id: Schema.String;
|
|
384
|
+
readonly tenantId: Schema.Null;
|
|
385
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
386
|
+
readonly service: Schema.String;
|
|
393
387
|
}>]>;
|
|
394
388
|
|
|
395
389
|
declare type SubjectIdentity = typeof SubjectIdentity.Type;
|
package/dist/session.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as e, nt as t, z as n } from "./scopes-
|
|
1
|
+
import { j as e, nt as t, z as n } from "./scopes-ClywBij8.js";
|
|
2
2
|
import { n as r, t as i } from "./sessionHeader-DriTZhmv.js";
|
|
3
3
|
import { Schema as a } from "effect";
|
|
4
4
|
import { createHmac as o, timingSafeEqual as s } from "node:crypto";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.0",
|
|
4
4
|
"description": "The Voltro wire + plugin contract — defineQuery/Mutation/Action/Stream, definePlugin, sessions / JWT / API-keys, and the RPC protocol.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -63,16 +63,12 @@
|
|
|
63
63
|
"node": ">=24.0.0"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
68
|
-
"@voltro/database": "0.83.1",
|
|
69
|
-
"@voltro/logger": "0.83.1",
|
|
66
|
+
"@voltro/database": "0.85.0",
|
|
67
|
+
"@voltro/logger": "0.85.0",
|
|
70
68
|
"jose": "^6.2.12"
|
|
71
69
|
},
|
|
72
70
|
"peerDependencies": {
|
|
73
|
-
"
|
|
74
|
-
"@effect/rpc": "^0.76.2",
|
|
75
|
-
"effect": "^3.22.2"
|
|
71
|
+
"effect": "4.0.1"
|
|
76
72
|
},
|
|
77
73
|
"publishConfig": {
|
|
78
74
|
"access": "public"
|