@tenuo/core 0.2.4-beta.0 → 0.2.5-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.
@@ -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]
245
+ * @returns {SdkSession}
246
+ */
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);
251
+ if (ret[2]) {
252
+ throw takeFromExternrefTable0(ret[1]);
253
+ }
254
+ return SdkSession.__wrap(ret[0]);
255
+ }
256
+ /**
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
120
262
  * @returns {SdkSession}
121
263
  */
122
- mint(allow_json, ttl_seconds, require_approval) {
123
- const ret = wasm.sdkcontext_mint(this.__wbg_ptr, allow_json, ttl_seconds, require_approval);
264
+ mintExtended(options) {
265
+ const ret = wasm.sdkcontext_mintExtended(this.__wbg_ptr, options);
124
266
  if (ret[2]) {
125
267
  throw takeFromExternrefTable0(ret[1]);
126
268
  }
127
269
  return SdkSession.__wrap(ret[0]);
128
270
  }
129
271
  /**
130
- * Attenuate the leaf. The current holder signs; the same holder keeps the child.
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,42 @@ 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
+ }
200
374
  }
201
375
  if (Symbol.dispose) SdkContext.prototype[Symbol.dispose] = SdkContext.prototype.free;
202
376
  exports.SdkContext = SdkContext;
203
377
 
204
378
  /**
205
379
  * Opaque warrant chain (root first) + leaf holder key. Not JSON-serializable from JS.
380
+ *
381
+ * `holder` is `None` when the leaf was issued or delegated to another agent's
382
+ * key. Such a session can be exported with `toWire()` and handed over, but it
383
+ * cannot sign proof-of-possession here; the holder imports it with
384
+ * `SdkSession.fromWire` and its own secret.
206
385
  */
207
386
  class SdkSession {
208
387
  static __wrap(ptr) {
@@ -248,6 +427,18 @@ class SdkSession {
248
427
  wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
249
428
  }
250
429
  }
430
+ /**
431
+ * Public view of the leaf: holder public key, depth, ceiling, lifetime,
432
+ * tools. Never the holder secret.
433
+ * @returns {any}
434
+ */
435
+ describe() {
436
+ const ret = wasm.sdksession_describe(this.__wbg_ptr);
437
+ if (ret[2]) {
438
+ throw takeFromExternrefTable0(ret[1]);
439
+ }
440
+ return takeFromExternrefTable0(ret[0]);
441
+ }
251
442
  /**
252
443
  * Test / interop seam. Not on the public TypeScript Session type.
253
444
  * @returns {any}
@@ -625,6 +816,22 @@ function parse_connect_token(token) {
625
816
  }
626
817
  exports.parse_connect_token = parse_connect_token;
627
818
 
819
+ /**
820
+ * Decode and check an approval envelope. Not authorization.
821
+ * @param {string} envelope
822
+ * @returns {any}
823
+ */
824
+ function sdkInspectApproval(envelope) {
825
+ const ptr0 = passStringToWasm0(envelope, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
826
+ const len0 = WASM_VECTOR_LEN;
827
+ const ret = wasm.sdkInspectApproval(ptr0, len0);
828
+ if (ret[2]) {
829
+ throw takeFromExternrefTable0(ret[1]);
830
+ }
831
+ return takeFromExternrefTable0(ret[0]);
832
+ }
833
+ exports.sdkInspectApproval = sdkInspectApproval;
834
+
628
835
  /**
629
836
  * @param {string} payload_hex
630
837
  * @param {string} signature_hex
@@ -643,6 +850,22 @@ function sdkInspectParts(payload_hex, signature_hex) {
643
850
  }
644
851
  exports.sdkInspectParts = sdkInspectParts;
645
852
 
853
+ /**
854
+ * Decode a signed revocation list without loading it.
855
+ * @param {string} wire
856
+ * @returns {any}
857
+ */
858
+ function sdkInspectRevocationList(wire) {
859
+ const ptr0 = passStringToWasm0(wire, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
860
+ const len0 = WASM_VECTOR_LEN;
861
+ const ret = wasm.sdkInspectRevocationList(ptr0, len0);
862
+ if (ret[2]) {
863
+ throw takeFromExternrefTable0(ret[1]);
864
+ }
865
+ return takeFromExternrefTable0(ret[0]);
866
+ }
867
+ exports.sdkInspectRevocationList = sdkInspectRevocationList;
868
+
646
869
  /**
647
870
  * @param {string} wire
648
871
  * @returns {any}
@@ -658,6 +881,46 @@ function sdkInspectWarrant(wire) {
658
881
  }
659
882
  exports.sdkInspectWarrant = sdkInspectWarrant;
660
883
 
884
+ /**
885
+ * @returns {any}
886
+ */
887
+ function sdkProtocolLimits() {
888
+ const ret = wasm.sdkProtocolLimits();
889
+ if (ret[2]) {
890
+ throw takeFromExternrefTable0(ret[1]);
891
+ }
892
+ return takeFromExternrefTable0(ret[0]);
893
+ }
894
+ exports.sdkProtocolLimits = sdkProtocolLimits;
895
+
896
+ /**
897
+ * Public key (hex) for a 32-byte Ed25519 holder secret. What an agent hands
898
+ * to whoever will issue or delegate a warrant to it.
899
+ * @param {Uint8Array} holder_secret
900
+ * @returns {string}
901
+ */
902
+ function sdkPublicKeyFromHolderKey(holder_secret) {
903
+ let deferred3_0;
904
+ let deferred3_1;
905
+ try {
906
+ const ptr0 = passArray8ToWasm0(holder_secret, wasm.__wbindgen_malloc);
907
+ const len0 = WASM_VECTOR_LEN;
908
+ const ret = wasm.sdkPublicKeyFromHolderKey(ptr0, len0);
909
+ var ptr2 = ret[0];
910
+ var len2 = ret[1];
911
+ if (ret[3]) {
912
+ ptr2 = 0; len2 = 0;
913
+ throw takeFromExternrefTable0(ret[2]);
914
+ }
915
+ deferred3_0 = ptr2;
916
+ deferred3_1 = len2;
917
+ return getStringFromWasm0(ptr2, len2);
918
+ } finally {
919
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
920
+ }
921
+ }
922
+ exports.sdkPublicKeyFromHolderKey = sdkPublicKeyFromHolderKey;
923
+
661
924
  /**
662
925
  * Test / host seam. Signs a SignedApproval envelope; does not authorize.
663
926
  * @param {SdkSession} session
@@ -695,6 +958,42 @@ function sdkSignApproval(session, tool, args_json, approver_secret, external_id,
695
958
  }
696
959
  exports.sdkSignApproval = sdkSignApproval;
697
960
 
961
+ /**
962
+ * Sign an approval for a request hash. The approver never needs the
963
+ * warrant or the holder key; the hash already commits to both.
964
+ * @param {string} request_hash_hex
965
+ * @param {Uint8Array} approver_secret
966
+ * @param {string} external_id
967
+ * @param {number | null} [ttl_seconds]
968
+ * @param {number | null} [warrant_expires_at]
969
+ * @returns {string}
970
+ */
971
+ function sdkSignApprovalForRequest(request_hash_hex, approver_secret, external_id, ttl_seconds, warrant_expires_at) {
972
+ let deferred5_0;
973
+ let deferred5_1;
974
+ try {
975
+ const ptr0 = passStringToWasm0(request_hash_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
976
+ const len0 = WASM_VECTOR_LEN;
977
+ const ptr1 = passArray8ToWasm0(approver_secret, wasm.__wbindgen_malloc);
978
+ const len1 = WASM_VECTOR_LEN;
979
+ const ptr2 = passStringToWasm0(external_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
980
+ const len2 = WASM_VECTOR_LEN;
981
+ 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);
982
+ var ptr4 = ret[0];
983
+ var len4 = ret[1];
984
+ if (ret[3]) {
985
+ ptr4 = 0; len4 = 0;
986
+ throw takeFromExternrefTable0(ret[2]);
987
+ }
988
+ deferred5_0 = ptr4;
989
+ deferred5_1 = len4;
990
+ return getStringFromWasm0(ptr4, len4);
991
+ } finally {
992
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
993
+ }
994
+ }
995
+ exports.sdkSignApprovalForRequest = sdkSignApprovalForRequest;
996
+
698
997
  /**
699
998
  * Test seam. Signs the published generator envelope (not the in-memory SRL codec).
700
999
  * @param {any} ids
@@ -752,6 +1051,35 @@ function sdkSignRevocationList(ids, issuer_secret) {
752
1051
  }
753
1052
  exports.sdkSignRevocationList = sdkSignRevocationList;
754
1053
 
1054
+ /**
1055
+ * Sign a revocation list with an explicit issuer secret (control-plane path).
1056
+ * @param {any} ids
1057
+ * @param {number | null | undefined} version
1058
+ * @param {Uint8Array} issuer_secret
1059
+ * @returns {string}
1060
+ */
1061
+ function sdkSignRevocationListVersioned(ids, version, issuer_secret) {
1062
+ let deferred3_0;
1063
+ let deferred3_1;
1064
+ try {
1065
+ const ptr0 = passArray8ToWasm0(issuer_secret, wasm.__wbindgen_malloc);
1066
+ const len0 = WASM_VECTOR_LEN;
1067
+ const ret = wasm.sdkSignRevocationListVersioned(ids, isLikeNone(version) ? Number.MAX_SAFE_INTEGER : (version) >>> 0, ptr0, len0);
1068
+ var ptr2 = ret[0];
1069
+ var len2 = ret[1];
1070
+ if (ret[3]) {
1071
+ ptr2 = 0; len2 = 0;
1072
+ throw takeFromExternrefTable0(ret[2]);
1073
+ }
1074
+ deferred3_0 = ptr2;
1075
+ deferred3_1 = len2;
1076
+ return getStringFromWasm0(ptr2, len2);
1077
+ } finally {
1078
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1079
+ }
1080
+ }
1081
+ exports.sdkSignRevocationListVersioned = sdkSignRevocationListVersioned;
1082
+
755
1083
  /**
756
1084
  * Signature authenticity only. Not authorization.
757
1085
  * @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,15 @@ 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];
43
26
  export const sdksession_dedupKey: (a: number, b: number, c: number, d: any) => [number, number, number, number];
27
+ export const sdksession_describe: (a: number) => [number, number, number];
44
28
  export const sdksession_exportWire: (a: number) => [number, number, number];
45
29
  export const sdksession_fromChain: (a: any, b: number, c: number) => [number, number, number];
46
30
  export const sdksession_fromParts: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
@@ -48,6 +32,37 @@ export const sdksession_fromWire: (a: number, b: number, c: number, d: number) =
48
32
  export const sdksession_toStackWire: (a: number) => [number, number, number, number];
49
33
  export const sdksession_toWire: (a: number) => [number, number, number];
50
34
  export const sdksession_warrantIds: (a: number) => [number, number, number];
35
+ export const check_access: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number) => any;
36
+ 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;
37
+ export const check_chain_access: (a: number, b: number, c: number, d: number, e: any, f: number, g: number, h: number) => any;
38
+ 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;
39
+ export const check_revocation: (a: number, b: number, c: number, d: number) => any;
40
+ export const compute_request_hash_wasm: (a: number, b: number, c: number, d: number, e: any) => any;
41
+ export const create_issuer_warrant: (a: any) => any;
42
+ export const create_sample_warrant: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => any;
43
+ export const create_warrant_from_config: (a: any) => any;
44
+ export const decode_pem_chain_wasm: (a: number, b: number) => any;
45
+ export const decode_warrant: (a: number, b: number) => any;
46
+ export const evaluate_approval_gates: (a: number, b: number, c: number, d: number, e: any) => any;
47
+ export const generate_keypair: () => any;
48
+ export const parse_connect_token: (a: number, b: number) => any;
49
+ export const sign: (a: number, b: number, c: number, d: number, e: number, f: number, g: any) => any;
50
+ export const sign_receipt: (a: any, b: number, c: number) => any;
51
+ export const verify_approval_set: (a: number, b: number, c: number, d: number, e: any) => any;
52
+ export const verify_signed_approval: (a: number, b: number) => any;
53
+ export const verify_srl: (a: number, b: number, c: number, d: number) => any;
54
+ export const init_panic_hook: () => void;
55
+ export const sdkInspectApproval: (a: number, b: number) => [number, number, number];
56
+ export const sdkInspectRevocationList: (a: number, b: number) => [number, number, number];
57
+ 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];
58
+ export const sdkSignRevocationListVersioned: (a: any, b: number, c: number, d: number) => [number, number, number, number];
59
+ export const sdkcontext_approvalContextAttestation: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
60
+ export const sdkcontext_approvalRequest: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
61
+ export const sdkcontext_explain: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
62
+ export const sdkcontext_fromIssuerSecret: (a: number, b: number, c: any) => [number, number, number];
63
+ export const sdkcontext_issue: (a: number, b: number, c: any) => [number, number, number];
64
+ export const sdkcontext_mintExtended: (a: number, b: any) => [number, number, number];
65
+ export const sdkcontext_signRevocationListVersioned: (a: number, b: any, c: number) => [number, number, number, number];
51
66
  export const __wbindgen_malloc: (a: number, b: number) => number;
52
67
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
53
68
  export const __wbindgen_exn_store: (a: number) => void;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export type { AllowPolicy, ApprovalRequest, ConstraintExpr, CreateTenuoOptions, Decision, DevRoot, EmailConstraint, ExactConstraint, ExecuteOptions, MaxConstraint, McpAttachOptions, McpCallParams, McpHandlerPolicy, McpJsonRpcError, McpVerifyOptions, NarrowInput, NonceStore, OneOfConstraint, PatternConstraint, ProtectedTool, PublicKeyHandle, RequireApproval, Session, SessionAllow, SessionFromWireInput, SessionInput, Tenuo, TenuoErrorCode, TenuoMcp, TenuoMcpMeta, ToolLike, WarrantPart, ToolPolicy, UnderConstraint, } from "./api.ts";
1
+ export type { AllConstraint, AllowPolicy, AnyOfConstraint, ApprovalContextAttestation, ApprovalInfo, ApprovalRequest, ApprovalRequestSummary, ArgApprovalGate, CelConstraint, CidrConstraint, Clearance, ConstraintExpr, ContainsConstraint, ControlPlaneApprovalRequestV1, ControlPlaneApprovalResponseV1, CreateTenuoOptions, Decision, DevRoot, EmailConstraint, ExactConstraint, ExecuteOptions, ExplainedField, Explanation, IssueInput, IssuerKey, MaxConstraint, McpAttachOptions, McpCallParams, McpHandlerPolicy, McpJsonRpcError, McpVerifyOptions, MinConstraint, NarrowInput, NarrowOptions, NonceStore, NotConstraint, NotOneOfConstraint, OneOfConstraint, PatternConstraint, PresentedCall, ProtectedTool, PublicKeyHandle, RangeConstraint, ReceiptChainInfo, ReceiptInfo, RegexConstraint, RequireApproval, RevocationListInfo, RevocationListInput, Session, SessionAllow, SessionFromWireInput, SessionInfo, SessionInput, ShlexConstraint, SignApprovalOptions, SubsetConstraint, Tenuo, TenuoErrorCode, TenuoMcp, TenuoMcpMeta, ToolApprovalGate, ToolLike, ToolPolicy, UnderConstraint, UrlPatternConstraint, UrlSafeConstraint, WarrantPart, WildcardConstraint, } from "./api.ts";
2
2
  export { ApprovalRequiredError, AuthorizationDeniedError, TenuoConfigurationError, TenuoError, } from "./errors.ts";
3
- export { email, exact, max, oneOf, pattern, under } from "./constraints.ts";
3
+ export { all, anyOf, cel, cidr, contains, email, exact, max, min, not, notOneOf, oneOf, pattern, range, regex, shlex, subset, under, urlPattern, urlSafe, wildcard, } from "./constraints.ts";
4
4
  export { memoryNonceStore } from "./nonce.ts";
5
5
  export { Session as SessionHandle, isSession } from "./session.ts";
6
6
  export { createTenuo } from "./client.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,WAAW,EACX,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,eAAe,EACf,OAAO,EACP,YAAY,EACZ,oBAAoB,EACpB,YAAY,EACZ,KAAK,EACL,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,eAAe,GAChB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,aAAa,EACb,WAAW,EACX,eAAe,EACf,0BAA0B,EAC1B,YAAY,EACZ,eAAe,EACf,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AE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { ApprovalRequiredError, AuthorizationDeniedError, TenuoConfigurationError, TenuoError, } from "./errors.js";
2
- export { email, exact, max, oneOf, pattern, under } from "./constraints.js";
2
+ export { all, anyOf, cel, cidr, contains, email, exact, max, min, not, notOneOf, oneOf, pattern, range, regex, shlex, subset, under, urlPattern, urlSafe, wildcard, } from "./constraints.js";
3
3
  export { memoryNonceStore } from "./nonce.js";
4
4
  export { Session as SessionHandle, isSession } from "./session.js";
5
5
  export { createTenuo } from "./client.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqCA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwEA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,GAAG,EACH,KAAK,EACL,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,KAAK,EACL,GAAG,EACH,GAAG,EACH,GAAG,EACH,QAAQ,EACR,KAAK,EACL,OAAO,EACP,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAM,EACN,KAAK,EACL,UAAU,EACV,OAAO,EACP,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
package/dist/mcp.d.ts CHANGED
@@ -1,4 +1,20 @@
1
- import type { TenuoMcp } from "./api.ts";
1
+ import type { McpAttachOptions, McpVerifyOptions, PresentedCall, Session as SessionContract, TenuoMcp } from "./api.ts";
2
2
  import type { WasmContext, WasmDecision } from "./wasm.ts";
3
- export declare function createMcp(context: WasmContext, decide: (decision: WasmDecision, tool: string) => void): TenuoMcp;
3
+ export type Decide = (decision: WasmDecision, tool: string, native?: object, args?: Record<string, unknown>) => void;
4
+ /**
5
+ * Transport-agnostic half of `attach`: authorize locally, then sign
6
+ * proof-of-possession over the call. Shared by `tenuo.present()` and
7
+ * `tenuo.mcp.attach()`.
8
+ */
9
+ export declare function presentCall(context: WasmContext, decide: Decide, session: SessionContract, name: string, args: Readonly<Record<string, unknown>>, options: McpAttachOptions | undefined, label: string): {
10
+ readonly presented: PresentedCall;
11
+ readonly wireArgs: Record<string, unknown>;
12
+ };
13
+ /**
14
+ * Transport-agnostic half of `verify`: check a presented warrant chain and
15
+ * proof-of-possession, then apply the host ceiling. Shared by
16
+ * `tenuo.verify()` and `tenuo.mcp.verify()`.
17
+ */
18
+ export declare function verifyPresented(context: WasmContext, decide: Decide, presented: PresentedCall, name: string, args: Readonly<Record<string, unknown>>, options: McpVerifyOptions | undefined, label: string): Promise<Readonly<Record<string, unknown>>>;
19
+ export declare function createMcp(context: WasmContext, decide: Decide): TenuoMcp;
4
20
  //# sourceMappingURL=mcp.d.ts.map
package/dist/mcp.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.d.ts","sourceR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