@enclave-e3/wasm 0.1.4 → 0.1.6

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.
@@ -19,7 +19,27 @@
19
19
  *
20
20
  * Panics if the data cannot be encrypted
21
21
  */
22
- export function bfv_encrypt_number(data: bigint, public_key: Uint8Array, degree: number, plaintext_modulus: bigint, moduli: bigint): Uint8Array;
22
+ export function bfv_encrypt_number(data: bigint, public_key: Uint8Array, degree: number, plaintext_modulus: bigint, moduli: BigUint64Array): Uint8Array;
23
+ /**
24
+ * A function to encrypt a Vec<u64> value using BFV and default params.
25
+ *
26
+ * # Arguments
27
+ *
28
+ * * `data` - The data to encrypt - must be a Vec<u64>
29
+ * * `public_key` - The public key to be used for encryption
30
+ * * `degree` - Polynomial degree for BFV parameters
31
+ * * `plaintext_modulus` - Plaintext modulus for BFV parameters
32
+ * * `moduli` - Modulus for BFV parameters
33
+ *
34
+ * # Returns
35
+ *
36
+ * Returns a `Result<Vec<u8>, JsValue>` containing the encrypted data and any errors.
37
+ *
38
+ * # Panics
39
+ *
40
+ * Panics if the data cannot be encrypted
41
+ */
42
+ export function bfv_encrypt_vector(data: BigUint64Array, public_key: Uint8Array, degree: number, plaintext_modulus: bigint, moduli: BigUint64Array): Uint8Array;
23
43
  /**
24
44
  * A function to encrypt a u64 value using BFV and default params and
25
45
  * generate circuit inputs for Greco
@@ -40,19 +60,75 @@ export function bfv_encrypt_number(data: bigint, public_key: Uint8Array, degree:
40
60
  *
41
61
  * Panics if the data cannot be encrypted
42
62
  */
43
- export function bfv_verifiable_encrypt_number(data: bigint, public_key: Uint8Array, degree: number, plaintext_modulus: bigint, moduli: bigint): any[];
63
+ export function bfv_verifiable_encrypt_number(data: bigint, public_key: Uint8Array, degree: number, plaintext_modulus: bigint, moduli: BigUint64Array): any[];
64
+ /**
65
+ * A function to encrypt a Vec<u64> value using BFV and default params and
66
+ * generate circuit inputs for Greco
67
+ *
68
+ * # Arguments
69
+ *
70
+ * * `data` - The data to encrypt - must be a Vec<u64>
71
+ * * `public_key` - The public key to be used for encryption
72
+ * * `degree` - Polynomial degree for BFV parameters
73
+ * * `plaintext_modulus` - Plaintext modulus for BFV parameters
74
+ * * `moduli` - Modulus for BFV parameters
75
+ *
76
+ * # Returns
77
+ *
78
+ * Returns a `Result<Vec<JsValue>, JsValue>` containing the encrypted data, circuit inputs and any errors.
79
+ *
80
+ * # Panics
81
+ *
82
+ * Panics if the data cannot be encrypted
83
+ */
84
+ export function bfv_verifiable_encrypt_vector(data: BigUint64Array, public_key: Uint8Array, degree: number, plaintext_modulus: bigint, moduli: BigUint64Array): any[];
85
+ /**
86
+ * Retrieves a BFV parameter set by name.
87
+ *
88
+ * # Parameters
89
+ * * `name` - Parameter set identifier (e.g., "SET_8192_1000_4")
90
+ *
91
+ * # Returns
92
+ * A JavaScript object with the following structure:
93
+ * ```typescript
94
+ * {
95
+ * degree: number; // Polynomial degree (e.g., 8192)
96
+ * plaintext_modulus: number; // Plaintext modulus value (e.g., 1000)
97
+ * moduli: bigint[]; // Array of moduli
98
+ * error1_variance: string | null; // Error variance as string or null
99
+ * }
100
+ * ```
101
+ *
102
+ * # Errors
103
+ * Returns error if the parameter set name is invalid or serialization fails.
104
+ */
105
+ export function get_bfv_params(name: string): any;
106
+ /**
107
+ * Returns all available BFV parameter set identifiers.
108
+ *
109
+ * # Returns
110
+ * Array of parameter set names that can be passed to `get_bfv_params()`.
111
+ * Includes both production-ready sets (e.g., "SET_8192_1000_4") and
112
+ * insecure sets for testing (prefixed with "INSECURE_").
113
+ */
114
+ export function get_bfv_params_list(): string[];
44
115
 
45
116
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
46
117
 
47
118
  export interface InitOutput {
48
119
  readonly memory: WebAssembly.Memory;
49
- readonly bfv_encrypt_number: (a: bigint, b: number, c: number, d: number, e: bigint, f: bigint) => [number, number, number, number];
50
- readonly bfv_verifiable_encrypt_number: (a: bigint, b: number, c: number, d: number, e: bigint, f: bigint) => [number, number, number, number];
120
+ readonly bfv_encrypt_number: (a: bigint, b: number, c: number, d: number, e: bigint, f: number, g: number) => [number, number, number, number];
121
+ readonly bfv_encrypt_vector: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number) => [number, number, number, number];
122
+ readonly bfv_verifiable_encrypt_number: (a: bigint, b: number, c: number, d: number, e: bigint, f: number, g: number) => [number, number, number, number];
123
+ readonly bfv_verifiable_encrypt_vector: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number) => [number, number, number, number];
124
+ readonly get_bfv_params: (a: number, b: number) => [number, number, number];
125
+ readonly get_bfv_params_list: () => [number, number];
126
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
127
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
51
128
  readonly __wbindgen_exn_store: (a: number) => void;
52
129
  readonly __externref_table_alloc: () => number;
53
- readonly __wbindgen_export_2: WebAssembly.Table;
130
+ readonly __wbindgen_externrefs: WebAssembly.Table;
54
131
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
55
- readonly __wbindgen_malloc: (a: number, b: number) => number;
56
132
  readonly __externref_table_dealloc: (a: number) => void;
57
133
  readonly __externref_drop_slice: (a: number, b: number) => void;
58
134
  readonly __wbindgen_start: () => void;