@kya-os/agentshield-nextjs 0.2.9 → 0.2.11
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/dist/api-client.d.mts +41 -1
- package/dist/api-client.d.ts +41 -1
- package/dist/api-client.js +64 -0
- package/dist/api-client.js.map +1 -1
- package/dist/api-client.mjs +64 -0
- package/dist/api-client.mjs.map +1 -1
- package/dist/api-middleware.js +100 -14
- package/dist/api-middleware.js.map +1 -1
- package/dist/api-middleware.mjs +100 -14
- package/dist/api-middleware.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +100 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +100 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -21
- package/wasm/agentshield_wasm.d.ts +379 -21
- package/wasm/agentshield_wasm.js +1409 -506
- package/wasm/agentshield_wasm_bg.wasm +0 -0
- package/dist/.tsbuildinfo +0 -1
package/wasm/agentshield_wasm.js
CHANGED
|
@@ -1,136 +1,149 @@
|
|
|
1
1
|
let wasm;
|
|
2
2
|
|
|
3
|
-
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
4
|
-
|
|
5
|
-
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
6
|
-
|
|
7
3
|
let cachedUint8ArrayMemory0 = null;
|
|
8
4
|
|
|
9
5
|
function getUint8ArrayMemory0() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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));
|
|
14
26
|
}
|
|
15
27
|
|
|
16
28
|
function getStringFromWasm0(ptr, len) {
|
|
17
|
-
|
|
18
|
-
|
|
29
|
+
ptr = ptr >>> 0;
|
|
30
|
+
return decodeText(ptr, len);
|
|
19
31
|
}
|
|
20
32
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return e instanceof Error ? `${e.message}\n\nStack:\n${e.stack}` : e.toString();
|
|
28
|
-
} catch(_) {
|
|
29
|
-
return "<failed to stringify thrown value>";
|
|
30
|
-
}
|
|
31
|
-
}());
|
|
32
|
-
console.error("wasm-bindgen: imported JS function that was not marked as `catch` threw an error:", error);
|
|
33
|
-
throw e;
|
|
34
|
-
}
|
|
33
|
+
let heap = new Array(128).fill(undefined);
|
|
34
|
+
|
|
35
|
+
heap.push(undefined, null, true, false);
|
|
36
|
+
|
|
37
|
+
function getObject(idx) {
|
|
38
|
+
return heap[idx];
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
let
|
|
41
|
+
let heap_next = heap.length;
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
function addHeapObject(obj) {
|
|
44
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
45
|
+
const idx = heap_next;
|
|
46
|
+
heap_next = heap[idx];
|
|
40
47
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
48
|
+
heap[idx] = obj;
|
|
49
|
+
return idx;
|
|
44
50
|
}
|
|
45
|
-
|
|
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) {
|
|
46
58
|
const buf = cachedTextEncoder.encode(arg);
|
|
47
59
|
view.set(buf);
|
|
48
60
|
return {
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
read: arg.length,
|
|
62
|
+
written: buf.length,
|
|
51
63
|
};
|
|
52
|
-
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
53
66
|
|
|
54
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
|
+
}
|
|
55
77
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (realloc === undefined) {
|
|
59
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
60
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
61
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
62
|
-
WASM_VECTOR_LEN = buf.length;
|
|
63
|
-
return ptr;
|
|
64
|
-
}
|
|
78
|
+
let len = arg.length;
|
|
79
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
65
80
|
|
|
66
|
-
|
|
67
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
81
|
+
const mem = getUint8ArrayMemory0();
|
|
68
82
|
|
|
69
|
-
|
|
83
|
+
let offset = 0;
|
|
70
84
|
|
|
71
|
-
|
|
85
|
+
for (; offset < len; offset++) {
|
|
86
|
+
const code = arg.charCodeAt(offset);
|
|
87
|
+
if (code > 0x7f) break;
|
|
88
|
+
mem[ptr + offset] = code;
|
|
89
|
+
}
|
|
72
90
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
mem[ptr + offset] = code;
|
|
91
|
+
if (offset !== len) {
|
|
92
|
+
if (offset !== 0) {
|
|
93
|
+
arg = arg.slice(offset);
|
|
77
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);
|
|
78
98
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
84
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
85
|
-
const ret = encodeString(arg, view);
|
|
86
|
-
if (ret.read !== arg.length) throw new Error('failed to pass whole string');
|
|
87
|
-
offset += ret.written;
|
|
88
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
89
|
-
}
|
|
99
|
+
offset += ret.written;
|
|
100
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
101
|
+
}
|
|
90
102
|
|
|
91
|
-
|
|
92
|
-
|
|
103
|
+
WASM_VECTOR_LEN = offset;
|
|
104
|
+
return ptr;
|
|
93
105
|
}
|
|
94
106
|
|
|
95
107
|
let cachedDataViewMemory0 = null;
|
|
96
108
|
|
|
97
109
|
function getDataViewMemory0() {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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;
|
|
102
119
|
}
|
|
103
120
|
|
|
104
|
-
function
|
|
105
|
-
|
|
121
|
+
function dropObject(idx) {
|
|
122
|
+
if (idx < 132) return;
|
|
123
|
+
heap[idx] = heap_next;
|
|
124
|
+
heap_next = idx;
|
|
106
125
|
}
|
|
107
126
|
|
|
108
|
-
function
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
127
|
+
function takeObject(idx) {
|
|
128
|
+
const ret = getObject(idx);
|
|
129
|
+
dropObject(idx);
|
|
130
|
+
return ret;
|
|
112
131
|
}
|
|
113
132
|
|
|
114
133
|
function isLikeNone(x) {
|
|
115
|
-
|
|
134
|
+
return x === undefined || x === null;
|
|
116
135
|
}
|
|
117
136
|
/**
|
|
118
137
|
* Initialize the AgentShield WASM module
|
|
119
138
|
*/
|
|
120
139
|
export function init() {
|
|
121
|
-
|
|
140
|
+
wasm.init();
|
|
122
141
|
}
|
|
123
142
|
|
|
124
143
|
function _assertClass(instance, klass) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function takeFromExternrefTable0(idx) {
|
|
131
|
-
const value = wasm.__wbindgen_export_3.get(idx);
|
|
132
|
-
wasm.__externref_table_dealloc(idx);
|
|
133
|
-
return value;
|
|
144
|
+
if (!(instance instanceof klass)) {
|
|
145
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
146
|
+
}
|
|
134
147
|
}
|
|
135
148
|
/**
|
|
136
149
|
* Analyze a request and detect if it's from an agent
|
|
@@ -138,15 +151,20 @@ function takeFromExternrefTable0(idx) {
|
|
|
138
151
|
* @returns {JsDetectionResult}
|
|
139
152
|
*/
|
|
140
153
|
export function detect_agent(metadata) {
|
|
154
|
+
try {
|
|
155
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
141
156
|
_assertClass(metadata, JsRequestMetadata);
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (
|
|
147
|
-
|
|
157
|
+
wasm.detect_agent(retptr, metadata.__wbg_ptr);
|
|
158
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
159
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
160
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
161
|
+
if (r2) {
|
|
162
|
+
throw takeObject(r1);
|
|
148
163
|
}
|
|
149
|
-
return JsDetectionResult.__wrap(
|
|
164
|
+
return JsDetectionResult.__wrap(r0);
|
|
165
|
+
} finally {
|
|
166
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
167
|
+
}
|
|
150
168
|
}
|
|
151
169
|
|
|
152
170
|
/**
|
|
@@ -154,479 +172,1364 @@ export function detect_agent(metadata) {
|
|
|
154
172
|
* @returns {string}
|
|
155
173
|
*/
|
|
156
174
|
export function version() {
|
|
175
|
+
let deferred1_0;
|
|
176
|
+
let deferred1_1;
|
|
177
|
+
try {
|
|
178
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
179
|
+
wasm.get_version(retptr);
|
|
180
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
181
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
182
|
+
deferred1_0 = r0;
|
|
183
|
+
deferred1_1 = r1;
|
|
184
|
+
return getStringFromWasm0(r0, r1);
|
|
185
|
+
} finally {
|
|
186
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
187
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Get the version of the AgentShield library
|
|
193
|
+
* @returns {string}
|
|
194
|
+
*/
|
|
195
|
+
export function get_version() {
|
|
196
|
+
let deferred1_0;
|
|
197
|
+
let deferred1_1;
|
|
198
|
+
try {
|
|
199
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
200
|
+
wasm.get_version(retptr);
|
|
201
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
202
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
203
|
+
deferred1_0 = r0;
|
|
204
|
+
deferred1_1 = r1;
|
|
205
|
+
return getStringFromWasm0(r0, r1);
|
|
206
|
+
} finally {
|
|
207
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
208
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Get build information
|
|
214
|
+
* @returns {string}
|
|
215
|
+
*/
|
|
216
|
+
export function get_build_info() {
|
|
217
|
+
let deferred1_0;
|
|
218
|
+
let deferred1_1;
|
|
219
|
+
try {
|
|
220
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
221
|
+
wasm.get_build_info(retptr);
|
|
222
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
223
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
224
|
+
deferred1_0 = r0;
|
|
225
|
+
deferred1_1 = r1;
|
|
226
|
+
return getStringFromWasm0(r0, r1);
|
|
227
|
+
} finally {
|
|
228
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
229
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Verify an MCP-I proof (VC-JWT token)
|
|
235
|
+
*
|
|
236
|
+
* This function verifies a Verifiable Credential JWT and extracts the
|
|
237
|
+
* principal (issuer) and agent (subject) DIDs.
|
|
238
|
+
*
|
|
239
|
+
* # Arguments
|
|
240
|
+
*
|
|
241
|
+
* * `vc_jwt` - The VC-JWT token string (header.payload.signature)
|
|
242
|
+
* * `current_time_secs` - Current Unix timestamp in seconds (for expiration check)
|
|
243
|
+
*
|
|
244
|
+
* # Returns
|
|
245
|
+
*
|
|
246
|
+
* A `JsMcpIVerificationResult` with verification status and extracted DIDs.
|
|
247
|
+
* @param {string} vc_jwt
|
|
248
|
+
* @param {bigint} current_time_secs
|
|
249
|
+
* @returns {JsMcpIVerificationResult}
|
|
250
|
+
*/
|
|
251
|
+
export function verify_mcp_i_proof(vc_jwt, current_time_secs) {
|
|
252
|
+
const ptr0 = passStringToWasm0(vc_jwt, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
253
|
+
const len0 = WASM_VECTOR_LEN;
|
|
254
|
+
const ret = wasm.verify_mcp_i_proof(ptr0, len0, current_time_secs);
|
|
255
|
+
return JsMcpIVerificationResult.__wrap(ret);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Resolve a did:key identifier to its public key
|
|
260
|
+
*
|
|
261
|
+
* # Arguments
|
|
262
|
+
*
|
|
263
|
+
* * `did` - The did:key identifier (e.g., "did:key:z6Mkf...")
|
|
264
|
+
*
|
|
265
|
+
* # Returns
|
|
266
|
+
*
|
|
267
|
+
* A `JsDidKeyResult` with the resolved public key or an error.
|
|
268
|
+
* @param {string} did
|
|
269
|
+
* @returns {JsDidKeyResult}
|
|
270
|
+
*/
|
|
271
|
+
export function resolve_did_key_wasm(did) {
|
|
272
|
+
const ptr0 = passStringToWasm0(did, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
273
|
+
const len0 = WASM_VECTOR_LEN;
|
|
274
|
+
const ret = wasm.resolve_did_key_wasm(ptr0, len0);
|
|
275
|
+
return JsDidKeyResult.__wrap(ret);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Check if a requested scope is permitted by granted scopes
|
|
280
|
+
*
|
|
281
|
+
* # Arguments
|
|
282
|
+
*
|
|
283
|
+
* * `requested` - The scope being requested (e.g., "read:email")
|
|
284
|
+
* * `granted_json` - JSON array of granted scopes (e.g., "[\"read:*\", \"write:calendar\"]")
|
|
285
|
+
*
|
|
286
|
+
* # Returns
|
|
287
|
+
*
|
|
288
|
+
* A `JsScopeCheckResult` indicating whether the scope is permitted.
|
|
289
|
+
* @param {string} requested
|
|
290
|
+
* @param {string} granted_json
|
|
291
|
+
* @returns {JsScopeCheckResult}
|
|
292
|
+
*/
|
|
293
|
+
export function check_delegation_scope(requested, granted_json) {
|
|
294
|
+
const ptr0 = passStringToWasm0(requested, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
295
|
+
const len0 = WASM_VECTOR_LEN;
|
|
296
|
+
const ptr1 = passStringToWasm0(granted_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
297
|
+
const len1 = WASM_VECTOR_LEN;
|
|
298
|
+
const ret = wasm.check_delegation_scope(ptr0, len0, ptr1, len1);
|
|
299
|
+
return JsScopeCheckResult.__wrap(ret);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Verify a delegation with time constraints
|
|
304
|
+
*
|
|
305
|
+
* # Arguments
|
|
306
|
+
*
|
|
307
|
+
* * `requested` - The scope being requested
|
|
308
|
+
* * `granted_json` - JSON array of granted scopes
|
|
309
|
+
* * `not_before` - Optional Unix timestamp (0 to skip)
|
|
310
|
+
* * `not_after` - Optional Unix timestamp (0 to skip)
|
|
311
|
+
* * `current_time` - Current Unix timestamp (0 to skip time checks)
|
|
312
|
+
*
|
|
313
|
+
* # Returns
|
|
314
|
+
*
|
|
315
|
+
* A `JsScopeCheckResult` indicating whether the delegation is valid.
|
|
316
|
+
* @param {string} requested
|
|
317
|
+
* @param {string} granted_json
|
|
318
|
+
* @param {bigint} not_before
|
|
319
|
+
* @param {bigint} not_after
|
|
320
|
+
* @param {bigint} current_time
|
|
321
|
+
* @returns {JsScopeCheckResult}
|
|
322
|
+
*/
|
|
323
|
+
export function verify_delegation_scope(
|
|
324
|
+
requested,
|
|
325
|
+
granted_json,
|
|
326
|
+
not_before,
|
|
327
|
+
not_after,
|
|
328
|
+
current_time
|
|
329
|
+
) {
|
|
330
|
+
const ptr0 = passStringToWasm0(requested, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
331
|
+
const len0 = WASM_VECTOR_LEN;
|
|
332
|
+
const ptr1 = passStringToWasm0(granted_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
333
|
+
const len1 = WASM_VECTOR_LEN;
|
|
334
|
+
const ret = wasm.verify_delegation_scope(
|
|
335
|
+
ptr0,
|
|
336
|
+
len0,
|
|
337
|
+
ptr1,
|
|
338
|
+
len1,
|
|
339
|
+
not_before,
|
|
340
|
+
not_after,
|
|
341
|
+
current_time
|
|
342
|
+
);
|
|
343
|
+
return JsScopeCheckResult.__wrap(ret);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Evaluate a request against a policy configuration
|
|
348
|
+
*
|
|
349
|
+
* # Arguments
|
|
350
|
+
*
|
|
351
|
+
* * `policy_json` - Policy configuration as JSON string
|
|
352
|
+
* * `context_json` - Evaluation context as JSON string
|
|
353
|
+
*
|
|
354
|
+
* # Returns
|
|
355
|
+
*
|
|
356
|
+
* A `JsPolicyEvaluationResult` with the enforcement action and reason.
|
|
357
|
+
*
|
|
358
|
+
* # Example
|
|
359
|
+
*
|
|
360
|
+
* ```javascript
|
|
361
|
+
* const policy = JSON.stringify({
|
|
362
|
+
* version: "1.0.0",
|
|
363
|
+
* enabled: true,
|
|
364
|
+
* defaultAction: "allow",
|
|
365
|
+
* thresholds: { confidenceThreshold: 80, confidenceAction: "block" },
|
|
366
|
+
* denyList: [],
|
|
367
|
+
* allowList: [],
|
|
368
|
+
* rules: []
|
|
369
|
+
* });
|
|
370
|
+
*
|
|
371
|
+
* const context = JSON.stringify({
|
|
372
|
+
* agentType: "ai_agent",
|
|
373
|
+
* agentName: "ChatGPT",
|
|
374
|
+
* confidence: 95
|
|
375
|
+
* });
|
|
376
|
+
*
|
|
377
|
+
* const result = evaluate_policy(policy, context);
|
|
378
|
+
* console.log(result.action); // "block" (confidence exceeded threshold)
|
|
379
|
+
* ```
|
|
380
|
+
* @param {string} policy_json
|
|
381
|
+
* @param {string} context_json
|
|
382
|
+
* @returns {JsPolicyEvaluationResult}
|
|
383
|
+
*/
|
|
384
|
+
export function evaluate_policy(policy_json, context_json) {
|
|
385
|
+
try {
|
|
386
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
387
|
+
const ptr0 = passStringToWasm0(policy_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
388
|
+
const len0 = WASM_VECTOR_LEN;
|
|
389
|
+
const ptr1 = passStringToWasm0(context_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
390
|
+
const len1 = WASM_VECTOR_LEN;
|
|
391
|
+
wasm.evaluate_policy(retptr, ptr0, len0, ptr1, len1);
|
|
392
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
393
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
394
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
395
|
+
if (r2) {
|
|
396
|
+
throw takeObject(r1);
|
|
397
|
+
}
|
|
398
|
+
return JsPolicyEvaluationResult.__wrap(r0);
|
|
399
|
+
} finally {
|
|
400
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Check if a policy allows a request (convenience function)
|
|
406
|
+
*
|
|
407
|
+
* # Arguments
|
|
408
|
+
*
|
|
409
|
+
* * `policy_json` - Policy configuration as JSON string
|
|
410
|
+
* * `context_json` - Evaluation context as JSON string
|
|
411
|
+
*
|
|
412
|
+
* # Returns
|
|
413
|
+
*
|
|
414
|
+
* `true` if the request is allowed, `false` otherwise.
|
|
415
|
+
* @param {string} policy_json
|
|
416
|
+
* @param {string} context_json
|
|
417
|
+
* @returns {boolean}
|
|
418
|
+
*/
|
|
419
|
+
export function policy_allows(policy_json, context_json) {
|
|
420
|
+
const ptr0 = passStringToWasm0(policy_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
421
|
+
const len0 = WASM_VECTOR_LEN;
|
|
422
|
+
const ptr1 = passStringToWasm0(context_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
423
|
+
const len1 = WASM_VECTOR_LEN;
|
|
424
|
+
const ret = wasm.policy_allows(ptr0, len0, ptr1, len1);
|
|
425
|
+
return ret !== 0;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
const JsDetectionResultFinalization =
|
|
429
|
+
typeof FinalizationRegistry === 'undefined'
|
|
430
|
+
? { register: () => {}, unregister: () => {} }
|
|
431
|
+
: new FinalizationRegistry((ptr) => wasm.__wbg_jsdetectionresult_free(ptr >>> 0, 1));
|
|
432
|
+
/**
|
|
433
|
+
* JavaScript-compatible detection result
|
|
434
|
+
*/
|
|
435
|
+
export class JsDetectionResult {
|
|
436
|
+
static __wrap(ptr) {
|
|
437
|
+
ptr = ptr >>> 0;
|
|
438
|
+
const obj = Object.create(JsDetectionResult.prototype);
|
|
439
|
+
obj.__wbg_ptr = ptr;
|
|
440
|
+
JsDetectionResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
441
|
+
return obj;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
__destroy_into_raw() {
|
|
445
|
+
const ptr = this.__wbg_ptr;
|
|
446
|
+
this.__wbg_ptr = 0;
|
|
447
|
+
JsDetectionResultFinalization.unregister(this);
|
|
448
|
+
return ptr;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
free() {
|
|
452
|
+
const ptr = this.__destroy_into_raw();
|
|
453
|
+
wasm.__wbg_jsdetectionresult_free(ptr, 0);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Whether the request was identified as coming from an agent
|
|
457
|
+
* @returns {boolean}
|
|
458
|
+
*/
|
|
459
|
+
get is_agent() {
|
|
460
|
+
const ret = wasm.__wbg_get_jsdetectionresult_is_agent(this.__wbg_ptr);
|
|
461
|
+
return ret !== 0;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Whether the request was identified as coming from an agent
|
|
465
|
+
* @param {boolean} arg0
|
|
466
|
+
*/
|
|
467
|
+
set is_agent(arg0) {
|
|
468
|
+
wasm.__wbg_set_jsdetectionresult_is_agent(this.__wbg_ptr, arg0);
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Confidence score (0.0 to 1.0 scale)
|
|
472
|
+
* @returns {number}
|
|
473
|
+
*/
|
|
474
|
+
get confidence() {
|
|
475
|
+
const ret = wasm.__wbg_get_jsdetectionresult_confidence(this.__wbg_ptr);
|
|
476
|
+
return ret;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Confidence score (0.0 to 1.0 scale)
|
|
480
|
+
* @param {number} arg0
|
|
481
|
+
*/
|
|
482
|
+
set confidence(arg0) {
|
|
483
|
+
wasm.__wbg_set_jsdetectionresult_confidence(this.__wbg_ptr, arg0);
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Get the detected agent name
|
|
487
|
+
* @returns {string | undefined}
|
|
488
|
+
*/
|
|
489
|
+
get agent() {
|
|
490
|
+
try {
|
|
491
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
492
|
+
wasm.jsdetectionresult_agent(retptr, this.__wbg_ptr);
|
|
493
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
494
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
495
|
+
let v1;
|
|
496
|
+
if (r0 !== 0) {
|
|
497
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
498
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
499
|
+
}
|
|
500
|
+
return v1;
|
|
501
|
+
} finally {
|
|
502
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Get the detection class for database storage
|
|
507
|
+
* Returns: 'human', 'ai_agent', 'bot', 'automation', or 'unknown'
|
|
508
|
+
* @returns {string}
|
|
509
|
+
*/
|
|
510
|
+
get detection_class() {
|
|
511
|
+
let deferred1_0;
|
|
512
|
+
let deferred1_1;
|
|
513
|
+
try {
|
|
514
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
515
|
+
wasm.jsdetectionresult_detection_class(retptr, this.__wbg_ptr);
|
|
516
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
517
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
518
|
+
deferred1_0 = r0;
|
|
519
|
+
deferred1_1 = r1;
|
|
520
|
+
return getStringFromWasm0(r0, r1);
|
|
521
|
+
} finally {
|
|
522
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
523
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Get the verification method as a string
|
|
528
|
+
* @returns {string}
|
|
529
|
+
*/
|
|
530
|
+
get verification_method() {
|
|
157
531
|
let deferred1_0;
|
|
158
532
|
let deferred1_1;
|
|
159
533
|
try {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
534
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
535
|
+
wasm.jsdetectionresult_verification_method(retptr, this.__wbg_ptr);
|
|
536
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
537
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
538
|
+
deferred1_0 = r0;
|
|
539
|
+
deferred1_1 = r1;
|
|
540
|
+
return getStringFromWasm0(r0, r1);
|
|
164
541
|
} finally {
|
|
165
|
-
|
|
542
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
543
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
166
544
|
}
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Get the risk level as a string
|
|
548
|
+
* @returns {string}
|
|
549
|
+
*/
|
|
550
|
+
get risk_level() {
|
|
551
|
+
let deferred1_0;
|
|
552
|
+
let deferred1_1;
|
|
553
|
+
try {
|
|
554
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
555
|
+
wasm.jsdetectionresult_risk_level(retptr, this.__wbg_ptr);
|
|
556
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
557
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
558
|
+
deferred1_0 = r0;
|
|
559
|
+
deferred1_1 = r1;
|
|
560
|
+
return getStringFromWasm0(r0, r1);
|
|
561
|
+
} finally {
|
|
562
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
563
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Get the timestamp as a string
|
|
568
|
+
* @returns {string}
|
|
569
|
+
*/
|
|
570
|
+
get timestamp() {
|
|
571
|
+
let deferred1_0;
|
|
572
|
+
let deferred1_1;
|
|
573
|
+
try {
|
|
574
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
575
|
+
wasm.jsdetectionresult_timestamp(retptr, this.__wbg_ptr);
|
|
576
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
577
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
578
|
+
deferred1_0 = r0;
|
|
579
|
+
deferred1_1 = r1;
|
|
580
|
+
return getStringFromWasm0(r0, r1);
|
|
581
|
+
} finally {
|
|
582
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
583
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
167
586
|
}
|
|
587
|
+
if (Symbol.dispose) JsDetectionResult.prototype[Symbol.dispose] = JsDetectionResult.prototype.free;
|
|
168
588
|
|
|
169
|
-
const
|
|
589
|
+
const JsDidKeyResultFinalization =
|
|
590
|
+
typeof FinalizationRegistry === 'undefined'
|
|
170
591
|
? { register: () => {}, unregister: () => {} }
|
|
171
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
592
|
+
: new FinalizationRegistry((ptr) => wasm.__wbg_jsdidkeyresult_free(ptr >>> 0, 1));
|
|
172
593
|
/**
|
|
173
|
-
* JavaScript-compatible
|
|
594
|
+
* JavaScript-compatible result from did:key resolution
|
|
174
595
|
*/
|
|
175
|
-
export class
|
|
596
|
+
export class JsDidKeyResult {
|
|
597
|
+
static __wrap(ptr) {
|
|
598
|
+
ptr = ptr >>> 0;
|
|
599
|
+
const obj = Object.create(JsDidKeyResult.prototype);
|
|
600
|
+
obj.__wbg_ptr = ptr;
|
|
601
|
+
JsDidKeyResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
602
|
+
return obj;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
__destroy_into_raw() {
|
|
606
|
+
const ptr = this.__wbg_ptr;
|
|
607
|
+
this.__wbg_ptr = 0;
|
|
608
|
+
JsDidKeyResultFinalization.unregister(this);
|
|
609
|
+
return ptr;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
free() {
|
|
613
|
+
const ptr = this.__destroy_into_raw();
|
|
614
|
+
wasm.__wbg_jsdidkeyresult_free(ptr, 0);
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Whether the resolution was successful
|
|
618
|
+
* @returns {boolean}
|
|
619
|
+
*/
|
|
620
|
+
get success() {
|
|
621
|
+
const ret = wasm.__wbg_get_jsdidkeyresult_success(this.__wbg_ptr);
|
|
622
|
+
return ret !== 0;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Whether the resolution was successful
|
|
626
|
+
* @param {boolean} arg0
|
|
627
|
+
*/
|
|
628
|
+
set success(arg0) {
|
|
629
|
+
wasm.__wbg_set_jsdidkeyresult_success(this.__wbg_ptr, arg0);
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Get the public key as hex string
|
|
633
|
+
* @returns {string | undefined}
|
|
634
|
+
*/
|
|
635
|
+
get public_key_hex() {
|
|
636
|
+
try {
|
|
637
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
638
|
+
wasm.jsdidkeyresult_public_key_hex(retptr, this.__wbg_ptr);
|
|
639
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
640
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
641
|
+
let v1;
|
|
642
|
+
if (r0 !== 0) {
|
|
643
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
644
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
645
|
+
}
|
|
646
|
+
return v1;
|
|
647
|
+
} finally {
|
|
648
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Get the key type
|
|
653
|
+
* @returns {string | undefined}
|
|
654
|
+
*/
|
|
655
|
+
get key_type() {
|
|
656
|
+
try {
|
|
657
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
658
|
+
wasm.jsdidkeyresult_key_type(retptr, this.__wbg_ptr);
|
|
659
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
660
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
661
|
+
let v1;
|
|
662
|
+
if (r0 !== 0) {
|
|
663
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
664
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
665
|
+
}
|
|
666
|
+
return v1;
|
|
667
|
+
} finally {
|
|
668
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Get the error message
|
|
673
|
+
* @returns {string | undefined}
|
|
674
|
+
*/
|
|
675
|
+
get error() {
|
|
676
|
+
try {
|
|
677
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
678
|
+
wasm.jsdidkeyresult_error(retptr, this.__wbg_ptr);
|
|
679
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
680
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
681
|
+
let v1;
|
|
682
|
+
if (r0 !== 0) {
|
|
683
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
684
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
685
|
+
}
|
|
686
|
+
return v1;
|
|
687
|
+
} finally {
|
|
688
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
if (Symbol.dispose) JsDidKeyResult.prototype[Symbol.dispose] = JsDidKeyResult.prototype.free;
|
|
176
693
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
return v1;
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Get the verification method as a string
|
|
256
|
-
* @returns {string}
|
|
257
|
-
*/
|
|
258
|
-
get verification_method() {
|
|
259
|
-
let deferred1_0;
|
|
260
|
-
let deferred1_1;
|
|
261
|
-
try {
|
|
262
|
-
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
263
|
-
_assertNum(this.__wbg_ptr);
|
|
264
|
-
const ret = wasm.jsdetectionresult_verification_method(this.__wbg_ptr);
|
|
265
|
-
deferred1_0 = ret[0];
|
|
266
|
-
deferred1_1 = ret[1];
|
|
267
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
268
|
-
} finally {
|
|
269
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
270
|
-
}
|
|
694
|
+
const JsMcpIVerificationResultFinalization =
|
|
695
|
+
typeof FinalizationRegistry === 'undefined'
|
|
696
|
+
? { register: () => {}, unregister: () => {} }
|
|
697
|
+
: new FinalizationRegistry((ptr) => wasm.__wbg_jsmcpiverificationresult_free(ptr >>> 0, 1));
|
|
698
|
+
/**
|
|
699
|
+
* JavaScript-compatible result from MCP-I verification
|
|
700
|
+
*/
|
|
701
|
+
export class JsMcpIVerificationResult {
|
|
702
|
+
static __wrap(ptr) {
|
|
703
|
+
ptr = ptr >>> 0;
|
|
704
|
+
const obj = Object.create(JsMcpIVerificationResult.prototype);
|
|
705
|
+
obj.__wbg_ptr = ptr;
|
|
706
|
+
JsMcpIVerificationResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
707
|
+
return obj;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
__destroy_into_raw() {
|
|
711
|
+
const ptr = this.__wbg_ptr;
|
|
712
|
+
this.__wbg_ptr = 0;
|
|
713
|
+
JsMcpIVerificationResultFinalization.unregister(this);
|
|
714
|
+
return ptr;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
free() {
|
|
718
|
+
const ptr = this.__destroy_into_raw();
|
|
719
|
+
wasm.__wbg_jsmcpiverificationresult_free(ptr, 0);
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Whether the verification was successful
|
|
723
|
+
* @returns {boolean}
|
|
724
|
+
*/
|
|
725
|
+
get verified() {
|
|
726
|
+
const ret = wasm.__wbg_get_jsmcpiverificationresult_verified(this.__wbg_ptr);
|
|
727
|
+
return ret !== 0;
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Whether the verification was successful
|
|
731
|
+
* @param {boolean} arg0
|
|
732
|
+
*/
|
|
733
|
+
set verified(arg0) {
|
|
734
|
+
wasm.__wbg_set_jsmcpiverificationresult_verified(this.__wbg_ptr, arg0);
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Confidence score (0.0 to 1.0 scale) - 0.99 for verified MCP-I
|
|
738
|
+
* @returns {number}
|
|
739
|
+
*/
|
|
740
|
+
get confidence() {
|
|
741
|
+
const ret = wasm.__wbg_get_jsdetectionresult_confidence(this.__wbg_ptr);
|
|
742
|
+
return ret;
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Confidence score (0.0 to 1.0 scale) - 0.99 for verified MCP-I
|
|
746
|
+
* @param {number} arg0
|
|
747
|
+
*/
|
|
748
|
+
set confidence(arg0) {
|
|
749
|
+
wasm.__wbg_set_jsdetectionresult_confidence(this.__wbg_ptr, arg0);
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Get the issuer DID (principal)
|
|
753
|
+
* @returns {string | undefined}
|
|
754
|
+
*/
|
|
755
|
+
get issuer_did() {
|
|
756
|
+
try {
|
|
757
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
758
|
+
wasm.jsmcpiverificationresult_issuer_did(retptr, this.__wbg_ptr);
|
|
759
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
760
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
761
|
+
let v1;
|
|
762
|
+
if (r0 !== 0) {
|
|
763
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
764
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
765
|
+
}
|
|
766
|
+
return v1;
|
|
767
|
+
} finally {
|
|
768
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
271
769
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Get the subject DID (agent)
|
|
773
|
+
* @returns {string | undefined}
|
|
774
|
+
*/
|
|
775
|
+
get subject_did() {
|
|
776
|
+
try {
|
|
777
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
778
|
+
wasm.jsmcpiverificationresult_subject_did(retptr, this.__wbg_ptr);
|
|
779
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
780
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
781
|
+
let v1;
|
|
782
|
+
if (r0 !== 0) {
|
|
783
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
784
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
785
|
+
}
|
|
786
|
+
return v1;
|
|
787
|
+
} finally {
|
|
788
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
289
789
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Get the error message
|
|
793
|
+
* @returns {string | undefined}
|
|
794
|
+
*/
|
|
795
|
+
get error() {
|
|
796
|
+
try {
|
|
797
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
798
|
+
wasm.jsmcpiverificationresult_error(retptr, this.__wbg_ptr);
|
|
799
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
800
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
801
|
+
let v1;
|
|
802
|
+
if (r0 !== 0) {
|
|
803
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
804
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
805
|
+
}
|
|
806
|
+
return v1;
|
|
807
|
+
} finally {
|
|
808
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
307
809
|
}
|
|
810
|
+
}
|
|
308
811
|
}
|
|
812
|
+
if (Symbol.dispose)
|
|
813
|
+
JsMcpIVerificationResult.prototype[Symbol.dispose] = JsMcpIVerificationResult.prototype.free;
|
|
309
814
|
|
|
310
|
-
const
|
|
815
|
+
const JsPolicyEvaluationResultFinalization =
|
|
816
|
+
typeof FinalizationRegistry === 'undefined'
|
|
311
817
|
? { register: () => {}, unregister: () => {} }
|
|
312
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
818
|
+
: new FinalizationRegistry((ptr) => wasm.__wbg_jspolicyevaluationresult_free(ptr >>> 0, 1));
|
|
819
|
+
/**
|
|
820
|
+
* JavaScript-compatible policy evaluation result
|
|
821
|
+
*/
|
|
822
|
+
export class JsPolicyEvaluationResult {
|
|
823
|
+
static __wrap(ptr) {
|
|
824
|
+
ptr = ptr >>> 0;
|
|
825
|
+
const obj = Object.create(JsPolicyEvaluationResult.prototype);
|
|
826
|
+
obj.__wbg_ptr = ptr;
|
|
827
|
+
JsPolicyEvaluationResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
828
|
+
return obj;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
__destroy_into_raw() {
|
|
832
|
+
const ptr = this.__wbg_ptr;
|
|
833
|
+
this.__wbg_ptr = 0;
|
|
834
|
+
JsPolicyEvaluationResultFinalization.unregister(this);
|
|
835
|
+
return ptr;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
free() {
|
|
839
|
+
const ptr = this.__destroy_into_raw();
|
|
840
|
+
wasm.__wbg_jspolicyevaluationresult_free(ptr, 0);
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Get the enforcement action
|
|
844
|
+
* @returns {string}
|
|
845
|
+
*/
|
|
846
|
+
get action() {
|
|
847
|
+
let deferred1_0;
|
|
848
|
+
let deferred1_1;
|
|
849
|
+
try {
|
|
850
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
851
|
+
wasm.jspolicyevaluationresult_action(retptr, this.__wbg_ptr);
|
|
852
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
853
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
854
|
+
deferred1_0 = r0;
|
|
855
|
+
deferred1_1 = r1;
|
|
856
|
+
return getStringFromWasm0(r0, r1);
|
|
857
|
+
} finally {
|
|
858
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
859
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Get the reason for the action
|
|
864
|
+
* @returns {string}
|
|
865
|
+
*/
|
|
866
|
+
get reason() {
|
|
867
|
+
let deferred1_0;
|
|
868
|
+
let deferred1_1;
|
|
869
|
+
try {
|
|
870
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
871
|
+
wasm.jspolicyevaluationresult_reason(retptr, this.__wbg_ptr);
|
|
872
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
873
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
874
|
+
deferred1_0 = r0;
|
|
875
|
+
deferred1_1 = r1;
|
|
876
|
+
return getStringFromWasm0(r0, r1);
|
|
877
|
+
} finally {
|
|
878
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
879
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* Get the matched rule ID
|
|
884
|
+
* @returns {string | undefined}
|
|
885
|
+
*/
|
|
886
|
+
get rule_id() {
|
|
887
|
+
try {
|
|
888
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
889
|
+
wasm.jspolicyevaluationresult_rule_id(retptr, this.__wbg_ptr);
|
|
890
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
891
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
892
|
+
let v1;
|
|
893
|
+
if (r0 !== 0) {
|
|
894
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
895
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
896
|
+
}
|
|
897
|
+
return v1;
|
|
898
|
+
} finally {
|
|
899
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Get the matched rule name
|
|
904
|
+
* @returns {string | undefined}
|
|
905
|
+
*/
|
|
906
|
+
get rule_name() {
|
|
907
|
+
try {
|
|
908
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
909
|
+
wasm.jspolicyevaluationresult_rule_name(retptr, this.__wbg_ptr);
|
|
910
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
911
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
912
|
+
let v1;
|
|
913
|
+
if (r0 !== 0) {
|
|
914
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
915
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
916
|
+
}
|
|
917
|
+
return v1;
|
|
918
|
+
} finally {
|
|
919
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Get the redirect URL
|
|
924
|
+
* @returns {string | undefined}
|
|
925
|
+
*/
|
|
926
|
+
get redirect_url() {
|
|
927
|
+
try {
|
|
928
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
929
|
+
wasm.jspolicyevaluationresult_redirect_url(retptr, this.__wbg_ptr);
|
|
930
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
931
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
932
|
+
let v1;
|
|
933
|
+
if (r0 !== 0) {
|
|
934
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
935
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
936
|
+
}
|
|
937
|
+
return v1;
|
|
938
|
+
} finally {
|
|
939
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* Get the custom message
|
|
944
|
+
* @returns {string | undefined}
|
|
945
|
+
*/
|
|
946
|
+
get message() {
|
|
947
|
+
try {
|
|
948
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
949
|
+
wasm.jspolicyevaluationresult_message(retptr, this.__wbg_ptr);
|
|
950
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
951
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
952
|
+
let v1;
|
|
953
|
+
if (r0 !== 0) {
|
|
954
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
955
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
956
|
+
}
|
|
957
|
+
return v1;
|
|
958
|
+
} finally {
|
|
959
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Get the match type
|
|
964
|
+
* @returns {string}
|
|
965
|
+
*/
|
|
966
|
+
get match_type() {
|
|
967
|
+
let deferred1_0;
|
|
968
|
+
let deferred1_1;
|
|
969
|
+
try {
|
|
970
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
971
|
+
wasm.jspolicyevaluationresult_match_type(retptr, this.__wbg_ptr);
|
|
972
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
973
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
974
|
+
deferred1_0 = r0;
|
|
975
|
+
deferred1_1 = r1;
|
|
976
|
+
return getStringFromWasm0(r0, r1);
|
|
977
|
+
} finally {
|
|
978
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
979
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* Check if the action permits the request to proceed
|
|
984
|
+
* Returns true for 'allow' and 'log' (allow but log for monitoring)
|
|
985
|
+
* @returns {boolean}
|
|
986
|
+
*/
|
|
987
|
+
is_allowed() {
|
|
988
|
+
const ret = wasm.jspolicyevaluationresult_is_allowed(this.__wbg_ptr);
|
|
989
|
+
return ret !== 0;
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Check if the action blocks the request
|
|
993
|
+
* Returns true for 'block', 'redirect', and 'challenge'
|
|
994
|
+
* @returns {boolean}
|
|
995
|
+
*/
|
|
996
|
+
is_blocked() {
|
|
997
|
+
const ret = wasm.jspolicyevaluationresult_is_blocked(this.__wbg_ptr);
|
|
998
|
+
return ret !== 0;
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Convert to JSON string for serialization
|
|
1002
|
+
* @returns {string}
|
|
1003
|
+
*/
|
|
1004
|
+
to_json() {
|
|
1005
|
+
let deferred1_0;
|
|
1006
|
+
let deferred1_1;
|
|
1007
|
+
try {
|
|
1008
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1009
|
+
wasm.jspolicyevaluationresult_to_json(retptr, this.__wbg_ptr);
|
|
1010
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1011
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1012
|
+
deferred1_0 = r0;
|
|
1013
|
+
deferred1_1 = r1;
|
|
1014
|
+
return getStringFromWasm0(r0, r1);
|
|
1015
|
+
} finally {
|
|
1016
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1017
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
if (Symbol.dispose)
|
|
1022
|
+
JsPolicyEvaluationResult.prototype[Symbol.dispose] = JsPolicyEvaluationResult.prototype.free;
|
|
1023
|
+
|
|
1024
|
+
const JsRequestMetadataFinalization =
|
|
1025
|
+
typeof FinalizationRegistry === 'undefined'
|
|
1026
|
+
? { register: () => {}, unregister: () => {} }
|
|
1027
|
+
: new FinalizationRegistry((ptr) => wasm.__wbg_jsrequestmetadata_free(ptr >>> 0, 1));
|
|
313
1028
|
/**
|
|
314
1029
|
* JavaScript-compatible request metadata
|
|
315
1030
|
*/
|
|
316
1031
|
export class JsRequestMetadata {
|
|
1032
|
+
__destroy_into_raw() {
|
|
1033
|
+
const ptr = this.__wbg_ptr;
|
|
1034
|
+
this.__wbg_ptr = 0;
|
|
1035
|
+
JsRequestMetadataFinalization.unregister(this);
|
|
1036
|
+
return ptr;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
free() {
|
|
1040
|
+
const ptr = this.__destroy_into_raw();
|
|
1041
|
+
wasm.__wbg_jsrequestmetadata_free(ptr, 0);
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Constructor for JsRequestMetadata
|
|
1045
|
+
* @param {string | null | undefined} user_agent
|
|
1046
|
+
* @param {string | null | undefined} ip_address
|
|
1047
|
+
* @param {string} headers
|
|
1048
|
+
* @param {string} timestamp
|
|
1049
|
+
* @param {string | null} [url]
|
|
1050
|
+
* @param {string | null} [method]
|
|
1051
|
+
* @param {string | null} [client_fingerprint]
|
|
1052
|
+
* @param {string | null} [tls_fingerprint]
|
|
1053
|
+
*/
|
|
1054
|
+
constructor(
|
|
1055
|
+
user_agent,
|
|
1056
|
+
ip_address,
|
|
1057
|
+
headers,
|
|
1058
|
+
timestamp,
|
|
1059
|
+
url,
|
|
1060
|
+
method,
|
|
1061
|
+
client_fingerprint,
|
|
1062
|
+
tls_fingerprint
|
|
1063
|
+
) {
|
|
1064
|
+
var ptr0 = isLikeNone(user_agent)
|
|
1065
|
+
? 0
|
|
1066
|
+
: passStringToWasm0(user_agent, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1067
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1068
|
+
var ptr1 = isLikeNone(ip_address)
|
|
1069
|
+
? 0
|
|
1070
|
+
: passStringToWasm0(ip_address, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1071
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1072
|
+
const ptr2 = passStringToWasm0(headers, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1073
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1074
|
+
const ptr3 = passStringToWasm0(timestamp, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1075
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1076
|
+
var ptr4 = isLikeNone(url)
|
|
1077
|
+
? 0
|
|
1078
|
+
: passStringToWasm0(url, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1079
|
+
var len4 = WASM_VECTOR_LEN;
|
|
1080
|
+
var ptr5 = isLikeNone(method)
|
|
1081
|
+
? 0
|
|
1082
|
+
: passStringToWasm0(method, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1083
|
+
var len5 = WASM_VECTOR_LEN;
|
|
1084
|
+
var ptr6 = isLikeNone(client_fingerprint)
|
|
1085
|
+
? 0
|
|
1086
|
+
: passStringToWasm0(client_fingerprint, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1087
|
+
var len6 = WASM_VECTOR_LEN;
|
|
1088
|
+
var ptr7 = isLikeNone(tls_fingerprint)
|
|
1089
|
+
? 0
|
|
1090
|
+
: passStringToWasm0(tls_fingerprint, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1091
|
+
var len7 = WASM_VECTOR_LEN;
|
|
1092
|
+
const ret = wasm.jsrequestmetadata_new(
|
|
1093
|
+
ptr0,
|
|
1094
|
+
len0,
|
|
1095
|
+
ptr1,
|
|
1096
|
+
len1,
|
|
1097
|
+
ptr2,
|
|
1098
|
+
len2,
|
|
1099
|
+
ptr3,
|
|
1100
|
+
len3,
|
|
1101
|
+
ptr4,
|
|
1102
|
+
len4,
|
|
1103
|
+
ptr5,
|
|
1104
|
+
len5,
|
|
1105
|
+
ptr6,
|
|
1106
|
+
len6,
|
|
1107
|
+
ptr7,
|
|
1108
|
+
len7
|
|
1109
|
+
);
|
|
1110
|
+
this.__wbg_ptr = ret >>> 0;
|
|
1111
|
+
JsRequestMetadataFinalization.register(this, this.__wbg_ptr, this);
|
|
1112
|
+
return this;
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Get the user agent
|
|
1116
|
+
* @returns {string | undefined}
|
|
1117
|
+
*/
|
|
1118
|
+
get user_agent() {
|
|
1119
|
+
try {
|
|
1120
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1121
|
+
wasm.jsrequestmetadata_user_agent(retptr, this.__wbg_ptr);
|
|
1122
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1123
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1124
|
+
let v1;
|
|
1125
|
+
if (r0 !== 0) {
|
|
1126
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1127
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1128
|
+
}
|
|
1129
|
+
return v1;
|
|
1130
|
+
} finally {
|
|
1131
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Get the IP address
|
|
1136
|
+
* @returns {string | undefined}
|
|
1137
|
+
*/
|
|
1138
|
+
get ip_address() {
|
|
1139
|
+
try {
|
|
1140
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1141
|
+
wasm.jsrequestmetadata_ip_address(retptr, this.__wbg_ptr);
|
|
1142
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1143
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1144
|
+
let v1;
|
|
1145
|
+
if (r0 !== 0) {
|
|
1146
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1147
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1148
|
+
}
|
|
1149
|
+
return v1;
|
|
1150
|
+
} finally {
|
|
1151
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Get the headers as JSON string
|
|
1156
|
+
* @returns {string}
|
|
1157
|
+
*/
|
|
1158
|
+
get headers() {
|
|
1159
|
+
let deferred1_0;
|
|
1160
|
+
let deferred1_1;
|
|
1161
|
+
try {
|
|
1162
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1163
|
+
wasm.jsrequestmetadata_headers(retptr, this.__wbg_ptr);
|
|
1164
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1165
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1166
|
+
deferred1_0 = r0;
|
|
1167
|
+
deferred1_1 = r1;
|
|
1168
|
+
return getStringFromWasm0(r0, r1);
|
|
1169
|
+
} finally {
|
|
1170
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1171
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Get the timestamp
|
|
1176
|
+
* @returns {string}
|
|
1177
|
+
*/
|
|
1178
|
+
get timestamp() {
|
|
1179
|
+
let deferred1_0;
|
|
1180
|
+
let deferred1_1;
|
|
1181
|
+
try {
|
|
1182
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1183
|
+
wasm.jsrequestmetadata_timestamp(retptr, this.__wbg_ptr);
|
|
1184
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1185
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1186
|
+
deferred1_0 = r0;
|
|
1187
|
+
deferred1_1 = r1;
|
|
1188
|
+
return getStringFromWasm0(r0, r1);
|
|
1189
|
+
} finally {
|
|
1190
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1191
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* Get the URL
|
|
1196
|
+
* @returns {string | undefined}
|
|
1197
|
+
*/
|
|
1198
|
+
get url() {
|
|
1199
|
+
try {
|
|
1200
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1201
|
+
wasm.jsrequestmetadata_url(retptr, this.__wbg_ptr);
|
|
1202
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1203
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1204
|
+
let v1;
|
|
1205
|
+
if (r0 !== 0) {
|
|
1206
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1207
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1208
|
+
}
|
|
1209
|
+
return v1;
|
|
1210
|
+
} finally {
|
|
1211
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Get the method
|
|
1216
|
+
* @returns {string | undefined}
|
|
1217
|
+
*/
|
|
1218
|
+
get method() {
|
|
1219
|
+
try {
|
|
1220
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1221
|
+
wasm.jsrequestmetadata_method(retptr, this.__wbg_ptr);
|
|
1222
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1223
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1224
|
+
let v1;
|
|
1225
|
+
if (r0 !== 0) {
|
|
1226
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1227
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1228
|
+
}
|
|
1229
|
+
return v1;
|
|
1230
|
+
} finally {
|
|
1231
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Get the client fingerprint
|
|
1236
|
+
* @returns {string | undefined}
|
|
1237
|
+
*/
|
|
1238
|
+
get client_fingerprint() {
|
|
1239
|
+
try {
|
|
1240
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1241
|
+
wasm.jsrequestmetadata_client_fingerprint(retptr, this.__wbg_ptr);
|
|
1242
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1243
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1244
|
+
let v1;
|
|
1245
|
+
if (r0 !== 0) {
|
|
1246
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1247
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1248
|
+
}
|
|
1249
|
+
return v1;
|
|
1250
|
+
} finally {
|
|
1251
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Get the TLS fingerprint
|
|
1256
|
+
* @returns {string | undefined}
|
|
1257
|
+
*/
|
|
1258
|
+
get tls_fingerprint() {
|
|
1259
|
+
try {
|
|
1260
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1261
|
+
wasm.jsrequestmetadata_tls_fingerprint(retptr, this.__wbg_ptr);
|
|
1262
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1263
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1264
|
+
let v1;
|
|
1265
|
+
if (r0 !== 0) {
|
|
1266
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1267
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1268
|
+
}
|
|
1269
|
+
return v1;
|
|
1270
|
+
} finally {
|
|
1271
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
if (Symbol.dispose) JsRequestMetadata.prototype[Symbol.dispose] = JsRequestMetadata.prototype.free;
|
|
317
1276
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
get ip_address() {
|
|
379
|
-
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
380
|
-
_assertNum(this.__wbg_ptr);
|
|
381
|
-
const ret = wasm.jsrequestmetadata_ip_address(this.__wbg_ptr);
|
|
382
|
-
let v1;
|
|
383
|
-
if (ret[0] !== 0) {
|
|
384
|
-
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
385
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
386
|
-
}
|
|
387
|
-
return v1;
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Get the headers as JSON string
|
|
391
|
-
* @returns {string}
|
|
392
|
-
*/
|
|
393
|
-
get headers() {
|
|
394
|
-
let deferred1_0;
|
|
395
|
-
let deferred1_1;
|
|
396
|
-
try {
|
|
397
|
-
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
398
|
-
_assertNum(this.__wbg_ptr);
|
|
399
|
-
const ret = wasm.jsrequestmetadata_headers(this.__wbg_ptr);
|
|
400
|
-
deferred1_0 = ret[0];
|
|
401
|
-
deferred1_1 = ret[1];
|
|
402
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
403
|
-
} finally {
|
|
404
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
405
|
-
}
|
|
1277
|
+
const JsScopeCheckResultFinalization =
|
|
1278
|
+
typeof FinalizationRegistry === 'undefined'
|
|
1279
|
+
? { register: () => {}, unregister: () => {} }
|
|
1280
|
+
: new FinalizationRegistry((ptr) => wasm.__wbg_jsscopecheckresult_free(ptr >>> 0, 1));
|
|
1281
|
+
/**
|
|
1282
|
+
* JavaScript-compatible result from scope check
|
|
1283
|
+
*/
|
|
1284
|
+
export class JsScopeCheckResult {
|
|
1285
|
+
static __wrap(ptr) {
|
|
1286
|
+
ptr = ptr >>> 0;
|
|
1287
|
+
const obj = Object.create(JsScopeCheckResult.prototype);
|
|
1288
|
+
obj.__wbg_ptr = ptr;
|
|
1289
|
+
JsScopeCheckResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1290
|
+
return obj;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
__destroy_into_raw() {
|
|
1294
|
+
const ptr = this.__wbg_ptr;
|
|
1295
|
+
this.__wbg_ptr = 0;
|
|
1296
|
+
JsScopeCheckResultFinalization.unregister(this);
|
|
1297
|
+
return ptr;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
free() {
|
|
1301
|
+
const ptr = this.__destroy_into_raw();
|
|
1302
|
+
wasm.__wbg_jsscopecheckresult_free(ptr, 0);
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Whether the scope is permitted
|
|
1306
|
+
* @returns {boolean}
|
|
1307
|
+
*/
|
|
1308
|
+
get permitted() {
|
|
1309
|
+
const ret = wasm.__wbg_get_jsdidkeyresult_success(this.__wbg_ptr);
|
|
1310
|
+
return ret !== 0;
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* Whether the scope is permitted
|
|
1314
|
+
* @param {boolean} arg0
|
|
1315
|
+
*/
|
|
1316
|
+
set permitted(arg0) {
|
|
1317
|
+
wasm.__wbg_set_jsdidkeyresult_success(this.__wbg_ptr, arg0);
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Get the matching scope
|
|
1321
|
+
* @returns {string | undefined}
|
|
1322
|
+
*/
|
|
1323
|
+
get matched_by() {
|
|
1324
|
+
try {
|
|
1325
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1326
|
+
wasm.jsscopecheckresult_matched_by(retptr, this.__wbg_ptr);
|
|
1327
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1328
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1329
|
+
let v1;
|
|
1330
|
+
if (r0 !== 0) {
|
|
1331
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1332
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1333
|
+
}
|
|
1334
|
+
return v1;
|
|
1335
|
+
} finally {
|
|
1336
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
406
1337
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* Get the match type
|
|
1341
|
+
* @returns {string}
|
|
1342
|
+
*/
|
|
1343
|
+
get match_type() {
|
|
1344
|
+
let deferred1_0;
|
|
1345
|
+
let deferred1_1;
|
|
1346
|
+
try {
|
|
1347
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1348
|
+
wasm.jsscopecheckresult_match_type(retptr, this.__wbg_ptr);
|
|
1349
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1350
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1351
|
+
deferred1_0 = r0;
|
|
1352
|
+
deferred1_1 = r1;
|
|
1353
|
+
return getStringFromWasm0(r0, r1);
|
|
1354
|
+
} finally {
|
|
1355
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1356
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
424
1357
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
get method() {
|
|
445
|
-
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
446
|
-
_assertNum(this.__wbg_ptr);
|
|
447
|
-
const ret = wasm.jsrequestmetadata_method(this.__wbg_ptr);
|
|
448
|
-
let v1;
|
|
449
|
-
if (ret[0] !== 0) {
|
|
450
|
-
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
451
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
452
|
-
}
|
|
453
|
-
return v1;
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Get the client fingerprint
|
|
457
|
-
* @returns {string | undefined}
|
|
458
|
-
*/
|
|
459
|
-
get client_fingerprint() {
|
|
460
|
-
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
461
|
-
_assertNum(this.__wbg_ptr);
|
|
462
|
-
const ret = wasm.jsrequestmetadata_client_fingerprint(this.__wbg_ptr);
|
|
463
|
-
let v1;
|
|
464
|
-
if (ret[0] !== 0) {
|
|
465
|
-
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
466
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
467
|
-
}
|
|
468
|
-
return v1;
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Get the error message
|
|
1361
|
+
* @returns {string | undefined}
|
|
1362
|
+
*/
|
|
1363
|
+
get error() {
|
|
1364
|
+
try {
|
|
1365
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1366
|
+
wasm.jsscopecheckresult_error(retptr, this.__wbg_ptr);
|
|
1367
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1368
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1369
|
+
let v1;
|
|
1370
|
+
if (r0 !== 0) {
|
|
1371
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1372
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1373
|
+
}
|
|
1374
|
+
return v1;
|
|
1375
|
+
} finally {
|
|
1376
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
469
1377
|
}
|
|
1378
|
+
}
|
|
470
1379
|
}
|
|
1380
|
+
if (Symbol.dispose)
|
|
1381
|
+
JsScopeCheckResult.prototype[Symbol.dispose] = JsScopeCheckResult.prototype.free;
|
|
1382
|
+
|
|
1383
|
+
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
471
1384
|
|
|
472
1385
|
async function __wbg_load(module, imports) {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
1386
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
1387
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1388
|
+
try {
|
|
1389
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1390
|
+
} catch (e) {
|
|
1391
|
+
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
1392
|
+
|
|
1393
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
1394
|
+
console.warn(
|
|
1395
|
+
'`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',
|
|
1396
|
+
e
|
|
1397
|
+
);
|
|
1398
|
+
} else {
|
|
1399
|
+
throw e;
|
|
486
1400
|
}
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
487
1403
|
|
|
488
|
-
|
|
489
|
-
|
|
1404
|
+
const bytes = await module.arrayBuffer();
|
|
1405
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
1406
|
+
} else {
|
|
1407
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
490
1408
|
|
|
1409
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
1410
|
+
return { instance, module };
|
|
491
1411
|
} else {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
495
|
-
return { instance, module };
|
|
496
|
-
|
|
497
|
-
} else {
|
|
498
|
-
return instance;
|
|
499
|
-
}
|
|
1412
|
+
return instance;
|
|
500
1413
|
}
|
|
1414
|
+
}
|
|
501
1415
|
}
|
|
502
1416
|
|
|
503
1417
|
function __wbg_get_imports() {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
};
|
|
557
|
-
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
558
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
559
|
-
};
|
|
560
|
-
|
|
561
|
-
return imports;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
function __wbg_init_memory(imports, memory) {
|
|
565
|
-
|
|
1418
|
+
const imports = {};
|
|
1419
|
+
imports.wbg = {};
|
|
1420
|
+
imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function (arg0, arg1) {
|
|
1421
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1422
|
+
};
|
|
1423
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function (arg0, arg1) {
|
|
1424
|
+
let deferred0_0;
|
|
1425
|
+
let deferred0_1;
|
|
1426
|
+
try {
|
|
1427
|
+
deferred0_0 = arg0;
|
|
1428
|
+
deferred0_1 = arg1;
|
|
1429
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
1430
|
+
} finally {
|
|
1431
|
+
wasm.__wbindgen_export(deferred0_0, deferred0_1, 1);
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
imports.wbg.__wbg_getTime_14776bfb48a1bff9 = function (arg0) {
|
|
1435
|
+
const ret = getObject(arg0).getTime();
|
|
1436
|
+
return ret;
|
|
1437
|
+
};
|
|
1438
|
+
imports.wbg.__wbg_log_8cec76766b8c0e33 = function (arg0) {
|
|
1439
|
+
console.log(getObject(arg0));
|
|
1440
|
+
};
|
|
1441
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function () {
|
|
1442
|
+
const ret = new Error();
|
|
1443
|
+
return addHeapObject(ret);
|
|
1444
|
+
};
|
|
1445
|
+
imports.wbg.__wbg_new_93d9417ed3fb115d = function (arg0) {
|
|
1446
|
+
const ret = new Date(getObject(arg0));
|
|
1447
|
+
return addHeapObject(ret);
|
|
1448
|
+
};
|
|
1449
|
+
imports.wbg.__wbg_now_793306c526e2e3b6 = function () {
|
|
1450
|
+
const ret = Date.now();
|
|
1451
|
+
return ret;
|
|
1452
|
+
};
|
|
1453
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function (arg0, arg1) {
|
|
1454
|
+
const ret = getObject(arg1).stack;
|
|
1455
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1456
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1457
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1458
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1459
|
+
};
|
|
1460
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
|
|
1461
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1462
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1463
|
+
return addHeapObject(ret);
|
|
1464
|
+
};
|
|
1465
|
+
imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
|
|
1466
|
+
takeObject(arg0);
|
|
1467
|
+
};
|
|
1468
|
+
|
|
1469
|
+
return imports;
|
|
566
1470
|
}
|
|
567
1471
|
|
|
568
1472
|
function __wbg_finalize_init(instance, module) {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
1473
|
+
wasm = instance.exports;
|
|
1474
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
1475
|
+
cachedDataViewMemory0 = null;
|
|
1476
|
+
cachedUint8ArrayMemory0 = null;
|
|
574
1477
|
|
|
575
|
-
|
|
576
|
-
|
|
1478
|
+
wasm.__wbindgen_start();
|
|
1479
|
+
return wasm;
|
|
577
1480
|
}
|
|
578
1481
|
|
|
579
1482
|
function initSync(module) {
|
|
580
|
-
|
|
1483
|
+
if (wasm !== undefined) return wasm;
|
|
581
1484
|
|
|
582
|
-
|
|
583
|
-
if (
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
588
|
-
}
|
|
1485
|
+
if (typeof module !== 'undefined') {
|
|
1486
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
1487
|
+
({ module } = module);
|
|
1488
|
+
} else {
|
|
1489
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead');
|
|
589
1490
|
}
|
|
1491
|
+
}
|
|
590
1492
|
|
|
591
|
-
|
|
1493
|
+
const imports = __wbg_get_imports();
|
|
592
1494
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
module = new WebAssembly.Module(module);
|
|
597
|
-
}
|
|
1495
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1496
|
+
module = new WebAssembly.Module(module);
|
|
1497
|
+
}
|
|
598
1498
|
|
|
599
|
-
|
|
1499
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
600
1500
|
|
|
601
|
-
|
|
1501
|
+
return __wbg_finalize_init(instance, module);
|
|
602
1502
|
}
|
|
603
1503
|
|
|
604
1504
|
async function __wbg_init(module_or_path) {
|
|
605
|
-
|
|
1505
|
+
if (wasm !== undefined) return wasm;
|
|
606
1506
|
|
|
607
|
-
|
|
608
|
-
if (
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
if (typeof module_or_path === 'undefined') {
|
|
617
|
-
module_or_path = new URL('agentshield_wasm_bg.wasm', import.meta.url);
|
|
1507
|
+
if (typeof module_or_path !== 'undefined') {
|
|
1508
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
1509
|
+
({ module_or_path } = module_or_path);
|
|
1510
|
+
} else {
|
|
1511
|
+
console.warn(
|
|
1512
|
+
'using deprecated parameters for the initialization function; pass a single object instead'
|
|
1513
|
+
);
|
|
618
1514
|
}
|
|
619
|
-
|
|
1515
|
+
}
|
|
620
1516
|
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
1517
|
+
if (typeof module_or_path === 'undefined') {
|
|
1518
|
+
module_or_path = new URL('agentshield_wasm_bg.wasm', import.meta.url);
|
|
1519
|
+
}
|
|
1520
|
+
const imports = __wbg_get_imports();
|
|
624
1521
|
|
|
625
|
-
|
|
1522
|
+
if (
|
|
1523
|
+
typeof module_or_path === 'string' ||
|
|
1524
|
+
(typeof Request === 'function' && module_or_path instanceof Request) ||
|
|
1525
|
+
(typeof URL === 'function' && module_or_path instanceof URL)
|
|
1526
|
+
) {
|
|
1527
|
+
module_or_path = fetch(module_or_path);
|
|
1528
|
+
}
|
|
626
1529
|
|
|
627
|
-
|
|
1530
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
628
1531
|
|
|
629
|
-
|
|
1532
|
+
return __wbg_finalize_init(instance, module);
|
|
630
1533
|
}
|
|
631
1534
|
|
|
632
1535
|
export { initSync };
|