@enclave-e3/wasm 0.0.12-test → 0.0.14-test
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/web/e3_wasm.js +2 -2
- package/dist/web/e3_wasm_base64.js +1 -0
- package/init_web.js +21 -2
- package/package.json +10 -6
- package/dist/nodejs/.gitignore +0 -1
- package/dist/nodejs/README.md +0 -35
- package/dist/nodejs/package.json +0 -17
- package/dist/web/.gitignore +0 -1
- package/dist/web/README.md +0 -35
- package/dist/web/e3_wasm_bg.wasm +0 -0
- package/dist/web/e3_wasm_bg.wasm.d.ts +0 -13
- package/dist/web/package.json +0 -21
- /package/dist/{nodejs → node}/e3_wasm.d.ts +0 -0
- /package/dist/{nodejs → node}/e3_wasm.js +0 -0
- /package/dist/{nodejs → node}/e3_wasm_bg.wasm +0 -0
- /package/dist/{nodejs → node}/e3_wasm_bg.wasm.d.ts +0 -0
package/init_web.js
CHANGED
|
@@ -4,7 +4,26 @@
|
|
|
4
4
|
// without even the implied warranty of MERCHANTABILITY
|
|
5
5
|
// or FITNESS FOR A PARTICULAR PURPOSE.
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import * as bindgen from "./dist/web/e3_wasm.js";
|
|
8
|
+
|
|
9
|
+
let promise;
|
|
10
|
+
|
|
8
11
|
export default async function initializeWasm(initParams) {
|
|
9
|
-
|
|
12
|
+
promise ??= (async () => {
|
|
13
|
+
const { default: base64 } = await import("./dist/web/e3_wasm_base64.js");
|
|
14
|
+
|
|
15
|
+
const binaryString = atob(base64);
|
|
16
|
+
const len = binaryString.length;
|
|
17
|
+
const bytes = new Uint8Array(len);
|
|
18
|
+
|
|
19
|
+
for (let i = 0; i < len; i++) {
|
|
20
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
bindgen.initSync(bytes);
|
|
24
|
+
|
|
25
|
+
return bindgen;
|
|
26
|
+
})();
|
|
27
|
+
|
|
28
|
+
return promise;
|
|
10
29
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enclave-e3/wasm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14-test",
|
|
4
4
|
"description": "Wasm modules for enclave.",
|
|
5
|
-
"main": "dist/
|
|
5
|
+
"main": "dist/node/e3_wasm.js",
|
|
6
6
|
"module": "dist/web/e3_wasm.js",
|
|
7
7
|
"types": "dist/web/e3_wasm.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist/",
|
|
10
|
-
"dist/
|
|
10
|
+
"dist/node/**",
|
|
11
11
|
"dist/web/**",
|
|
12
12
|
"init_node.js",
|
|
13
13
|
"init_node.cjs",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
22
|
"node": {
|
|
23
|
-
"types": "./dist/
|
|
24
|
-
"default": "./dist/
|
|
23
|
+
"types": "./dist/node/e3_wasm.d.ts",
|
|
24
|
+
"default": "./dist/node/e3_wasm.js"
|
|
25
25
|
},
|
|
26
26
|
"browser": {
|
|
27
27
|
"types": "./dist/web/e3_wasm.d.ts",
|
|
@@ -56,8 +56,12 @@
|
|
|
56
56
|
"url": "https://github.com/gnosisguild"
|
|
57
57
|
},
|
|
58
58
|
"license": "LGPL-3.0-only",
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"execa": "^8.0.1",
|
|
61
|
+
"replace-in-file": "^7.2.0"
|
|
62
|
+
},
|
|
59
63
|
"scripts": {
|
|
60
|
-
"build": "
|
|
64
|
+
"build": "rm -rf dist && node scripts/build.js",
|
|
61
65
|
"prerelease": "pnpm build",
|
|
62
66
|
"release": "pnpm publish --access=public"
|
|
63
67
|
}
|
package/dist/nodejs/.gitignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
*
|
package/dist/nodejs/README.md
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# Wasm bundle for enclave
|
|
2
|
-
|
|
3
|
-
Here we export wasm funcionality for consumption in typescript to enable use to share code between Rust and Typescript.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
This package exposes an `init` subpackage default function which should be used to universally load the wasm module instead of exporting the default loader.
|
|
8
|
-
|
|
9
|
-
This is because in modern node there is no need for preloading however in the browser we still need to load the wasm bundle.
|
|
10
|
-
|
|
11
|
-
##### ❌ DONT USE THE DEFAULT INIT
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
// Bad! Because this uses the raw loader which doesn't exist in node contexts
|
|
15
|
-
import init, { bfvEncryptNumber } from "@enclave-e3/wasm";
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
##### ✅ DO USE THE EXPORTED SUBMODULE
|
|
19
|
-
|
|
20
|
-
```ts
|
|
21
|
-
// Good! Use the universal loader
|
|
22
|
-
import init from "@enclave-e3/wasm/init";
|
|
23
|
-
import { bfvEncryptNumber } from "@enclave-e3/wasm";
|
|
24
|
-
|
|
25
|
-
export async function bfvEncryptNumber(
|
|
26
|
-
data: bigint,
|
|
27
|
-
public_key: Uint8Array,
|
|
28
|
-
degree: number,
|
|
29
|
-
plaintext_modulus: bigint,
|
|
30
|
-
moduli: bigint,
|
|
31
|
-
): Promise<Uint8Array> {
|
|
32
|
-
await init();
|
|
33
|
-
return bfv_encrypt_number(data, public_key, degree, plaintext_modulus, moduli);
|
|
34
|
-
}
|
|
35
|
-
```
|
package/dist/nodejs/package.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "e3-wasm",
|
|
3
|
-
"description": "E3 — Encrypted Execution Environments",
|
|
4
|
-
"version": "0.0.1-test",
|
|
5
|
-
"license": "LGPL-3.0-only",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "https://github.com/gnosisguild/enclave"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"e3_wasm_bg.wasm",
|
|
12
|
-
"e3_wasm.js",
|
|
13
|
-
"e3_wasm.d.ts"
|
|
14
|
-
],
|
|
15
|
-
"main": "e3_wasm.js",
|
|
16
|
-
"types": "e3_wasm.d.ts"
|
|
17
|
-
}
|
package/dist/web/.gitignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
*
|
package/dist/web/README.md
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# Wasm bundle for enclave
|
|
2
|
-
|
|
3
|
-
Here we export wasm funcionality for consumption in typescript to enable use to share code between Rust and Typescript.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
This package exposes an `init` subpackage default function which should be used to universally load the wasm module instead of exporting the default loader.
|
|
8
|
-
|
|
9
|
-
This is because in modern node there is no need for preloading however in the browser we still need to load the wasm bundle.
|
|
10
|
-
|
|
11
|
-
##### ❌ DONT USE THE DEFAULT INIT
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
// Bad! Because this uses the raw loader which doesn't exist in node contexts
|
|
15
|
-
import init, { bfvEncryptNumber } from "@enclave-e3/wasm";
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
##### ✅ DO USE THE EXPORTED SUBMODULE
|
|
19
|
-
|
|
20
|
-
```ts
|
|
21
|
-
// Good! Use the universal loader
|
|
22
|
-
import init from "@enclave-e3/wasm/init";
|
|
23
|
-
import { bfvEncryptNumber } from "@enclave-e3/wasm";
|
|
24
|
-
|
|
25
|
-
export async function bfvEncryptNumber(
|
|
26
|
-
data: bigint,
|
|
27
|
-
public_key: Uint8Array,
|
|
28
|
-
degree: number,
|
|
29
|
-
plaintext_modulus: bigint,
|
|
30
|
-
moduli: bigint,
|
|
31
|
-
): Promise<Uint8Array> {
|
|
32
|
-
await init();
|
|
33
|
-
return bfv_encrypt_number(data, public_key, degree, plaintext_modulus, moduli);
|
|
34
|
-
}
|
|
35
|
-
```
|
package/dist/web/e3_wasm_bg.wasm
DELETED
|
Binary file
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const bfv_encrypt_number: (a: bigint, b: number, c: number, d: number, e: bigint, f: bigint) => [number, number, number, number];
|
|
5
|
-
export const bfv_verifiable_encrypt_number: (a: bigint, b: number, c: number, d: number, e: bigint, f: bigint) => [number, number, number, number];
|
|
6
|
-
export const __wbindgen_exn_store: (a: number) => void;
|
|
7
|
-
export const __externref_table_alloc: () => number;
|
|
8
|
-
export const __wbindgen_export_2: WebAssembly.Table;
|
|
9
|
-
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
10
|
-
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
11
|
-
export const __externref_table_dealloc: (a: number) => void;
|
|
12
|
-
export const __externref_drop_slice: (a: number, b: number) => void;
|
|
13
|
-
export const __wbindgen_start: () => void;
|
package/dist/web/package.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "e3-wasm",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"description": "E3 — Encrypted Execution Environments",
|
|
5
|
-
"version": "0.0.1-test",
|
|
6
|
-
"license": "LGPL-3.0-only",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/gnosisguild/enclave"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"e3_wasm_bg.wasm",
|
|
13
|
-
"e3_wasm.js",
|
|
14
|
-
"e3_wasm.d.ts"
|
|
15
|
-
],
|
|
16
|
-
"main": "e3_wasm.js",
|
|
17
|
-
"types": "e3_wasm.d.ts",
|
|
18
|
-
"sideEffects": [
|
|
19
|
-
"./snippets/*"
|
|
20
|
-
]
|
|
21
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|