@tenuo/core 0.2.4-beta.0 → 0.3.0-beta.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.
Files changed (53) hide show
  1. package/README.md +49 -5
  2. package/dist/api.d.ts +416 -17
  3. package/dist/api.js.map +1 -1
  4. package/dist/client.d.ts +59 -2
  5. package/dist/client.js +700 -70
  6. package/dist/client.js.map +1 -1
  7. package/dist/connect.d.ts +53 -0
  8. package/dist/connect.js +177 -0
  9. package/dist/connect.js.map +1 -0
  10. package/dist/constraints.d.ts +54 -3
  11. package/dist/constraints.js +154 -6
  12. package/dist/constraints.js.map +1 -1
  13. package/dist/errors.d.ts +8 -3
  14. package/dist/errors.js +10 -1
  15. package/dist/errors.js.map +1 -1
  16. package/dist/generated/tenuo_wasm.d.ts +136 -7
  17. package/dist/generated/tenuo_wasm.js +398 -9
  18. package/dist/generated/tenuo_wasm_bg.wasm +0 -0
  19. package/dist/generated/tenuo_wasm_bg.wasm.d.ts +40 -22
  20. package/dist/identity.d.ts +25 -0
  21. package/dist/identity.js +61 -0
  22. package/dist/identity.js.map +1 -0
  23. package/dist/index.d.ts +9 -3
  24. package/dist/index.js +5 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/mcp.d.ts +18 -3
  27. package/dist/mcp.js +67 -59
  28. package/dist/mcp.js.map +1 -1
  29. package/dist/nonce.d.ts +6 -1
  30. package/dist/nonce.js +12 -1
  31. package/dist/nonce.js.map +1 -1
  32. package/dist/receipts.d.ts +27 -0
  33. package/dist/receipts.js +128 -0
  34. package/dist/receipts.js.map +1 -0
  35. package/dist/runtime.d.ts +51 -0
  36. package/dist/runtime.js +102 -0
  37. package/dist/runtime.js.map +1 -0
  38. package/dist/session.d.ts +9 -2
  39. package/dist/session.js +56 -0
  40. package/dist/session.js.map +1 -1
  41. package/dist/wasm.d.ts +207 -5
  42. package/dist/wasm.js +62 -4
  43. package/dist/wasm.js.map +1 -1
  44. package/package.json +3 -2
  45. package/dist/api.d.ts.map +0 -1
  46. package/dist/client.d.ts.map +0 -1
  47. package/dist/constraints.d.ts.map +0 -1
  48. package/dist/errors.d.ts.map +0 -1
  49. package/dist/index.d.ts.map +0 -1
  50. package/dist/mcp.d.ts.map +0 -1
  51. package/dist/nonce.d.ts.map +0 -1
  52. package/dist/session.d.ts.map +0 -1
  53. package/dist/wasm.d.ts.map +0 -1
@@ -21,6 +21,43 @@ class SdkContext {
21
21
  const ptr = this.__destroy_into_raw();
22
22
  wasm.__wbg_sdkcontext_free(ptr, 0);
23
23
  }
24
+ /**
25
+ * Signed statement from this session's holder that it is the one asking
26
+ * for `tool(args)`. Carried inside a control-plane approval request so
27
+ * the approver can tell a genuine request from a forged one.
28
+ * @param {SdkSession} session
29
+ * @param {string} tool
30
+ * @param {any} args_json
31
+ * @returns {any}
32
+ */
33
+ approvalContextAttestation(session, tool, args_json) {
34
+ _assertClass(session, SdkSession);
35
+ const ptr0 = passStringToWasm0(tool, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
36
+ const len0 = WASM_VECTOR_LEN;
37
+ const ret = wasm.sdkcontext_approvalContextAttestation(this.__wbg_ptr, session.__wbg_ptr, ptr0, len0, args_json);
38
+ if (ret[2]) {
39
+ throw takeFromExternrefTable0(ret[1]);
40
+ }
41
+ return takeFromExternrefTable0(ret[0]);
42
+ }
43
+ /**
44
+ * Everything an approval service needs to present `tool(args)` to a
45
+ * human and mint a matching `SignedApproval`. Not a signed artifact.
46
+ * @param {SdkSession} session
47
+ * @param {string} tool
48
+ * @param {any} args_json
49
+ * @returns {any}
50
+ */
51
+ approvalRequest(session, tool, args_json) {
52
+ _assertClass(session, SdkSession);
53
+ const ptr0 = passStringToWasm0(tool, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
54
+ const len0 = WASM_VECTOR_LEN;
55
+ const ret = wasm.sdkcontext_approvalRequest(this.__wbg_ptr, session.__wbg_ptr, ptr0, len0, args_json);
56
+ if (ret[2]) {
57
+ throw takeFromExternrefTable0(ret[1]);
58
+ }
59
+ return takeFromExternrefTable0(ret[0]);
60
+ }
24
61
  /**
25
62
  * Sign PoP and authorize in one call. Never returns allow without a core allow.
26
63
  *
@@ -84,6 +121,42 @@ class SdkContext {
84
121
  const ret = wasm.sdkcontext_authorizePresented(this.__wbg_ptr, warrants, ptr0, len0, args_json, ptr1, len1, approvals, tool_allow, ptr2, len2);
85
122
  return ret;
86
123
  }
124
+ /**
125
+ * Explain what the leaf would decide for `tool(args)`, field by field.
126
+ * No proof-of-possession is signed, so this works on any session,
127
+ * including one issued to another holder.
128
+ * @param {SdkSession} session
129
+ * @param {string} tool
130
+ * @param {any} args_json
131
+ * @returns {any}
132
+ */
133
+ explain(session, tool, args_json) {
134
+ _assertClass(session, SdkSession);
135
+ const ptr0 = passStringToWasm0(tool, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136
+ const len0 = WASM_VECTOR_LEN;
137
+ const ret = wasm.sdkcontext_explain(this.__wbg_ptr, session.__wbg_ptr, ptr0, len0, args_json);
138
+ if (ret[2]) {
139
+ throw takeFromExternrefTable0(ret[1]);
140
+ }
141
+ return takeFromExternrefTable0(ret[0]);
142
+ }
143
+ /**
144
+ * Issuer context from a stable 32-byte Ed25519 secret. Its own public
145
+ * key is trusted; `extra_roots` (hex) are trusted as well, so one
146
+ * process can verify chains from several control planes.
147
+ * @param {Uint8Array} secret
148
+ * @param {any} extra_roots
149
+ * @returns {SdkContext}
150
+ */
151
+ static fromIssuerSecret(secret, extra_roots) {
152
+ const ptr0 = passArray8ToWasm0(secret, wasm.__wbindgen_malloc);
153
+ const len0 = WASM_VECTOR_LEN;
154
+ const ret = wasm.sdkcontext_fromIssuerSecret(ptr0, len0, extra_roots);
155
+ if (ret[2]) {
156
+ throw takeFromExternrefTable0(ret[1]);
157
+ }
158
+ return SdkContext.__wrap(ret[0]);
159
+ }
87
160
  /**
88
161
  * Authorizer-only context. `mint()` fails; import a session from the wire.
89
162
  * @param {any} roots
@@ -96,6 +169,48 @@ class SdkContext {
96
169
  }
97
170
  return SdkContext.__wrap(ret[0]);
98
171
  }
172
+ /**
173
+ * Issue an execution session from an issuer session. The issuer
174
+ * session's holder signs; core checks the tools against
175
+ * `issuableTools`, constraints against `constraintBounds`, clearance,
176
+ * and issue depth. No control-plane key is involved.
177
+ * @param {SdkSession} issuer
178
+ * @param {any} options
179
+ * @returns {SdkSession}
180
+ */
181
+ issue(issuer, options) {
182
+ _assertClass(issuer, SdkSession);
183
+ const ret = wasm.sdkcontext_issue(this.__wbg_ptr, issuer.__wbg_ptr, options);
184
+ if (ret[2]) {
185
+ throw takeFromExternrefTable0(ret[1]);
186
+ }
187
+ return SdkSession.__wrap(ret[0]);
188
+ }
189
+ /**
190
+ * Public key of the local issuer, hex. Verifier-only contexts have none.
191
+ *
192
+ * This is what other processes put in `trustedRoots` to accept warrants
193
+ * this context mints. It is a public key: sharing it grants nothing.
194
+ * @returns {string}
195
+ */
196
+ issuerPublicKey() {
197
+ let deferred2_0;
198
+ let deferred2_1;
199
+ try {
200
+ const ret = wasm.sdkcontext_issuerPublicKey(this.__wbg_ptr);
201
+ var ptr1 = ret[0];
202
+ var len1 = ret[1];
203
+ if (ret[3]) {
204
+ ptr1 = 0; len1 = 0;
205
+ throw takeFromExternrefTable0(ret[2]);
206
+ }
207
+ deferred2_0 = ptr1;
208
+ deferred2_1 = len1;
209
+ return getStringFromWasm0(ptr1, len1);
210
+ } finally {
211
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
212
+ }
213
+ }
99
214
  /**
100
215
  * Load a published SignedRevocationList. The SRL must be signed by a trusted root.
101
216
  * @param {string} wire
@@ -114,27 +229,61 @@ class SdkContext {
114
229
  *
115
230
  * `require_approval` is optional:
116
231
  * `{ "approvers": ["hex..."], "min": 2, "tools": ["transfer"] }`
232
+ *
233
+ * `holder_hex` binds the warrant to another agent's public key. The
234
+ * returned session then has no holder secret: export it with `toWire()`
235
+ * and let that agent import it. Omit it to mint a local session with a
236
+ * fresh holder key.
237
+ *
238
+ * `max_depth` caps how many times the authority may be delegated below
239
+ * the root (0 = terminal). Omit for the protocol maximum.
117
240
  * @param {any} allow_json
118
241
  * @param {number} ttl_seconds
119
242
  * @param {any} require_approval
243
+ * @param {string | null} [holder_hex]
244
+ * @param {number | null} [max_depth]
120
245
  * @returns {SdkSession}
121
246
  */
122
- mint(allow_json, ttl_seconds, require_approval) {
123
- const ret = wasm.sdkcontext_mint(this.__wbg_ptr, allow_json, ttl_seconds, require_approval);
247
+ mint(allow_json, ttl_seconds, require_approval, holder_hex, max_depth) {
248
+ var ptr0 = isLikeNone(holder_hex) ? 0 : passStringToWasm0(holder_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
249
+ var len0 = WASM_VECTOR_LEN;
250
+ const ret = wasm.sdkcontext_mint(this.__wbg_ptr, allow_json, ttl_seconds, require_approval, ptr0, len0, isLikeNone(max_depth) ? Number.MAX_SAFE_INTEGER : (max_depth) >>> 0);
124
251
  if (ret[2]) {
125
252
  throw takeFromExternrefTable0(ret[1]);
126
253
  }
127
254
  return SdkSession.__wrap(ret[0]);
128
255
  }
129
256
  /**
130
- * Attenuate the leaf. The current holder signs; the same holder keeps the child.
257
+ * `mint()` with every option the protocol offers: kind, clearance,
258
+ * session and agent ids, approval gates with messages and per-argument
259
+ * triggers, and issuer-warrant fields. Keys are camelCase; unknown keys
260
+ * are rejected.
261
+ * @param {any} options
262
+ * @returns {SdkSession}
263
+ */
264
+ mintExtended(options) {
265
+ const ret = wasm.sdkcontext_mintExtended(this.__wbg_ptr, options);
266
+ if (ret[2]) {
267
+ throw takeFromExternrefTable0(ret[1]);
268
+ }
269
+ return SdkSession.__wrap(ret[0]);
270
+ }
271
+ /**
272
+ * Attenuate the leaf. The current holder signs.
273
+ *
274
+ * Without `options.holder` the same holder keeps the child. With it, the
275
+ * child is bound to that public key: this is delegation to another agent,
276
+ * and the returned session carries no holder secret (see `SdkSession`).
277
+ * Core rejects any child that is not within its parent — tools,
278
+ * constraints, lifetime, and depth — before a token exists.
131
279
  * @param {SdkSession} session
132
280
  * @param {any} allow_json
281
+ * @param {any} options
133
282
  * @returns {SdkSession}
134
283
  */
135
- narrow(session, allow_json) {
284
+ narrow(session, allow_json, options) {
136
285
  _assertClass(session, SdkSession);
137
- const ret = wasm.sdkcontext_narrow(this.__wbg_ptr, session.__wbg_ptr, allow_json);
286
+ const ret = wasm.sdkcontext_narrow(this.__wbg_ptr, session.__wbg_ptr, allow_json, options);
138
287
  if (ret[2]) {
139
288
  throw takeFromExternrefTable0(ret[1]);
140
289
  }
@@ -197,12 +346,58 @@ class SdkContext {
197
346
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
198
347
  }
199
348
  }
349
+ /**
350
+ * Sign a revocation list with this context's issuer key. Load it with
351
+ * `loadRevocationList` anywhere this issuer is a trusted root.
352
+ * @param {any} ids
353
+ * @param {number | null} [version]
354
+ * @returns {string}
355
+ */
356
+ signRevocationListVersioned(ids, version) {
357
+ let deferred2_0;
358
+ let deferred2_1;
359
+ try {
360
+ const ret = wasm.sdkcontext_signRevocationListVersioned(this.__wbg_ptr, ids, isLikeNone(version) ? Number.MAX_SAFE_INTEGER : (version) >>> 0);
361
+ var ptr1 = ret[0];
362
+ var len1 = ret[1];
363
+ if (ret[3]) {
364
+ ptr1 = 0; len1 = 0;
365
+ throw takeFromExternrefTable0(ret[2]);
366
+ }
367
+ deferred2_0 = ptr1;
368
+ deferred2_1 = len1;
369
+ return getStringFromWasm0(ptr1, len1);
370
+ } finally {
371
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
372
+ }
373
+ }
374
+ /**
375
+ * Sign verifier receipts with this 32-byte holder secret instead of an
376
+ * ephemeral key. Used by the TypeScript `Runtime`.
377
+ * @param {Uint8Array} secret
378
+ * @returns {SdkContext}
379
+ */
380
+ withReceiptSigner(secret) {
381
+ const ptr = this.__destroy_into_raw();
382
+ const ptr0 = passArray8ToWasm0(secret, wasm.__wbindgen_malloc);
383
+ const len0 = WASM_VECTOR_LEN;
384
+ const ret = wasm.sdkcontext_withReceiptSigner(ptr, ptr0, len0);
385
+ if (ret[2]) {
386
+ throw takeFromExternrefTable0(ret[1]);
387
+ }
388
+ return SdkContext.__wrap(ret[0]);
389
+ }
200
390
  }
201
391
  if (Symbol.dispose) SdkContext.prototype[Symbol.dispose] = SdkContext.prototype.free;
202
392
  exports.SdkContext = SdkContext;
203
393
 
204
394
  /**
205
395
  * Opaque warrant chain (root first) + leaf holder key. Not JSON-serializable from JS.
396
+ *
397
+ * `holder` is `None` when the leaf was issued or delegated to another agent's
398
+ * key. Such a session can be exported with `toWire()` and handed over, but it
399
+ * cannot sign proof-of-possession here; the holder imports it with
400
+ * `SdkSession.fromWire` and its own secret.
206
401
  */
207
402
  class SdkSession {
208
403
  static __wrap(ptr) {
@@ -248,6 +443,18 @@ class SdkSession {
248
443
  wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
249
444
  }
250
445
  }
446
+ /**
447
+ * Public view of the leaf: holder public key, depth, ceiling, lifetime,
448
+ * tools. Never the holder secret.
449
+ * @returns {any}
450
+ */
451
+ describe() {
452
+ const ret = wasm.sdksession_describe(this.__wbg_ptr);
453
+ if (ret[2]) {
454
+ throw takeFromExternrefTable0(ret[1]);
455
+ }
456
+ return takeFromExternrefTable0(ret[0]);
457
+ }
251
458
  /**
252
459
  * Test / interop seam. Not on the public TypeScript Session type.
253
460
  * @returns {any}
@@ -359,6 +566,28 @@ class SdkSession {
359
566
  if (Symbol.dispose) SdkSession.prototype[Symbol.dispose] = SdkSession.prototype.free;
360
567
  exports.SdkSession = SdkSession;
361
568
 
569
+ /**
570
+ * Typed preflight of a warrant's approval gates for `(tool, args)`.
571
+ *
572
+ * Returns `{ status: "not_gated"|"exempt"|"required"|"denied", tool, kind?,
573
+ * argument?, arguments, message?, code?, reason?, error? }`. Parse errors
574
+ * fail closed with `status: "required"` and `error` set (no fabricated
575
+ * `kind`). `denied` means the warrant's constraints refuse the call.
576
+ * @param {string} warrant_b64
577
+ * @param {string} tool
578
+ * @param {any} args_json
579
+ * @returns {any}
580
+ */
581
+ function approval_requirement(warrant_b64, tool, args_json) {
582
+ const ptr0 = passStringToWasm0(warrant_b64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
583
+ const len0 = WASM_VECTOR_LEN;
584
+ const ptr1 = passStringToWasm0(tool, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
585
+ const len1 = WASM_VECTOR_LEN;
586
+ const ret = wasm.approval_requirement(ptr0, len0, ptr1, len1, args_json);
587
+ return ret;
588
+ }
589
+ exports.approval_requirement = approval_requirement;
590
+
362
591
  /**
363
592
  * @param {string} warrant_b64
364
593
  * @param {string} tool
@@ -576,6 +805,9 @@ exports.decode_warrant = decode_warrant;
576
805
  * Returns `{ approval_required: true/false, tool, error }`.
577
806
  * This reads `extensions["tenuo.approval_gates"]` from the warrant, parses it,
578
807
  * and runs the gate evaluation logic from tenuo-core.
808
+ *
809
+ * Malformed warrants, gate maps, or arguments fail closed (`approval_required: true`).
810
+ * Prefer `approval_requirement` when the caller must distinguish exemptions.
579
811
  * @param {string} warrant_b64
580
812
  * @param {string} tool
581
813
  * @param {any} args_json
@@ -607,11 +839,31 @@ function init_panic_hook() {
607
839
  exports.init_panic_hook = init_panic_hook;
608
840
 
609
841
  /**
610
- * Parse a `TENUO_CONNECT_TOKEN` string into its component fields.
842
+ * Inspect how a warrant gates `tool`, without evaluating arguments.
611
843
  *
612
- * The token is a base64url-encoded JSON blob: `{ v, e, k, a?, t? }`.
613
- * This WASM binding keeps the parsing canonical so TypeScript doesn't need
614
- * to duplicate the decode logic.
844
+ * Returns `{ kind: "none"|"whole_tool"|"conditional", tool, arguments, message?, error? }`.
845
+ * Parse errors fail closed with `kind: "unknown"` and `error` set so callers
846
+ * cannot treat a malformed map as ungated.
847
+ * @param {string} warrant_b64
848
+ * @param {string} tool
849
+ * @returns {any}
850
+ */
851
+ function inspect_approval_gate(warrant_b64, tool) {
852
+ const ptr0 = passStringToWasm0(warrant_b64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
853
+ const len0 = WASM_VECTOR_LEN;
854
+ const ptr1 = passStringToWasm0(tool, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
855
+ const len1 = WASM_VECTOR_LEN;
856
+ const ret = wasm.inspect_approval_gate(ptr0, len0, ptr1, len1);
857
+ return ret;
858
+ }
859
+ exports.inspect_approval_gate = inspect_approval_gate;
860
+
861
+ /**
862
+ * Parse a complete `tenuo_ct_…` token into its component fields.
863
+ *
864
+ * Accepts padded and unpadded Base64URL. Version must be 1; omitted `v`
865
+ * is an error. Trailing `/v1` is stripped from `e`.
866
+ * Registration-token aliases: `t`, `r`, `registration_token`.
615
867
  *
616
868
  * Returns `{ endpoint, apiKey, agentId?, registrationToken?, error? }`.
617
869
  * @param {string} token
@@ -625,6 +877,22 @@ function parse_connect_token(token) {
625
877
  }
626
878
  exports.parse_connect_token = parse_connect_token;
627
879
 
880
+ /**
881
+ * Decode and check an approval envelope. Not authorization.
882
+ * @param {string} envelope
883
+ * @returns {any}
884
+ */
885
+ function sdkInspectApproval(envelope) {
886
+ const ptr0 = passStringToWasm0(envelope, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
887
+ const len0 = WASM_VECTOR_LEN;
888
+ const ret = wasm.sdkInspectApproval(ptr0, len0);
889
+ if (ret[2]) {
890
+ throw takeFromExternrefTable0(ret[1]);
891
+ }
892
+ return takeFromExternrefTable0(ret[0]);
893
+ }
894
+ exports.sdkInspectApproval = sdkInspectApproval;
895
+
628
896
  /**
629
897
  * @param {string} payload_hex
630
898
  * @param {string} signature_hex
@@ -643,6 +911,22 @@ function sdkInspectParts(payload_hex, signature_hex) {
643
911
  }
644
912
  exports.sdkInspectParts = sdkInspectParts;
645
913
 
914
+ /**
915
+ * Decode a signed revocation list without loading it.
916
+ * @param {string} wire
917
+ * @returns {any}
918
+ */
919
+ function sdkInspectRevocationList(wire) {
920
+ const ptr0 = passStringToWasm0(wire, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
921
+ const len0 = WASM_VECTOR_LEN;
922
+ const ret = wasm.sdkInspectRevocationList(ptr0, len0);
923
+ if (ret[2]) {
924
+ throw takeFromExternrefTable0(ret[1]);
925
+ }
926
+ return takeFromExternrefTable0(ret[0]);
927
+ }
928
+ exports.sdkInspectRevocationList = sdkInspectRevocationList;
929
+
646
930
  /**
647
931
  * @param {string} wire
648
932
  * @returns {any}
@@ -658,6 +942,46 @@ function sdkInspectWarrant(wire) {
658
942
  }
659
943
  exports.sdkInspectWarrant = sdkInspectWarrant;
660
944
 
945
+ /**
946
+ * @returns {any}
947
+ */
948
+ function sdkProtocolLimits() {
949
+ const ret = wasm.sdkProtocolLimits();
950
+ if (ret[2]) {
951
+ throw takeFromExternrefTable0(ret[1]);
952
+ }
953
+ return takeFromExternrefTable0(ret[0]);
954
+ }
955
+ exports.sdkProtocolLimits = sdkProtocolLimits;
956
+
957
+ /**
958
+ * Public key (hex) for a 32-byte Ed25519 holder secret. What an agent hands
959
+ * to whoever will issue or delegate a warrant to it.
960
+ * @param {Uint8Array} holder_secret
961
+ * @returns {string}
962
+ */
963
+ function sdkPublicKeyFromHolderKey(holder_secret) {
964
+ let deferred3_0;
965
+ let deferred3_1;
966
+ try {
967
+ const ptr0 = passArray8ToWasm0(holder_secret, wasm.__wbindgen_malloc);
968
+ const len0 = WASM_VECTOR_LEN;
969
+ const ret = wasm.sdkPublicKeyFromHolderKey(ptr0, len0);
970
+ var ptr2 = ret[0];
971
+ var len2 = ret[1];
972
+ if (ret[3]) {
973
+ ptr2 = 0; len2 = 0;
974
+ throw takeFromExternrefTable0(ret[2]);
975
+ }
976
+ deferred3_0 = ptr2;
977
+ deferred3_1 = len2;
978
+ return getStringFromWasm0(ptr2, len2);
979
+ } finally {
980
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
981
+ }
982
+ }
983
+ exports.sdkPublicKeyFromHolderKey = sdkPublicKeyFromHolderKey;
984
+
661
985
  /**
662
986
  * Test / host seam. Signs a SignedApproval envelope; does not authorize.
663
987
  * @param {SdkSession} session
@@ -695,6 +1019,42 @@ function sdkSignApproval(session, tool, args_json, approver_secret, external_id,
695
1019
  }
696
1020
  exports.sdkSignApproval = sdkSignApproval;
697
1021
 
1022
+ /**
1023
+ * Sign an approval for a request hash. The approver never needs the
1024
+ * warrant or the holder key; the hash already commits to both.
1025
+ * @param {string} request_hash_hex
1026
+ * @param {Uint8Array} approver_secret
1027
+ * @param {string} external_id
1028
+ * @param {number | null} [ttl_seconds]
1029
+ * @param {number | null} [warrant_expires_at]
1030
+ * @returns {string}
1031
+ */
1032
+ function sdkSignApprovalForRequest(request_hash_hex, approver_secret, external_id, ttl_seconds, warrant_expires_at) {
1033
+ let deferred5_0;
1034
+ let deferred5_1;
1035
+ try {
1036
+ const ptr0 = passStringToWasm0(request_hash_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1037
+ const len0 = WASM_VECTOR_LEN;
1038
+ const ptr1 = passArray8ToWasm0(approver_secret, wasm.__wbindgen_malloc);
1039
+ const len1 = WASM_VECTOR_LEN;
1040
+ const ptr2 = passStringToWasm0(external_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1041
+ const len2 = WASM_VECTOR_LEN;
1042
+ const ret = wasm.sdkSignApprovalForRequest(ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(ttl_seconds) ? Number.MAX_SAFE_INTEGER : (ttl_seconds) >>> 0, !isLikeNone(warrant_expires_at), isLikeNone(warrant_expires_at) ? 0 : warrant_expires_at);
1043
+ var ptr4 = ret[0];
1044
+ var len4 = ret[1];
1045
+ if (ret[3]) {
1046
+ ptr4 = 0; len4 = 0;
1047
+ throw takeFromExternrefTable0(ret[2]);
1048
+ }
1049
+ deferred5_0 = ptr4;
1050
+ deferred5_1 = len4;
1051
+ return getStringFromWasm0(ptr4, len4);
1052
+ } finally {
1053
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
1054
+ }
1055
+ }
1056
+ exports.sdkSignApprovalForRequest = sdkSignApprovalForRequest;
1057
+
698
1058
  /**
699
1059
  * Test seam. Signs the published generator envelope (not the in-memory SRL codec).
700
1060
  * @param {any} ids
@@ -752,6 +1112,35 @@ function sdkSignRevocationList(ids, issuer_secret) {
752
1112
  }
753
1113
  exports.sdkSignRevocationList = sdkSignRevocationList;
754
1114
 
1115
+ /**
1116
+ * Sign a revocation list with an explicit issuer secret (control-plane path).
1117
+ * @param {any} ids
1118
+ * @param {number | null | undefined} version
1119
+ * @param {Uint8Array} issuer_secret
1120
+ * @returns {string}
1121
+ */
1122
+ function sdkSignRevocationListVersioned(ids, version, issuer_secret) {
1123
+ let deferred3_0;
1124
+ let deferred3_1;
1125
+ try {
1126
+ const ptr0 = passArray8ToWasm0(issuer_secret, wasm.__wbindgen_malloc);
1127
+ const len0 = WASM_VECTOR_LEN;
1128
+ const ret = wasm.sdkSignRevocationListVersioned(ids, isLikeNone(version) ? Number.MAX_SAFE_INTEGER : (version) >>> 0, ptr0, len0);
1129
+ var ptr2 = ret[0];
1130
+ var len2 = ret[1];
1131
+ if (ret[3]) {
1132
+ ptr2 = 0; len2 = 0;
1133
+ throw takeFromExternrefTable0(ret[2]);
1134
+ }
1135
+ deferred3_0 = ptr2;
1136
+ deferred3_1 = len2;
1137
+ return getStringFromWasm0(ptr2, len2);
1138
+ } finally {
1139
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1140
+ }
1141
+ }
1142
+ exports.sdkSignRevocationListVersioned = sdkSignRevocationListVersioned;
1143
+
755
1144
  /**
756
1145
  * Signature authenticity only. Not authorization.
757
1146
  * @param {string} wire
Binary file
@@ -1,30 +1,12 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const check_access: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number) => any;
5
- export const check_access_with_pop: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number, i: number) => any;
6
- export const check_chain_access: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number) => any;
7
- export const check_chain_access_with_approvals: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: any, i: number, j: number) => any;
8
- export const check_revocation: (a: number, b: number, c: number, d: number) => any;
9
- export const compute_request_hash_wasm: (a: number, b: number, c: number, d: number, e: any) => any;
10
- export const create_issuer_warrant: (a: any) => any;
11
- export const create_sample_warrant: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => any;
12
- export const create_warrant_from_config: (a: any) => any;
13
- export const decode_pem_chain_wasm: (a: number, b: number) => any;
14
- export const decode_warrant: (a: number, b: number) => any;
15
- export const evaluate_approval_gates: (a: number, b: number, c: number, d: number, e: any) => any;
16
- export const generate_keypair: () => any;
17
- export const parse_connect_token: (a: number, b: number) => any;
18
- export const sign: (a: number, b: number, c: number, d: number, e: number, f: number, g: any) => any;
19
- export const sign_receipt: (a: any, b: number, c: number) => any;
20
- export const verify_approval_set: (a: number, b: number, c: number, d: number, e: any) => any;
21
- export const verify_signed_approval: (a: number, b: number) => any;
22
- export const verify_srl: (a: number, b: number, c: number, d: number) => any;
23
- export const init_panic_hook: () => void;
24
4
  export const __wbg_sdkcontext_free: (a: number, b: number) => void;
25
5
  export const __wbg_sdksession_free: (a: number, b: number) => void;
26
6
  export const sdkInspectParts: (a: number, b: number, c: number, d: number) => [number, number, number];
27
7
  export const sdkInspectWarrant: (a: number, b: number) => [number, number, number];
8
+ export const sdkProtocolLimits: () => [number, number, number];
9
+ export const sdkPublicKeyFromHolderKey: (a: number, b: number) => [number, number, number, number];
28
10
  export const sdkSignApproval: (a: number, b: number, c: number, d: any, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number, number];
29
11
  export const sdkSignPublishedRevocationList: (a: any, b: number, c: number, d: number) => [number, number, number, number];
30
12
  export const sdkSignRevocationList: (a: any, b: number, c: number) => [number, number, number, number];
@@ -34,13 +16,16 @@ export const sdkcontext_authorize: (a: number, b: number, c: number, d: number,
34
16
  export const sdkcontext_authorizeAsOf: (a: number, b: number, c: number, d: number, e: any, f: number, g: any, h: any) => any;
35
17
  export const sdkcontext_authorizePresented: (a: number, b: any, c: number, d: number, e: any, f: number, g: number, h: any, i: any, j: number, k: number) => any;
36
18
  export const sdkcontext_fromTrustedRoots: (a: any) => [number, number, number];
19
+ export const sdkcontext_issuerPublicKey: (a: number) => [number, number, number, number];
37
20
  export const sdkcontext_loadRevocationList: (a: number, b: number, c: number) => [number, number];
38
- export const sdkcontext_mint: (a: number, b: any, c: number, d: any) => [number, number, number];
39
- export const sdkcontext_narrow: (a: number, b: number, c: any) => [number, number, number];
21
+ export const sdkcontext_mint: (a: number, b: any, c: number, d: any, e: number, f: number, g: number) => [number, number, number];
22
+ export const sdkcontext_narrow: (a: number, b: number, c: any, d: any) => [number, number, number];
40
23
  export const sdkcontext_new: () => number;
41
24
  export const sdkcontext_signPop: (a: number, b: number, c: number, d: number, e: any) => [number, number, number, number];
42
25
  export const sdkcontext_signRevocationList: (a: number, b: any) => [number, number, number, number];
26
+ export const sdkcontext_withReceiptSigner: (a: number, b: number, c: number) => [number, number, number];
43
27
  export const sdksession_dedupKey: (a: number, b: number, c: number, d: any) => [number, number, number, number];
28
+ export const sdksession_describe: (a: number) => [number, number, number];
44
29
  export const sdksession_exportWire: (a: number) => [number, number, number];
45
30
  export const sdksession_fromChain: (a: any, b: number, c: number) => [number, number, number];
46
31
  export const sdksession_fromParts: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
@@ -48,6 +33,39 @@ export const sdksession_fromWire: (a: number, b: number, c: number, d: number) =
48
33
  export const sdksession_toStackWire: (a: number) => [number, number, number, number];
49
34
  export const sdksession_toWire: (a: number) => [number, number, number];
50
35
  export const sdksession_warrantIds: (a: number) => [number, number, number];
36
+ export const approval_requirement: (a: number, b: number, c: number, d: number, e: any) => any;
37
+ export const check_access: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number) => any;
38
+ export const check_access_with_pop: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number, i: number) => any;
39
+ export const check_chain_access: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number) => any;
40
+ export const check_chain_access_with_approvals: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: any, i: number, j: number) => any;
41
+ export const check_revocation: (a: number, b: number, c: number, d: number) => any;
42
+ export const compute_request_hash_wasm: (a: number, b: number, c: number, d: number, e: any) => any;
43
+ export const create_issuer_warrant: (a: any) => any;
44
+ export const create_sample_warrant: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => any;
45
+ export const create_warrant_from_config: (a: any) => any;
46
+ export const decode_pem_chain_wasm: (a: number, b: number) => any;
47
+ export const decode_warrant: (a: number, b: number) => any;
48
+ export const evaluate_approval_gates: (a: number, b: number, c: number, d: number, e: any) => any;
49
+ export const generate_keypair: () => any;
50
+ export const inspect_approval_gate: (a: number, b: number, c: number, d: number) => any;
51
+ export const parse_connect_token: (a: number, b: number) => any;
52
+ export const sign: (a: number, b: number, c: number, d: number, e: number, f: number, g: any) => any;
53
+ export const sign_receipt: (a: any, b: number, c: number) => any;
54
+ export const verify_approval_set: (a: number, b: number, c: number, d: number, e: any) => any;
55
+ export const verify_signed_approval: (a: number, b: number) => any;
56
+ export const verify_srl: (a: number, b: number, c: number, d: number) => any;
57
+ export const init_panic_hook: () => void;
58
+ export const sdkInspectApproval: (a: number, b: number) => [number, number, number];
59
+ export const sdkInspectRevocationList: (a: number, b: number) => [number, number, number];
60
+ export const sdkSignApprovalForRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
61
+ export const sdkSignRevocationListVersioned: (a: any, b: number, c: number, d: number) => [number, number, number, number];
62
+ export const sdkcontext_approvalContextAttestation: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
63
+ export const sdkcontext_approvalRequest: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
64
+ export const sdkcontext_explain: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
65
+ export const sdkcontext_fromIssuerSecret: (a: number, b: number, c: any) => [number, number, number];
66
+ export const sdkcontext_issue: (a: number, b: number, c: any) => [number, number, number];
67
+ export const sdkcontext_mintExtended: (a: number, b: any) => [number, number, number];
68
+ export const sdkcontext_signRevocationListVersioned: (a: number, b: any, c: number) => [number, number, number, number];
51
69
  export const __wbindgen_malloc: (a: number, b: number) => number;
52
70
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
53
71
  export const __wbindgen_exn_store: (a: number) => void;
@@ -0,0 +1,25 @@
1
+ import type { PublicKeyHandle } from "./api.ts";
2
+ declare const inspect: unique symbol;
3
+ /**
4
+ * Holder keypair. Core owns the representation; persistence is the caller's
5
+ * job (or a later Node adapter). The secret never appears in stringification,
6
+ * inspection, or JSON.
7
+ */
8
+ export declare class HolderIdentity {
9
+ readonly publicKey: PublicKeyHandle;
10
+ constructor(holderKey: Uint8Array);
11
+ /** Copy of the 32-byte Ed25519 secret. */
12
+ get holderKey(): Uint8Array;
13
+ toJSON(): {
14
+ readonly publicKey: string;
15
+ };
16
+ toString(): string;
17
+ [inspect](): {
18
+ readonly publicKey: string;
19
+ };
20
+ }
21
+ /** Import a 32-byte holder secret. */
22
+ export declare function identityFromKey(holderKey: Uint8Array): HolderIdentity;
23
+ /** Fresh holder identity. Uses Web Crypto; does not touch the filesystem. */
24
+ export declare function generateIdentity(): HolderIdentity;
25
+ export {};