@semiotic-labs/agentium-sdk 0.4.0 → 0.5.1
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/wasm.d.ts +1 -1
- package/dist/wasm.d.ts.map +1 -1
- package/dist/wasm.js +1 -1
- package/dist/wasm.js.map +1 -1
- package/package.json +2 -3
- package/packages/agentium-native/wasm/pkg/agentium_sdk_wasm.d.ts +82 -0
- package/packages/agentium-native/wasm/pkg/agentium_sdk_wasm.js +519 -0
- package/packages/agentium-native/wasm/pkg/agentium_sdk_wasm_bg.wasm +0 -0
- package/packages/agentium-native/wasm/pkg/agentium_sdk_wasm_bg.wasm.d.ts +15 -0
- package/packages/agentium-native/wasm/pkg/package.json +16 -0
package/dist/wasm.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type InitInput } from '
|
|
1
|
+
import { type InitInput } from '../packages/agentium-native/wasm/pkg/agentium_sdk_wasm.js';
|
|
2
2
|
import type { VerificationResult, KeyPair } from './vc/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Ensures the WASM module is loaded and ready.
|
package/dist/wasm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAIA,OAAa,EAKX,KAAK,SAAS,EACf,MAAM,
|
|
1
|
+
{"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAIA,OAAa,EAKX,KAAK,SAAS,EACf,MAAM,2DAA2D,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAKjE;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAOxE;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAKlC;AAED;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAG9F;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAGxD;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGzE"}
|
package/dist/wasm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2025 Semiotic AI, Inc.
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: MIT
|
|
4
|
-
import init, { verify_jwt as wasmVerifyJwt, generate_keypair as wasmGenerateKeypair, get_public_key as wasmGetPublicKey, init_logging as wasmInitLogging, } from '
|
|
4
|
+
import init, { verify_jwt as wasmVerifyJwt, generate_keypair as wasmGenerateKeypair, get_public_key as wasmGetPublicKey, init_logging as wasmInitLogging, } from '../packages/agentium-native/wasm/pkg/agentium_sdk_wasm.js';
|
|
5
5
|
let wasmInitialized = null;
|
|
6
6
|
let loggingInitialized = false;
|
|
7
7
|
/**
|
package/dist/wasm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasm.js","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,+BAA+B;AAE/B,OAAO,IAAI,EAAE,EACX,UAAU,IAAI,aAAa,EAC3B,gBAAgB,IAAI,mBAAmB,EACvC,cAAc,IAAI,gBAAgB,EAClC,YAAY,IAAI,eAAe,GAEhC,MAAM,
|
|
1
|
+
{"version":3,"file":"wasm.js","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,+BAA+B;AAE/B,OAAO,IAAI,EAAE,EACX,UAAU,IAAI,aAAa,EAC3B,gBAAgB,IAAI,mBAAmB,EACvC,cAAc,IAAI,gBAAgB,EAClC,YAAY,IAAI,eAAe,GAEhC,MAAM,2DAA2D,CAAC;AAGnE,IAAI,eAAe,GAAyB,IAAI,CAAC;AACjD,IAAI,kBAAkB,GAAG,KAAK,CAAC;AAE/B;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAmB;IACvD,IAAI,eAAe,KAAK,IAAI,EAAE,CAAC;QAC7B,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACxC,6BAA6B;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IACD,MAAM,eAAe,CAAC;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW;IACzB,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,eAAe,EAAE,CAAC;QAClB,kBAAkB,GAAG,IAAI,CAAC;IAC5B,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAW,EAAE,YAAoB;IAC/D,MAAM,eAAe,EAAE,CAAC;IACxB,OAAO,aAAa,CAAC,GAAG,EAAE,YAAY,CAAuB,CAAC;AAChE,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,MAAM,eAAe,EAAE,CAAC;IACxB,OAAO,mBAAmB,EAAa,CAAC;AAC1C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,aAAqB;IACtD,MAAM,eAAe,EAAE,CAAC;IACxB,OAAO,gBAAgB,CAAC,aAAa,CAAC,CAAC;AACzC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semiotic-labs/agentium-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"test": "vitest",
|
|
14
|
-
"build:wasm": "cd packages/agentium-native/wasm && wasm-pack build --target web --scope semiotic-labs",
|
|
14
|
+
"build:wasm": "cd packages/agentium-native/wasm && wasm-pack build --target web --scope semiotic-labs && rm -f pkg/.gitignore",
|
|
15
15
|
"build": "npm run build:wasm && tsc",
|
|
16
16
|
"docs": "typedoc",
|
|
17
17
|
"lint": "eslint src/**/*.ts",
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"vitest": "^4.0.15"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@semiotic-labs/agentium-sdk-wasm": "file:./packages/agentium-native/wasm/pkg",
|
|
60
59
|
"axios": "^1.13.2"
|
|
61
60
|
}
|
|
62
61
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generate a new Ed25519 key pair
|
|
6
|
+
*
|
|
7
|
+
* Returns a JSON object with `private_jwk` and `public_jwk` fields.
|
|
8
|
+
* The private key should be stored securely and never exposed.
|
|
9
|
+
*/
|
|
10
|
+
export function generate_keypair(): any;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Extract public key from a private JWK
|
|
14
|
+
*
|
|
15
|
+
* # Arguments
|
|
16
|
+
* * `private_key_jwk` - The private key as JWK JSON string
|
|
17
|
+
*
|
|
18
|
+
* # Returns
|
|
19
|
+
* The public key as JWK JSON string
|
|
20
|
+
*/
|
|
21
|
+
export function get_public_key(private_key_jwk: string): string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Initialize logging for the WASM module.
|
|
25
|
+
*
|
|
26
|
+
* This sets up `tracing` to output to the browser console via `tracing-wasm`.
|
|
27
|
+
* Call this once before using any other functions from this library.
|
|
28
|
+
*/
|
|
29
|
+
export function init_logging(): void;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Verify a JWT against a public key
|
|
33
|
+
*
|
|
34
|
+
* # Arguments
|
|
35
|
+
* * `jwt` - The JWT string to verify (compact format: header.payload.signature)
|
|
36
|
+
* * `public_key_jwk` - The public key as JWK JSON string
|
|
37
|
+
* * `check_expiration` - Whether to check if the JWT has expired (default: true)
|
|
38
|
+
*
|
|
39
|
+
* # Returns
|
|
40
|
+
* A VerificationResult with validity status and decoded claims if valid
|
|
41
|
+
*/
|
|
42
|
+
export function verify_jwt(jwt: string, public_key_jwk: string): any;
|
|
43
|
+
|
|
44
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
45
|
+
|
|
46
|
+
export interface InitOutput {
|
|
47
|
+
readonly memory: WebAssembly.Memory;
|
|
48
|
+
readonly generate_keypair: () => [number, number, number];
|
|
49
|
+
readonly get_public_key: (a: number, b: number) => [number, number, number, number];
|
|
50
|
+
readonly init_logging: () => void;
|
|
51
|
+
readonly verify_jwt: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
52
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
53
|
+
readonly __externref_table_alloc: () => number;
|
|
54
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
55
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
56
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
57
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
58
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
59
|
+
readonly __wbindgen_start: () => void;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
66
|
+
* a precompiled `WebAssembly.Module`.
|
|
67
|
+
*
|
|
68
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
69
|
+
*
|
|
70
|
+
* @returns {InitOutput}
|
|
71
|
+
*/
|
|
72
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
76
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
77
|
+
*
|
|
78
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
79
|
+
*
|
|
80
|
+
* @returns {Promise<InitOutput>}
|
|
81
|
+
*/
|
|
82
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
|
|
3
|
+
function addToExternrefTable0(obj) {
|
|
4
|
+
const idx = wasm.__externref_table_alloc();
|
|
5
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
6
|
+
return idx;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
10
|
+
ptr = ptr >>> 0;
|
|
11
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let cachedDataViewMemory0 = null;
|
|
15
|
+
function getDataViewMemory0() {
|
|
16
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
17
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
18
|
+
}
|
|
19
|
+
return cachedDataViewMemory0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getStringFromWasm0(ptr, len) {
|
|
23
|
+
ptr = ptr >>> 0;
|
|
24
|
+
return decodeText(ptr, len);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let cachedUint8ArrayMemory0 = null;
|
|
28
|
+
function getUint8ArrayMemory0() {
|
|
29
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
30
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
31
|
+
}
|
|
32
|
+
return cachedUint8ArrayMemory0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function handleError(f, args) {
|
|
36
|
+
try {
|
|
37
|
+
return f.apply(this, args);
|
|
38
|
+
} catch (e) {
|
|
39
|
+
const idx = addToExternrefTable0(e);
|
|
40
|
+
wasm.__wbindgen_exn_store(idx);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function isLikeNone(x) {
|
|
45
|
+
return x === undefined || x === null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
49
|
+
if (realloc === undefined) {
|
|
50
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
51
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
52
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
53
|
+
WASM_VECTOR_LEN = buf.length;
|
|
54
|
+
return ptr;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let len = arg.length;
|
|
58
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
59
|
+
|
|
60
|
+
const mem = getUint8ArrayMemory0();
|
|
61
|
+
|
|
62
|
+
let offset = 0;
|
|
63
|
+
|
|
64
|
+
for (; offset < len; offset++) {
|
|
65
|
+
const code = arg.charCodeAt(offset);
|
|
66
|
+
if (code > 0x7F) break;
|
|
67
|
+
mem[ptr + offset] = code;
|
|
68
|
+
}
|
|
69
|
+
if (offset !== len) {
|
|
70
|
+
if (offset !== 0) {
|
|
71
|
+
arg = arg.slice(offset);
|
|
72
|
+
}
|
|
73
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
74
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
75
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
76
|
+
|
|
77
|
+
offset += ret.written;
|
|
78
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
WASM_VECTOR_LEN = offset;
|
|
82
|
+
return ptr;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function takeFromExternrefTable0(idx) {
|
|
86
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
87
|
+
wasm.__externref_table_dealloc(idx);
|
|
88
|
+
return value;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
92
|
+
cachedTextDecoder.decode();
|
|
93
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
94
|
+
let numBytesDecoded = 0;
|
|
95
|
+
function decodeText(ptr, len) {
|
|
96
|
+
numBytesDecoded += len;
|
|
97
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
98
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
99
|
+
cachedTextDecoder.decode();
|
|
100
|
+
numBytesDecoded = len;
|
|
101
|
+
}
|
|
102
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const cachedTextEncoder = new TextEncoder();
|
|
106
|
+
|
|
107
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
108
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
109
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
110
|
+
view.set(buf);
|
|
111
|
+
return {
|
|
112
|
+
read: arg.length,
|
|
113
|
+
written: buf.length
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let WASM_VECTOR_LEN = 0;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Generate a new Ed25519 key pair
|
|
122
|
+
*
|
|
123
|
+
* Returns a JSON object with `private_jwk` and `public_jwk` fields.
|
|
124
|
+
* The private key should be stored securely and never exposed.
|
|
125
|
+
* @returns {any}
|
|
126
|
+
*/
|
|
127
|
+
export function generate_keypair() {
|
|
128
|
+
const ret = wasm.generate_keypair();
|
|
129
|
+
if (ret[2]) {
|
|
130
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
131
|
+
}
|
|
132
|
+
return takeFromExternrefTable0(ret[0]);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Extract public key from a private JWK
|
|
137
|
+
*
|
|
138
|
+
* # Arguments
|
|
139
|
+
* * `private_key_jwk` - The private key as JWK JSON string
|
|
140
|
+
*
|
|
141
|
+
* # Returns
|
|
142
|
+
* The public key as JWK JSON string
|
|
143
|
+
* @param {string} private_key_jwk
|
|
144
|
+
* @returns {string}
|
|
145
|
+
*/
|
|
146
|
+
export function get_public_key(private_key_jwk) {
|
|
147
|
+
let deferred3_0;
|
|
148
|
+
let deferred3_1;
|
|
149
|
+
try {
|
|
150
|
+
const ptr0 = passStringToWasm0(private_key_jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
151
|
+
const len0 = WASM_VECTOR_LEN;
|
|
152
|
+
const ret = wasm.get_public_key(ptr0, len0);
|
|
153
|
+
var ptr2 = ret[0];
|
|
154
|
+
var len2 = ret[1];
|
|
155
|
+
if (ret[3]) {
|
|
156
|
+
ptr2 = 0; len2 = 0;
|
|
157
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
158
|
+
}
|
|
159
|
+
deferred3_0 = ptr2;
|
|
160
|
+
deferred3_1 = len2;
|
|
161
|
+
return getStringFromWasm0(ptr2, len2);
|
|
162
|
+
} finally {
|
|
163
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Initialize logging for the WASM module.
|
|
169
|
+
*
|
|
170
|
+
* This sets up `tracing` to output to the browser console via `tracing-wasm`.
|
|
171
|
+
* Call this once before using any other functions from this library.
|
|
172
|
+
*/
|
|
173
|
+
export function init_logging() {
|
|
174
|
+
wasm.init_logging();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Verify a JWT against a public key
|
|
179
|
+
*
|
|
180
|
+
* # Arguments
|
|
181
|
+
* * `jwt` - The JWT string to verify (compact format: header.payload.signature)
|
|
182
|
+
* * `public_key_jwk` - The public key as JWK JSON string
|
|
183
|
+
* * `check_expiration` - Whether to check if the JWT has expired (default: true)
|
|
184
|
+
*
|
|
185
|
+
* # Returns
|
|
186
|
+
* A VerificationResult with validity status and decoded claims if valid
|
|
187
|
+
* @param {string} jwt
|
|
188
|
+
* @param {string} public_key_jwk
|
|
189
|
+
* @returns {any}
|
|
190
|
+
*/
|
|
191
|
+
export function verify_jwt(jwt, public_key_jwk) {
|
|
192
|
+
const ptr0 = passStringToWasm0(jwt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
193
|
+
const len0 = WASM_VECTOR_LEN;
|
|
194
|
+
const ptr1 = passStringToWasm0(public_key_jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
195
|
+
const len1 = WASM_VECTOR_LEN;
|
|
196
|
+
const ret = wasm.verify_jwt(ptr0, len0, ptr1, len1);
|
|
197
|
+
if (ret[2]) {
|
|
198
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
199
|
+
}
|
|
200
|
+
return takeFromExternrefTable0(ret[0]);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
204
|
+
|
|
205
|
+
async function __wbg_load(module, imports) {
|
|
206
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
207
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
208
|
+
try {
|
|
209
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
210
|
+
} catch (e) {
|
|
211
|
+
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
212
|
+
|
|
213
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
214
|
+
console.warn("`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", e);
|
|
215
|
+
|
|
216
|
+
} else {
|
|
217
|
+
throw e;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const bytes = await module.arrayBuffer();
|
|
223
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
224
|
+
} else {
|
|
225
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
226
|
+
|
|
227
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
228
|
+
return { instance, module };
|
|
229
|
+
} else {
|
|
230
|
+
return instance;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function __wbg_get_imports() {
|
|
236
|
+
const imports = {};
|
|
237
|
+
imports.wbg = {};
|
|
238
|
+
imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
|
|
239
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
240
|
+
return ret;
|
|
241
|
+
};
|
|
242
|
+
imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
|
|
243
|
+
const ret = typeof(arg0) === 'function';
|
|
244
|
+
return ret;
|
|
245
|
+
};
|
|
246
|
+
imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
|
|
247
|
+
const val = arg0;
|
|
248
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
249
|
+
return ret;
|
|
250
|
+
};
|
|
251
|
+
imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
|
|
252
|
+
const ret = typeof(arg0) === 'string';
|
|
253
|
+
return ret;
|
|
254
|
+
};
|
|
255
|
+
imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
|
|
256
|
+
const ret = arg0 === undefined;
|
|
257
|
+
return ret;
|
|
258
|
+
};
|
|
259
|
+
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
260
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
261
|
+
};
|
|
262
|
+
imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
263
|
+
const ret = arg0.call(arg1, arg2);
|
|
264
|
+
return ret;
|
|
265
|
+
}, arguments) };
|
|
266
|
+
imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
|
|
267
|
+
const ret = arg0.call(arg1);
|
|
268
|
+
return ret;
|
|
269
|
+
}, arguments) };
|
|
270
|
+
imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
|
|
271
|
+
const ret = arg0.crypto;
|
|
272
|
+
return ret;
|
|
273
|
+
};
|
|
274
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
275
|
+
let deferred0_0;
|
|
276
|
+
let deferred0_1;
|
|
277
|
+
try {
|
|
278
|
+
deferred0_0 = arg0;
|
|
279
|
+
deferred0_1 = arg1;
|
|
280
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
281
|
+
} finally {
|
|
282
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
|
|
286
|
+
arg0.getRandomValues(arg1);
|
|
287
|
+
}, arguments) };
|
|
288
|
+
imports.wbg.__wbg_getTime_ad1e9878a735af08 = function(arg0) {
|
|
289
|
+
const ret = arg0.getTime();
|
|
290
|
+
return ret;
|
|
291
|
+
};
|
|
292
|
+
imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
|
|
293
|
+
const ret = arg0.length;
|
|
294
|
+
return ret;
|
|
295
|
+
};
|
|
296
|
+
imports.wbg.__wbg_log_0cc1b7768397bcfe = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
|
|
297
|
+
let deferred0_0;
|
|
298
|
+
let deferred0_1;
|
|
299
|
+
try {
|
|
300
|
+
deferred0_0 = arg0;
|
|
301
|
+
deferred0_1 = arg1;
|
|
302
|
+
console.log(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7));
|
|
303
|
+
} finally {
|
|
304
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
imports.wbg.__wbg_log_cb9e190acc5753fb = function(arg0, arg1) {
|
|
308
|
+
let deferred0_0;
|
|
309
|
+
let deferred0_1;
|
|
310
|
+
try {
|
|
311
|
+
deferred0_0 = arg0;
|
|
312
|
+
deferred0_1 = arg1;
|
|
313
|
+
console.log(getStringFromWasm0(arg0, arg1));
|
|
314
|
+
} finally {
|
|
315
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
imports.wbg.__wbg_mark_7438147ce31e9d4b = function(arg0, arg1) {
|
|
319
|
+
performance.mark(getStringFromWasm0(arg0, arg1));
|
|
320
|
+
};
|
|
321
|
+
imports.wbg.__wbg_measure_fb7825c11612c823 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
322
|
+
let deferred0_0;
|
|
323
|
+
let deferred0_1;
|
|
324
|
+
let deferred1_0;
|
|
325
|
+
let deferred1_1;
|
|
326
|
+
try {
|
|
327
|
+
deferred0_0 = arg0;
|
|
328
|
+
deferred0_1 = arg1;
|
|
329
|
+
deferred1_0 = arg2;
|
|
330
|
+
deferred1_1 = arg3;
|
|
331
|
+
performance.measure(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
|
|
332
|
+
} finally {
|
|
333
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
334
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
335
|
+
}
|
|
336
|
+
}, arguments) };
|
|
337
|
+
imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
|
|
338
|
+
const ret = arg0.msCrypto;
|
|
339
|
+
return ret;
|
|
340
|
+
};
|
|
341
|
+
imports.wbg.__wbg_new_0_23cedd11d9b40c9d = function() {
|
|
342
|
+
const ret = new Date();
|
|
343
|
+
return ret;
|
|
344
|
+
};
|
|
345
|
+
imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
|
|
346
|
+
const ret = new Object();
|
|
347
|
+
return ret;
|
|
348
|
+
};
|
|
349
|
+
imports.wbg.__wbg_new_25f239778d6112b9 = function() {
|
|
350
|
+
const ret = new Array();
|
|
351
|
+
return ret;
|
|
352
|
+
};
|
|
353
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
354
|
+
const ret = new Error();
|
|
355
|
+
return ret;
|
|
356
|
+
};
|
|
357
|
+
imports.wbg.__wbg_new_b546ae120718850e = function() {
|
|
358
|
+
const ret = new Map();
|
|
359
|
+
return ret;
|
|
360
|
+
};
|
|
361
|
+
imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
|
|
362
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
363
|
+
return ret;
|
|
364
|
+
};
|
|
365
|
+
imports.wbg.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {
|
|
366
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
367
|
+
return ret;
|
|
368
|
+
};
|
|
369
|
+
imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
|
|
370
|
+
const ret = arg0.node;
|
|
371
|
+
return ret;
|
|
372
|
+
};
|
|
373
|
+
imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
|
|
374
|
+
const ret = arg0.process;
|
|
375
|
+
return ret;
|
|
376
|
+
};
|
|
377
|
+
imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
|
|
378
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
379
|
+
};
|
|
380
|
+
imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
|
|
381
|
+
arg0.randomFillSync(arg1);
|
|
382
|
+
}, arguments) };
|
|
383
|
+
imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
|
|
384
|
+
const ret = module.require;
|
|
385
|
+
return ret;
|
|
386
|
+
}, arguments) };
|
|
387
|
+
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
388
|
+
arg0[arg1] = arg2;
|
|
389
|
+
};
|
|
390
|
+
imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
|
|
391
|
+
arg0[arg1 >>> 0] = arg2;
|
|
392
|
+
};
|
|
393
|
+
imports.wbg.__wbg_set_efaaf145b9377369 = function(arg0, arg1, arg2) {
|
|
394
|
+
const ret = arg0.set(arg1, arg2);
|
|
395
|
+
return ret;
|
|
396
|
+
};
|
|
397
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
398
|
+
const ret = arg1.stack;
|
|
399
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
400
|
+
const len1 = WASM_VECTOR_LEN;
|
|
401
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
402
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
403
|
+
};
|
|
404
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
|
|
405
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
406
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
407
|
+
};
|
|
408
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
|
|
409
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
410
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
411
|
+
};
|
|
412
|
+
imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
|
|
413
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
414
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
415
|
+
};
|
|
416
|
+
imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
|
|
417
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
418
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
419
|
+
};
|
|
420
|
+
imports.wbg.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
|
|
421
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
422
|
+
return ret;
|
|
423
|
+
};
|
|
424
|
+
imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
|
|
425
|
+
const ret = arg0.versions;
|
|
426
|
+
return ret;
|
|
427
|
+
};
|
|
428
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
429
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
430
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
431
|
+
return ret;
|
|
432
|
+
};
|
|
433
|
+
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
434
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
435
|
+
const ret = arg0;
|
|
436
|
+
return ret;
|
|
437
|
+
};
|
|
438
|
+
imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
439
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
440
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
441
|
+
return ret;
|
|
442
|
+
};
|
|
443
|
+
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
444
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
445
|
+
const ret = arg0;
|
|
446
|
+
return ret;
|
|
447
|
+
};
|
|
448
|
+
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
449
|
+
const table = wasm.__wbindgen_externrefs;
|
|
450
|
+
const offset = table.grow(4);
|
|
451
|
+
table.set(0, undefined);
|
|
452
|
+
table.set(offset + 0, undefined);
|
|
453
|
+
table.set(offset + 1, null);
|
|
454
|
+
table.set(offset + 2, true);
|
|
455
|
+
table.set(offset + 3, false);
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
return imports;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
function __wbg_finalize_init(instance, module) {
|
|
462
|
+
wasm = instance.exports;
|
|
463
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
464
|
+
cachedDataViewMemory0 = null;
|
|
465
|
+
cachedUint8ArrayMemory0 = null;
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
wasm.__wbindgen_start();
|
|
469
|
+
return wasm;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
function initSync(module) {
|
|
473
|
+
if (wasm !== undefined) return wasm;
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
if (typeof module !== 'undefined') {
|
|
477
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
478
|
+
({module} = module)
|
|
479
|
+
} else {
|
|
480
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
const imports = __wbg_get_imports();
|
|
485
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
486
|
+
module = new WebAssembly.Module(module);
|
|
487
|
+
}
|
|
488
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
489
|
+
return __wbg_finalize_init(instance, module);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
async function __wbg_init(module_or_path) {
|
|
493
|
+
if (wasm !== undefined) return wasm;
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
if (typeof module_or_path !== 'undefined') {
|
|
497
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
498
|
+
({module_or_path} = module_or_path)
|
|
499
|
+
} else {
|
|
500
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
if (typeof module_or_path === 'undefined') {
|
|
505
|
+
module_or_path = new URL('agentium_sdk_wasm_bg.wasm', import.meta.url);
|
|
506
|
+
}
|
|
507
|
+
const imports = __wbg_get_imports();
|
|
508
|
+
|
|
509
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
510
|
+
module_or_path = fetch(module_or_path);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
514
|
+
|
|
515
|
+
return __wbg_finalize_init(instance, module);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
export { initSync };
|
|
519
|
+
export default __wbg_init;
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const generate_keypair: () => [number, number, number];
|
|
5
|
+
export const get_public_key: (a: number, b: number) => [number, number, number, number];
|
|
6
|
+
export const init_logging: () => void;
|
|
7
|
+
export const verify_jwt: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
8
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
9
|
+
export const __externref_table_alloc: () => number;
|
|
10
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
11
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
12
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
13
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
14
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
15
|
+
export const __wbindgen_start: () => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@semiotic-labs/agentium-sdk-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "WASM library for Agentium SDK - JWT-VC verification",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"files": [
|
|
7
|
+
"agentium_sdk_wasm_bg.wasm",
|
|
8
|
+
"agentium_sdk_wasm.js",
|
|
9
|
+
"agentium_sdk_wasm.d.ts"
|
|
10
|
+
],
|
|
11
|
+
"main": "agentium_sdk_wasm.js",
|
|
12
|
+
"types": "agentium_sdk_wasm.d.ts",
|
|
13
|
+
"sideEffects": [
|
|
14
|
+
"./snippets/*"
|
|
15
|
+
]
|
|
16
|
+
}
|