@kya-os/checkpoint-wasm-runtime 1.5.1 → 1.6.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 +127 -0
- package/dist/engine-edge.d.mts +52 -16
- package/dist/engine-edge.d.ts +52 -16
- package/dist/engine-edge.js +11 -4
- package/dist/engine-edge.mjs +11 -4
- package/dist/index.d.mts +118 -1
- package/dist/index.d.ts +118 -1
- package/dist/orchestrator-edge.js +29 -13
- package/dist/orchestrator-edge.mjs +29 -13
- package/dist/orchestrator-node.js +18 -9
- package/dist/orchestrator-node.mjs +18 -9
- package/dist/orchestrator.d.mts +52 -16
- package/dist/orchestrator.d.ts +52 -16
- package/dist/orchestrator.js +29 -13
- package/dist/orchestrator.mjs +29 -13
- package/dist/policy.d.mts +148 -0
- package/dist/policy.d.ts +148 -0
- package/dist/policy.js +52 -0
- package/dist/policy.mjs +53 -0
- package/dist/reporter.d.mts +102 -0
- package/dist/reporter.d.ts +102 -0
- package/dist/reporter.js +125 -0
- package/dist/reporter.mjs +122 -0
- package/package.json +15 -5
- package/wasm/kya-os-engine/kya_os_engine_bg.wasm +0 -0
- package/wasm/kya-os-engine-bundler/kya_os_engine_bg.wasm +0 -0
- package/wasm/kya-os-engine-cedar/README.md +26 -0
- package/wasm/kya-os-engine-cedar/kya_os_engine.d.ts +77 -0
- package/wasm/kya-os-engine-cedar/kya_os_engine.js +636 -0
- package/wasm/kya-os-engine-cedar/kya_os_engine_bg.wasm +0 -0
- package/wasm/kya-os-engine-cedar/kya_os_engine_bg.wasm.d.ts +11 -0
- package/wasm/kya-os-engine-cedar/package.json +29 -0
- package/wasm/kya-os-engine-cedar-web/README.md +26 -0
- package/wasm/kya-os-engine-cedar-web/kya_os_engine.d.ts +117 -0
- package/wasm/kya-os-engine-cedar-web/kya_os_engine.js +694 -0
- package/wasm/kya-os-engine-cedar-web/kya_os_engine_bg.wasm +0 -0
- package/wasm/kya-os-engine-cedar-web/kya_os_engine_bg.wasm.d.ts +11 -0
- package/wasm/kya-os-engine-cedar-web/package.json +31 -0
- package/wasm/kya-os-engine-web/kya_os_engine_bg.wasm +0 -0
- package/wasm/agentshield_wasm.d.ts +0 -485
- package/wasm/agentshield_wasm.js +0 -1551
- package/wasm/agentshield_wasm_bg.wasm +0 -0
- package/wasm/agentshield_wasm_bg.wasm.d.ts +0 -97
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
|
|
3
|
+
let cachedUint8ArrayMemory0 = null;
|
|
4
|
+
|
|
5
|
+
function getUint8ArrayMemory0() {
|
|
6
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
7
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
8
|
+
}
|
|
9
|
+
return cachedUint8ArrayMemory0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
13
|
+
|
|
14
|
+
cachedTextDecoder.decode();
|
|
15
|
+
|
|
16
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
17
|
+
let numBytesDecoded = 0;
|
|
18
|
+
function decodeText(ptr, len) {
|
|
19
|
+
numBytesDecoded += len;
|
|
20
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
21
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
22
|
+
cachedTextDecoder.decode();
|
|
23
|
+
numBytesDecoded = len;
|
|
24
|
+
}
|
|
25
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function getStringFromWasm0(ptr, len) {
|
|
29
|
+
ptr = ptr >>> 0;
|
|
30
|
+
return decodeText(ptr, len);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let heap = new Array(128).fill(undefined);
|
|
34
|
+
|
|
35
|
+
heap.push(undefined, null, true, false);
|
|
36
|
+
|
|
37
|
+
let heap_next = heap.length;
|
|
38
|
+
|
|
39
|
+
function addHeapObject(obj) {
|
|
40
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
41
|
+
const idx = heap_next;
|
|
42
|
+
heap_next = heap[idx];
|
|
43
|
+
|
|
44
|
+
heap[idx] = obj;
|
|
45
|
+
return idx;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function getObject(idx) {
|
|
49
|
+
return heap[idx];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let WASM_VECTOR_LEN = 0;
|
|
53
|
+
|
|
54
|
+
const cachedTextEncoder = new TextEncoder();
|
|
55
|
+
|
|
56
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
57
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
58
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
59
|
+
view.set(buf);
|
|
60
|
+
return {
|
|
61
|
+
read: arg.length,
|
|
62
|
+
written: buf.length,
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
68
|
+
if (realloc === undefined) {
|
|
69
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
70
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
71
|
+
getUint8ArrayMemory0()
|
|
72
|
+
.subarray(ptr, ptr + buf.length)
|
|
73
|
+
.set(buf);
|
|
74
|
+
WASM_VECTOR_LEN = buf.length;
|
|
75
|
+
return ptr;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
let len = arg.length;
|
|
79
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
80
|
+
|
|
81
|
+
const mem = getUint8ArrayMemory0();
|
|
82
|
+
|
|
83
|
+
let offset = 0;
|
|
84
|
+
|
|
85
|
+
for (; offset < len; offset++) {
|
|
86
|
+
const code = arg.charCodeAt(offset);
|
|
87
|
+
if (code > 0x7f) break;
|
|
88
|
+
mem[ptr + offset] = code;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (offset !== len) {
|
|
92
|
+
if (offset !== 0) {
|
|
93
|
+
arg = arg.slice(offset);
|
|
94
|
+
}
|
|
95
|
+
ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;
|
|
96
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
97
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
98
|
+
|
|
99
|
+
offset += ret.written;
|
|
100
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
WASM_VECTOR_LEN = offset;
|
|
104
|
+
return ptr;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
let cachedDataViewMemory0 = null;
|
|
108
|
+
|
|
109
|
+
function getDataViewMemory0() {
|
|
110
|
+
if (
|
|
111
|
+
cachedDataViewMemory0 === null ||
|
|
112
|
+
cachedDataViewMemory0.buffer.detached === true ||
|
|
113
|
+
(cachedDataViewMemory0.buffer.detached === undefined &&
|
|
114
|
+
cachedDataViewMemory0.buffer !== wasm.memory.buffer)
|
|
115
|
+
) {
|
|
116
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
117
|
+
}
|
|
118
|
+
return cachedDataViewMemory0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function isLikeNone(x) {
|
|
122
|
+
return x === undefined || x === null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function debugString(val) {
|
|
126
|
+
// primitive types
|
|
127
|
+
const type = typeof val;
|
|
128
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
129
|
+
return `${val}`;
|
|
130
|
+
}
|
|
131
|
+
if (type == 'string') {
|
|
132
|
+
return `"${val}"`;
|
|
133
|
+
}
|
|
134
|
+
if (type == 'symbol') {
|
|
135
|
+
const description = val.description;
|
|
136
|
+
if (description == null) {
|
|
137
|
+
return 'Symbol';
|
|
138
|
+
} else {
|
|
139
|
+
return `Symbol(${description})`;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (type == 'function') {
|
|
143
|
+
const name = val.name;
|
|
144
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
145
|
+
return `Function(${name})`;
|
|
146
|
+
} else {
|
|
147
|
+
return 'Function';
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// objects
|
|
151
|
+
if (Array.isArray(val)) {
|
|
152
|
+
const length = val.length;
|
|
153
|
+
let debug = '[';
|
|
154
|
+
if (length > 0) {
|
|
155
|
+
debug += debugString(val[0]);
|
|
156
|
+
}
|
|
157
|
+
for (let i = 1; i < length; i++) {
|
|
158
|
+
debug += ', ' + debugString(val[i]);
|
|
159
|
+
}
|
|
160
|
+
debug += ']';
|
|
161
|
+
return debug;
|
|
162
|
+
}
|
|
163
|
+
// Test for built-in
|
|
164
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
165
|
+
let className;
|
|
166
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
167
|
+
className = builtInMatches[1];
|
|
168
|
+
} else {
|
|
169
|
+
// Failed to match the standard '[object ClassName]'
|
|
170
|
+
return toString.call(val);
|
|
171
|
+
}
|
|
172
|
+
if (className == 'Object') {
|
|
173
|
+
// we're a user defined class or Object
|
|
174
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
175
|
+
// easier than looping through ownProperties of `val`.
|
|
176
|
+
try {
|
|
177
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
178
|
+
} catch (_) {
|
|
179
|
+
return 'Object';
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// errors
|
|
183
|
+
if (val instanceof Error) {
|
|
184
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
185
|
+
}
|
|
186
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
187
|
+
return className;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function handleError(f, args) {
|
|
191
|
+
try {
|
|
192
|
+
return f.apply(this, args);
|
|
193
|
+
} catch (e) {
|
|
194
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
199
|
+
ptr = ptr >>> 0;
|
|
200
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function dropObject(idx) {
|
|
204
|
+
if (idx < 132) return;
|
|
205
|
+
heap[idx] = heap_next;
|
|
206
|
+
heap_next = idx;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function takeObject(idx) {
|
|
210
|
+
const ret = getObject(idx);
|
|
211
|
+
dropObject(idx);
|
|
212
|
+
return ret;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Cross-boundary `verify` wrapper. The JS host calls `engine.verify(input,
|
|
216
|
+
* ctxSpec)`; on success it gets a [`VerifyResult`] JSON object; on
|
|
217
|
+
* infrastructure failure (or malformed input) it gets a thrown JS error
|
|
218
|
+
* whose message names the failure mode.
|
|
219
|
+
*
|
|
220
|
+
* **Error semantics**:
|
|
221
|
+
*
|
|
222
|
+
* - Verification *verdicts* (Block/Challenge/etc.) surface inside the
|
|
223
|
+
* returned `VerifyResult` — they are not thrown.
|
|
224
|
+
* - Engine [`VerifyError`][crate::error::VerifyError] (resolver / cache /
|
|
225
|
+
* reputation / policy infra failures) surface as thrown JS errors.
|
|
226
|
+
* - Serde deserialisation failures (malformed JS input) surface as thrown
|
|
227
|
+
* JS errors too, mirroring the typed-vs-thrown split.
|
|
228
|
+
*
|
|
229
|
+
* # JS signature
|
|
230
|
+
*
|
|
231
|
+
* ```ts
|
|
232
|
+
* function verify(input: AgentRequest, ctx: ContextSpec): VerifyResult;
|
|
233
|
+
* ```
|
|
234
|
+
* @param {any} input_js
|
|
235
|
+
* @param {any} ctx_js
|
|
236
|
+
* @returns {any}
|
|
237
|
+
*/
|
|
238
|
+
export function verify(input_js, ctx_js) {
|
|
239
|
+
try {
|
|
240
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
241
|
+
wasm.verify(retptr, addHeapObject(input_js), addHeapObject(ctx_js));
|
|
242
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
243
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
244
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
245
|
+
if (r2) {
|
|
246
|
+
throw takeObject(r1);
|
|
247
|
+
}
|
|
248
|
+
return takeObject(r0);
|
|
249
|
+
} finally {
|
|
250
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const PolicyEvaluatorFinalization =
|
|
255
|
+
typeof FinalizationRegistry === 'undefined'
|
|
256
|
+
? { register: () => {}, unregister: () => {} }
|
|
257
|
+
: new FinalizationRegistry((ptr) => wasm.__wbg_policyevaluator_free(ptr >>> 0, 1));
|
|
258
|
+
/**
|
|
259
|
+
* Cross-boundary handle to a compiled Cedar policy bundle.
|
|
260
|
+
*
|
|
261
|
+
* Wraps a [`CedarPolicyEvaluator`] so a JS host can compile a tenant
|
|
262
|
+
* policy once and authorize many requests against it. Construction
|
|
263
|
+
* compiles the bundle; each [`authorize`][Self::authorize] call evaluates
|
|
264
|
+
* a single owned request and never re-parses policy text.
|
|
265
|
+
*/
|
|
266
|
+
export class PolicyEvaluator {
|
|
267
|
+
__destroy_into_raw() {
|
|
268
|
+
const ptr = this.__wbg_ptr;
|
|
269
|
+
this.__wbg_ptr = 0;
|
|
270
|
+
PolicyEvaluatorFinalization.unregister(this);
|
|
271
|
+
return ptr;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
free() {
|
|
275
|
+
const ptr = this.__destroy_into_raw();
|
|
276
|
+
wasm.__wbg_policyevaluator_free(ptr, 0);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Compile `policy_text` into a reusable evaluator.
|
|
280
|
+
*
|
|
281
|
+
* The Cedar policy bundle is parsed and compiled exactly once here;
|
|
282
|
+
* the resulting evaluator is held for the lifetime of the handle and
|
|
283
|
+
* reused by every [`authorize`][Self::authorize] call.
|
|
284
|
+
*
|
|
285
|
+
* # Errors
|
|
286
|
+
*
|
|
287
|
+
* Returns a thrown JS error whose message names the failure when
|
|
288
|
+
* `policy_text` is not syntactically valid Cedar
|
|
289
|
+
* ([`PolicyEvaluationError::Malformed`][crate::error::PolicyEvaluationError::Malformed]).
|
|
290
|
+
* A malformed bundle is an infrastructure fault surfaced at
|
|
291
|
+
* construction, never as a per-request deny.
|
|
292
|
+
* @param {string} policy_text
|
|
293
|
+
*/
|
|
294
|
+
constructor(policy_text) {
|
|
295
|
+
try {
|
|
296
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
297
|
+
const ptr0 = passStringToWasm0(policy_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
298
|
+
const len0 = WASM_VECTOR_LEN;
|
|
299
|
+
wasm.policyevaluator_new(retptr, ptr0, len0);
|
|
300
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
301
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
302
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
303
|
+
if (r2) {
|
|
304
|
+
throw takeObject(r1);
|
|
305
|
+
}
|
|
306
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
307
|
+
PolicyEvaluatorFinalization.register(this, this.__wbg_ptr, this);
|
|
308
|
+
return this;
|
|
309
|
+
} finally {
|
|
310
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Authorize one owned request against the compiled policy bundle.
|
|
315
|
+
*
|
|
316
|
+
* The JS host calls `evaluator.authorize(input)` with an
|
|
317
|
+
* [`AuthorizeInput`]-shaped object (camelCase keys); it gets back a
|
|
318
|
+
* [`Decision`][crate::types::Decision] JSON object. The evaluator owns
|
|
319
|
+
* the fail-closed posture — a request it cannot marshal, or one
|
|
320
|
+
* matching no `permit`, comes back as a
|
|
321
|
+
* [`Decision::Block`][crate::types::Decision::Block], not a thrown
|
|
322
|
+
* error.
|
|
323
|
+
*
|
|
324
|
+
* # Errors
|
|
325
|
+
*
|
|
326
|
+
* Returns a thrown JS error only for boundary faults: a malformed
|
|
327
|
+
* `input_js` that fails [`AuthorizeInput`] deserialisation, or a
|
|
328
|
+
* failure serialising the resulting `Decision`. Authorization
|
|
329
|
+
* *verdicts* never throw — they surface inside the returned value.
|
|
330
|
+
*
|
|
331
|
+
* # JS signature
|
|
332
|
+
*
|
|
333
|
+
* ```ts
|
|
334
|
+
* authorize(input: AuthorizeInput): Decision;
|
|
335
|
+
* ```
|
|
336
|
+
* @param {any} input_js
|
|
337
|
+
* @returns {any}
|
|
338
|
+
*/
|
|
339
|
+
authorize(input_js) {
|
|
340
|
+
try {
|
|
341
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
342
|
+
wasm.policyevaluator_authorize(retptr, this.__wbg_ptr, addHeapObject(input_js));
|
|
343
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
344
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
345
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
346
|
+
if (r2) {
|
|
347
|
+
throw takeObject(r1);
|
|
348
|
+
}
|
|
349
|
+
return takeObject(r0);
|
|
350
|
+
} finally {
|
|
351
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
if (Symbol.dispose) PolicyEvaluator.prototype[Symbol.dispose] = PolicyEvaluator.prototype.free;
|
|
356
|
+
|
|
357
|
+
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
358
|
+
|
|
359
|
+
async function __wbg_load(module, imports) {
|
|
360
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
361
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
362
|
+
try {
|
|
363
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
364
|
+
} catch (e) {
|
|
365
|
+
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
366
|
+
|
|
367
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
368
|
+
console.warn(
|
|
369
|
+
'`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n',
|
|
370
|
+
e
|
|
371
|
+
);
|
|
372
|
+
} else {
|
|
373
|
+
throw e;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
const bytes = await module.arrayBuffer();
|
|
379
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
380
|
+
} else {
|
|
381
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
382
|
+
|
|
383
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
384
|
+
return { instance, module };
|
|
385
|
+
} else {
|
|
386
|
+
return instance;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function __wbg_get_imports() {
|
|
392
|
+
const imports = {};
|
|
393
|
+
imports.wbg = {};
|
|
394
|
+
imports.wbg.__wbg_Error_e83987f665cf5504 = function (arg0, arg1) {
|
|
395
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
396
|
+
return addHeapObject(ret);
|
|
397
|
+
};
|
|
398
|
+
imports.wbg.__wbg_Number_bb48ca12f395cd08 = function (arg0) {
|
|
399
|
+
const ret = Number(getObject(arg0));
|
|
400
|
+
return ret;
|
|
401
|
+
};
|
|
402
|
+
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function (arg0, arg1) {
|
|
403
|
+
const ret = String(getObject(arg1));
|
|
404
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
405
|
+
const len1 = WASM_VECTOR_LEN;
|
|
406
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
407
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
408
|
+
};
|
|
409
|
+
imports.wbg.__wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd = function (arg0, arg1) {
|
|
410
|
+
const v = getObject(arg1);
|
|
411
|
+
const ret = typeof v === 'bigint' ? v : undefined;
|
|
412
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
413
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
414
|
+
};
|
|
415
|
+
imports.wbg.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function (arg0) {
|
|
416
|
+
const v = getObject(arg0);
|
|
417
|
+
const ret = typeof v === 'boolean' ? v : undefined;
|
|
418
|
+
return isLikeNone(ret) ? 0xffffff : ret ? 1 : 0;
|
|
419
|
+
};
|
|
420
|
+
imports.wbg.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function (arg0, arg1) {
|
|
421
|
+
const ret = debugString(getObject(arg1));
|
|
422
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
423
|
+
const len1 = WASM_VECTOR_LEN;
|
|
424
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
425
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
426
|
+
};
|
|
427
|
+
imports.wbg.__wbg___wbindgen_in_bb933bd9e1b3bc0f = function (arg0, arg1) {
|
|
428
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
429
|
+
return ret;
|
|
430
|
+
};
|
|
431
|
+
imports.wbg.__wbg___wbindgen_is_bigint_cb320707dcd35f0b = function (arg0) {
|
|
432
|
+
const ret = typeof getObject(arg0) === 'bigint';
|
|
433
|
+
return ret;
|
|
434
|
+
};
|
|
435
|
+
imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function (arg0) {
|
|
436
|
+
const ret = typeof getObject(arg0) === 'function';
|
|
437
|
+
return ret;
|
|
438
|
+
};
|
|
439
|
+
imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function (arg0) {
|
|
440
|
+
const val = getObject(arg0);
|
|
441
|
+
const ret = typeof val === 'object' && val !== null;
|
|
442
|
+
return ret;
|
|
443
|
+
};
|
|
444
|
+
imports.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd = function (arg0) {
|
|
445
|
+
const ret = typeof getObject(arg0) === 'string';
|
|
446
|
+
return ret;
|
|
447
|
+
};
|
|
448
|
+
imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function (arg0) {
|
|
449
|
+
const ret = getObject(arg0) === undefined;
|
|
450
|
+
return ret;
|
|
451
|
+
};
|
|
452
|
+
imports.wbg.__wbg___wbindgen_jsval_eq_6b13ab83478b1c50 = function (arg0, arg1) {
|
|
453
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
454
|
+
return ret;
|
|
455
|
+
};
|
|
456
|
+
imports.wbg.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147 = function (arg0, arg1) {
|
|
457
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
458
|
+
return ret;
|
|
459
|
+
};
|
|
460
|
+
imports.wbg.__wbg___wbindgen_number_get_a20bf9b85341449d = function (arg0, arg1) {
|
|
461
|
+
const obj = getObject(arg1);
|
|
462
|
+
const ret = typeof obj === 'number' ? obj : undefined;
|
|
463
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
464
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
465
|
+
};
|
|
466
|
+
imports.wbg.__wbg___wbindgen_string_get_e4f06c90489ad01b = function (arg0, arg1) {
|
|
467
|
+
const obj = getObject(arg1);
|
|
468
|
+
const ret = typeof obj === 'string' ? obj : undefined;
|
|
469
|
+
var ptr1 = isLikeNone(ret)
|
|
470
|
+
? 0
|
|
471
|
+
: passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
472
|
+
var len1 = WASM_VECTOR_LEN;
|
|
473
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
474
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
475
|
+
};
|
|
476
|
+
imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function (arg0, arg1) {
|
|
477
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
478
|
+
};
|
|
479
|
+
imports.wbg.__wbg_call_e762c39fa8ea36bf = function () {
|
|
480
|
+
return handleError(function (arg0, arg1) {
|
|
481
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
482
|
+
return addHeapObject(ret);
|
|
483
|
+
}, arguments);
|
|
484
|
+
};
|
|
485
|
+
imports.wbg.__wbg_done_2042aa2670fb1db1 = function (arg0) {
|
|
486
|
+
const ret = getObject(arg0).done;
|
|
487
|
+
return ret;
|
|
488
|
+
};
|
|
489
|
+
imports.wbg.__wbg_entries_e171b586f8f6bdbf = function (arg0) {
|
|
490
|
+
const ret = Object.entries(getObject(arg0));
|
|
491
|
+
return addHeapObject(ret);
|
|
492
|
+
};
|
|
493
|
+
imports.wbg.__wbg_get_7bed016f185add81 = function (arg0, arg1) {
|
|
494
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
495
|
+
return addHeapObject(ret);
|
|
496
|
+
};
|
|
497
|
+
imports.wbg.__wbg_get_efcb449f58ec27c2 = function () {
|
|
498
|
+
return handleError(function (arg0, arg1) {
|
|
499
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
500
|
+
return addHeapObject(ret);
|
|
501
|
+
}, arguments);
|
|
502
|
+
};
|
|
503
|
+
imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function (arg0, arg1) {
|
|
504
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
505
|
+
return addHeapObject(ret);
|
|
506
|
+
};
|
|
507
|
+
imports.wbg.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function (arg0) {
|
|
508
|
+
let result;
|
|
509
|
+
try {
|
|
510
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
511
|
+
} catch (_) {
|
|
512
|
+
result = false;
|
|
513
|
+
}
|
|
514
|
+
const ret = result;
|
|
515
|
+
return ret;
|
|
516
|
+
};
|
|
517
|
+
imports.wbg.__wbg_instanceof_Map_8579b5e2ab5437c7 = function (arg0) {
|
|
518
|
+
let result;
|
|
519
|
+
try {
|
|
520
|
+
result = getObject(arg0) instanceof Map;
|
|
521
|
+
} catch (_) {
|
|
522
|
+
result = false;
|
|
523
|
+
}
|
|
524
|
+
const ret = result;
|
|
525
|
+
return ret;
|
|
526
|
+
};
|
|
527
|
+
imports.wbg.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function (arg0) {
|
|
528
|
+
let result;
|
|
529
|
+
try {
|
|
530
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
531
|
+
} catch (_) {
|
|
532
|
+
result = false;
|
|
533
|
+
}
|
|
534
|
+
const ret = result;
|
|
535
|
+
return ret;
|
|
536
|
+
};
|
|
537
|
+
imports.wbg.__wbg_isArray_96e0af9891d0945d = function (arg0) {
|
|
538
|
+
const ret = Array.isArray(getObject(arg0));
|
|
539
|
+
return ret;
|
|
540
|
+
};
|
|
541
|
+
imports.wbg.__wbg_isSafeInteger_d216eda7911dde36 = function (arg0) {
|
|
542
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
543
|
+
return ret;
|
|
544
|
+
};
|
|
545
|
+
imports.wbg.__wbg_iterator_e5822695327a3c39 = function () {
|
|
546
|
+
const ret = Symbol.iterator;
|
|
547
|
+
return addHeapObject(ret);
|
|
548
|
+
};
|
|
549
|
+
imports.wbg.__wbg_length_69bca3cb64fc8748 = function (arg0) {
|
|
550
|
+
const ret = getObject(arg0).length;
|
|
551
|
+
return ret;
|
|
552
|
+
};
|
|
553
|
+
imports.wbg.__wbg_length_cdd215e10d9dd507 = function (arg0) {
|
|
554
|
+
const ret = getObject(arg0).length;
|
|
555
|
+
return ret;
|
|
556
|
+
};
|
|
557
|
+
imports.wbg.__wbg_new_1acc0b6eea89d040 = function () {
|
|
558
|
+
const ret = new Object();
|
|
559
|
+
return addHeapObject(ret);
|
|
560
|
+
};
|
|
561
|
+
imports.wbg.__wbg_new_5a79be3ab53b8aa5 = function (arg0) {
|
|
562
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
563
|
+
return addHeapObject(ret);
|
|
564
|
+
};
|
|
565
|
+
imports.wbg.__wbg_new_68651c719dcda04e = function () {
|
|
566
|
+
const ret = new Map();
|
|
567
|
+
return addHeapObject(ret);
|
|
568
|
+
};
|
|
569
|
+
imports.wbg.__wbg_new_e17d9f43105b08be = function () {
|
|
570
|
+
const ret = new Array();
|
|
571
|
+
return addHeapObject(ret);
|
|
572
|
+
};
|
|
573
|
+
imports.wbg.__wbg_next_020810e0ae8ebcb0 = function () {
|
|
574
|
+
return handleError(function (arg0) {
|
|
575
|
+
const ret = getObject(arg0).next();
|
|
576
|
+
return addHeapObject(ret);
|
|
577
|
+
}, arguments);
|
|
578
|
+
};
|
|
579
|
+
imports.wbg.__wbg_next_2c826fe5dfec6b6a = function (arg0) {
|
|
580
|
+
const ret = getObject(arg0).next;
|
|
581
|
+
return addHeapObject(ret);
|
|
582
|
+
};
|
|
583
|
+
imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function (arg0, arg1, arg2) {
|
|
584
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
585
|
+
};
|
|
586
|
+
imports.wbg.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
|
|
587
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
588
|
+
};
|
|
589
|
+
imports.wbg.__wbg_set_907fb406c34a251d = function (arg0, arg1, arg2) {
|
|
590
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
591
|
+
return addHeapObject(ret);
|
|
592
|
+
};
|
|
593
|
+
imports.wbg.__wbg_set_c213c871859d6500 = function (arg0, arg1, arg2) {
|
|
594
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
595
|
+
};
|
|
596
|
+
imports.wbg.__wbg_value_692627309814bb8c = function (arg0) {
|
|
597
|
+
const ret = getObject(arg0).value;
|
|
598
|
+
return addHeapObject(ret);
|
|
599
|
+
};
|
|
600
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
|
|
601
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
602
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
603
|
+
return addHeapObject(ret);
|
|
604
|
+
};
|
|
605
|
+
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function (arg0) {
|
|
606
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
607
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
608
|
+
return addHeapObject(ret);
|
|
609
|
+
};
|
|
610
|
+
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function (arg0) {
|
|
611
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
612
|
+
const ret = arg0;
|
|
613
|
+
return addHeapObject(ret);
|
|
614
|
+
};
|
|
615
|
+
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function (arg0) {
|
|
616
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
617
|
+
const ret = arg0;
|
|
618
|
+
return addHeapObject(ret);
|
|
619
|
+
};
|
|
620
|
+
imports.wbg.__wbindgen_object_clone_ref = function (arg0) {
|
|
621
|
+
const ret = getObject(arg0);
|
|
622
|
+
return addHeapObject(ret);
|
|
623
|
+
};
|
|
624
|
+
imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
|
|
625
|
+
takeObject(arg0);
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
return imports;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
function __wbg_finalize_init(instance, module) {
|
|
632
|
+
wasm = instance.exports;
|
|
633
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
634
|
+
cachedDataViewMemory0 = null;
|
|
635
|
+
cachedUint8ArrayMemory0 = null;
|
|
636
|
+
|
|
637
|
+
return wasm;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
function initSync(module) {
|
|
641
|
+
if (wasm !== undefined) return wasm;
|
|
642
|
+
|
|
643
|
+
if (typeof module !== 'undefined') {
|
|
644
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
645
|
+
({ module } = module);
|
|
646
|
+
} else {
|
|
647
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead');
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
const imports = __wbg_get_imports();
|
|
652
|
+
|
|
653
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
654
|
+
module = new WebAssembly.Module(module);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
658
|
+
|
|
659
|
+
return __wbg_finalize_init(instance, module);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
async function __wbg_init(module_or_path) {
|
|
663
|
+
if (wasm !== undefined) return wasm;
|
|
664
|
+
|
|
665
|
+
if (typeof module_or_path !== 'undefined') {
|
|
666
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
667
|
+
({ module_or_path } = module_or_path);
|
|
668
|
+
} else {
|
|
669
|
+
console.warn(
|
|
670
|
+
'using deprecated parameters for the initialization function; pass a single object instead'
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
if (typeof module_or_path === 'undefined') {
|
|
676
|
+
module_or_path = new URL('kya_os_engine_bg.wasm', import.meta.url);
|
|
677
|
+
}
|
|
678
|
+
const imports = __wbg_get_imports();
|
|
679
|
+
|
|
680
|
+
if (
|
|
681
|
+
typeof module_or_path === 'string' ||
|
|
682
|
+
(typeof Request === 'function' && module_or_path instanceof Request) ||
|
|
683
|
+
(typeof URL === 'function' && module_or_path instanceof URL)
|
|
684
|
+
) {
|
|
685
|
+
module_or_path = fetch(module_or_path);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
689
|
+
|
|
690
|
+
return __wbg_finalize_init(instance, module);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
export { initSync };
|
|
694
|
+
export default __wbg_init;
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_policyevaluator_free: (a: number, b: number) => void;
|
|
5
|
+
export const policyevaluator_authorize: (a: number, b: number, c: number) => void;
|
|
6
|
+
export const policyevaluator_new: (a: number, b: number, c: number) => void;
|
|
7
|
+
export const verify: (a: number, b: number, c: number) => void;
|
|
8
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
9
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
10
|
+
export const __wbindgen_export3: (a: number) => void;
|
|
11
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|