hpke 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -6
- package/pkg/node/hpke_dispatch.d.ts +26 -26
- package/pkg/node/hpke_dispatch.js +107 -98
- package/pkg/node/hpke_dispatch_bg.wasm +0 -0
- package/pkg/node/hpke_dispatch_bg.wasm.d.ts +13 -13
- package/pkg/node/package.json +1 -1
- package/pkg/web/hpke_dispatch.d.ts +50 -39
- package/pkg/web/hpke_dispatch.js +145 -105
- package/pkg/web/hpke_dispatch_bg.wasm +0 -0
- package/pkg/web/hpke_dispatch_bg.wasm.d.ts +13 -13
- package/pkg/web/index.mjs +1 -1
- package/pkg/web/index.mjs.map +2 -2
- package/pkg/web/package.json +1 -1
- package/pkg/node/index.js +0 -32
- package/pkg/node/index.js.map +0 -7
- package/pkg/node/index.spec.js +0 -59
- package/pkg/node/index.spec.js.map +0 -7
- package/pkg/node/index.ts +0 -6
- package/pkg/node/node.ts +0 -6
- package/pkg/node/tests.js +0 -57
|
@@ -2,32 +2,6 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
|
-
*`base_mode_open` provides an interface to [`hpke::single_shot_open`]
|
|
6
|
-
*that does not require compile time selection of an algorithm. Instead,
|
|
7
|
-
*the selected algorithm is provided through the [`Config`] passed as
|
|
8
|
-
*the first argument.
|
|
9
|
-
*
|
|
10
|
-
*Requires the `base-mode-open` crate feature to be enabled.
|
|
11
|
-
*
|
|
12
|
-
*# Errors
|
|
13
|
-
*
|
|
14
|
-
*This will return an `Result::Err` variant if:
|
|
15
|
-
*
|
|
16
|
-
** we are unable to deserialize the private key or encapsulated key
|
|
17
|
-
** there is an error in key decapsulation
|
|
18
|
-
** there is an error in decryption
|
|
19
|
-
*
|
|
20
|
-
* @param {Config} config
|
|
21
|
-
* @param {Uint8Array} private_key
|
|
22
|
-
* @param {Uint8Array} encapped_key
|
|
23
|
-
* @param {Uint8Array} info
|
|
24
|
-
* @param {Uint8Array} ciphertext
|
|
25
|
-
* @param {Uint8Array} aad
|
|
26
|
-
* @returns {Uint8Array}
|
|
27
|
-
*/
|
|
28
|
-
export function base_mode_open(config: Config, private_key: Uint8Array, encapped_key: Uint8Array, info: Uint8Array, ciphertext: Uint8Array, aad: Uint8Array): Uint8Array;
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
5
|
*`base_mode_seal` provides an interface to [`hpke::single_shot_seal`]
|
|
32
6
|
*that does not require compile time selection of an
|
|
33
7
|
*algorithm. Instead, the selected algorithm is provided through the
|
|
@@ -54,6 +28,32 @@ export function base_mode_open(config: Config, private_key: Uint8Array, encapped
|
|
|
54
28
|
export function base_mode_seal(config: Config, recipient_public_key: Uint8Array, info: Uint8Array, plaintext: Uint8Array, aad: Uint8Array): EncappedKeyAndCiphertext;
|
|
55
29
|
/**
|
|
56
30
|
*
|
|
31
|
+
*`base_mode_open` provides an interface to [`hpke::single_shot_open`]
|
|
32
|
+
*that does not require compile time selection of an algorithm. Instead,
|
|
33
|
+
*the selected algorithm is provided through the [`Config`] passed as
|
|
34
|
+
*the first argument.
|
|
35
|
+
*
|
|
36
|
+
*Requires the `base-mode-open` crate feature to be enabled.
|
|
37
|
+
*
|
|
38
|
+
*# Errors
|
|
39
|
+
*
|
|
40
|
+
*This will return an `Result::Err` variant if:
|
|
41
|
+
*
|
|
42
|
+
** we are unable to deserialize the private key or encapsulated key
|
|
43
|
+
** there is an error in key decapsulation
|
|
44
|
+
** there is an error in decryption
|
|
45
|
+
*
|
|
46
|
+
* @param {Config} config
|
|
47
|
+
* @param {Uint8Array} private_key
|
|
48
|
+
* @param {Uint8Array} encapped_key
|
|
49
|
+
* @param {Uint8Array} info
|
|
50
|
+
* @param {Uint8Array} ciphertext
|
|
51
|
+
* @param {Uint8Array} aad
|
|
52
|
+
* @returns {Uint8Array}
|
|
53
|
+
*/
|
|
54
|
+
export function base_mode_open(config: Config, private_key: Uint8Array, encapped_key: Uint8Array, info: Uint8Array, ciphertext: Uint8Array, aad: Uint8Array): Uint8Array;
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
57
|
*Aead represents an authenticated encryption with additional data
|
|
58
58
|
*encryption function, as per [RFC9180§7.3](https://www.rfc-editor.org/rfc/rfc9180.html#section-7.3)
|
|
59
59
|
*/
|
|
@@ -244,24 +244,12 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
244
244
|
|
|
245
245
|
export interface InitOutput {
|
|
246
246
|
readonly memory: WebAssembly.Memory;
|
|
247
|
-
readonly base_mode_open: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
|
|
248
|
-
readonly __wbg_config_free: (a: number) => void;
|
|
249
|
-
readonly __wbg_get_config_aead: (a: number) => number;
|
|
250
|
-
readonly __wbg_set_config_aead: (a: number, b: number) => void;
|
|
251
|
-
readonly __wbg_get_config_kdf: (a: number) => number;
|
|
252
|
-
readonly __wbg_set_config_kdf: (a: number, b: number) => void;
|
|
253
|
-
readonly __wbg_get_config_kem: (a: number) => number;
|
|
254
|
-
readonly __wbg_set_config_kem: (a: number, b: number) => void;
|
|
255
|
-
readonly config_base_mode_seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
256
|
-
readonly config_base_mode_open: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
|
|
257
|
-
readonly config_try_from_ids: (a: number, b: number, c: number, d: number) => void;
|
|
258
247
|
readonly __wbg_keypair_free: (a: number) => void;
|
|
259
248
|
readonly __wbg_get_keypair_public_key: (a: number, b: number) => void;
|
|
260
249
|
readonly __wbg_set_keypair_public_key: (a: number, b: number, c: number) => void;
|
|
261
250
|
readonly __wbg_get_keypair_private_key: (a: number, b: number) => void;
|
|
262
251
|
readonly __wbg_set_keypair_private_key: (a: number, b: number, c: number) => void;
|
|
263
252
|
readonly keypair_new: (a: number) => number;
|
|
264
|
-
readonly base_mode_seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
265
253
|
readonly __wbg_encappedkeyandciphertext_free: (a: number) => void;
|
|
266
254
|
readonly __wbg_get_encappedkeyandciphertext_encapped_key: (a: number, b: number) => void;
|
|
267
255
|
readonly __wbg_set_encappedkeyandciphertext_encapped_key: (a: number, b: number, c: number) => void;
|
|
@@ -269,12 +257,35 @@ export interface InitOutput {
|
|
|
269
257
|
readonly __wbg_set_encappedkeyandciphertext_ciphertext: (a: number, b: number, c: number) => void;
|
|
270
258
|
readonly __wbg_idlookuperror_free: (a: number) => void;
|
|
271
259
|
readonly __wbg_hpkeerror_free: (a: number) => void;
|
|
260
|
+
readonly base_mode_seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
261
|
+
readonly base_mode_open: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
|
|
262
|
+
readonly __wbg_config_free: (a: number) => void;
|
|
263
|
+
readonly __wbg_get_config_aead: (a: number) => number;
|
|
264
|
+
readonly __wbg_set_config_aead: (a: number, b: number) => void;
|
|
265
|
+
readonly __wbg_get_config_kdf: (a: number) => number;
|
|
266
|
+
readonly __wbg_set_config_kdf: (a: number, b: number) => void;
|
|
267
|
+
readonly __wbg_get_config_kem: (a: number) => number;
|
|
268
|
+
readonly __wbg_set_config_kem: (a: number, b: number) => void;
|
|
269
|
+
readonly config_base_mode_seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
270
|
+
readonly config_base_mode_open: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
|
|
271
|
+
readonly config_try_from_ids: (a: number, b: number, c: number, d: number) => void;
|
|
272
272
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
273
|
-
readonly __wbindgen_malloc: (a: number) => number;
|
|
274
273
|
readonly __wbindgen_free: (a: number, b: number) => void;
|
|
274
|
+
readonly __wbindgen_malloc: (a: number) => number;
|
|
275
275
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
279
|
+
/**
|
|
280
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
281
|
+
* a precompiled `WebAssembly.Module`.
|
|
282
|
+
*
|
|
283
|
+
* @param {SyncInitInput} module
|
|
284
|
+
*
|
|
285
|
+
* @returns {InitOutput}
|
|
286
|
+
*/
|
|
287
|
+
export function initSync(module: SyncInitInput): InitOutput;
|
|
288
|
+
|
|
278
289
|
/**
|
|
279
290
|
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
280
291
|
* for everything else, calls `WebAssembly.instantiate` directly.
|
package/pkg/web/hpke_dispatch.js
CHANGED
|
@@ -34,23 +34,30 @@ const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: tru
|
|
|
34
34
|
|
|
35
35
|
cachedTextDecoder.decode();
|
|
36
36
|
|
|
37
|
-
let
|
|
37
|
+
let cachedUint8Memory0 = new Uint8Array();
|
|
38
|
+
|
|
38
39
|
function getUint8Memory0() {
|
|
39
|
-
if (
|
|
40
|
-
|
|
40
|
+
if (cachedUint8Memory0.byteLength === 0) {
|
|
41
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
41
42
|
}
|
|
42
|
-
return
|
|
43
|
+
return cachedUint8Memory0;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
function getStringFromWasm0(ptr, len) {
|
|
46
47
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
let cachedInt32Memory0 = new Int32Array();
|
|
51
|
+
|
|
52
|
+
function getInt32Memory0() {
|
|
53
|
+
if (cachedInt32Memory0.byteLength === 0) {
|
|
54
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
52
55
|
}
|
|
53
|
-
return
|
|
56
|
+
return cachedInt32Memory0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
60
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
let WASM_VECTOR_LEN = 0;
|
|
@@ -62,67 +69,57 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
62
69
|
return ptr;
|
|
63
70
|
}
|
|
64
71
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
72
|
+
function _assertClass(instance, klass) {
|
|
73
|
+
if (!(instance instanceof klass)) {
|
|
74
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
69
75
|
}
|
|
70
|
-
return
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
74
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
76
|
+
return instance.ptr;
|
|
75
77
|
}
|
|
76
78
|
/**
|
|
77
79
|
*
|
|
78
|
-
*`
|
|
79
|
-
*that does not require compile time selection of an
|
|
80
|
-
*the selected algorithm is provided through the
|
|
81
|
-
*the first argument.
|
|
80
|
+
*`base_mode_seal` provides an interface to [`hpke::single_shot_seal`]
|
|
81
|
+
*that does not require compile time selection of an
|
|
82
|
+
*algorithm. Instead, the selected algorithm is provided through the
|
|
83
|
+
*[`Config`] passed as the first argument.
|
|
82
84
|
*
|
|
83
|
-
*Requires the `base-mode-
|
|
85
|
+
*Requires the `base-mode-seal` crate feature to be enabled.
|
|
84
86
|
*
|
|
85
87
|
*# Errors
|
|
86
88
|
*
|
|
87
89
|
*This will return an `Result::Err` variant if:
|
|
88
90
|
*
|
|
89
|
-
** we are unable to deserialize the
|
|
90
|
-
** there is an error in key
|
|
91
|
-
** there is an error in
|
|
91
|
+
** we are unable to deserialize the recipient public key
|
|
92
|
+
** there is an error in key encapsultion
|
|
93
|
+
** there is an error in encryption
|
|
94
|
+
*
|
|
92
95
|
*
|
|
93
96
|
* @param {Config} config
|
|
94
|
-
* @param {Uint8Array}
|
|
95
|
-
* @param {Uint8Array} encapped_key
|
|
97
|
+
* @param {Uint8Array} recipient_public_key
|
|
96
98
|
* @param {Uint8Array} info
|
|
97
|
-
* @param {Uint8Array}
|
|
99
|
+
* @param {Uint8Array} plaintext
|
|
98
100
|
* @param {Uint8Array} aad
|
|
99
|
-
* @returns {
|
|
101
|
+
* @returns {EncappedKeyAndCiphertext}
|
|
100
102
|
*/
|
|
101
|
-
export function
|
|
103
|
+
export function base_mode_seal(config, recipient_public_key, info, plaintext, aad) {
|
|
102
104
|
try {
|
|
103
105
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
104
106
|
_assertClass(config, Config);
|
|
105
|
-
const ptr0 = passArray8ToWasm0(
|
|
107
|
+
const ptr0 = passArray8ToWasm0(recipient_public_key, wasm.__wbindgen_malloc);
|
|
106
108
|
const len0 = WASM_VECTOR_LEN;
|
|
107
|
-
const ptr1 = passArray8ToWasm0(
|
|
109
|
+
const ptr1 = passArray8ToWasm0(info, wasm.__wbindgen_malloc);
|
|
108
110
|
const len1 = WASM_VECTOR_LEN;
|
|
109
|
-
const ptr2 = passArray8ToWasm0(
|
|
111
|
+
const ptr2 = passArray8ToWasm0(plaintext, wasm.__wbindgen_malloc);
|
|
110
112
|
const len2 = WASM_VECTOR_LEN;
|
|
111
|
-
const ptr3 = passArray8ToWasm0(
|
|
113
|
+
const ptr3 = passArray8ToWasm0(aad, wasm.__wbindgen_malloc);
|
|
112
114
|
const len3 = WASM_VECTOR_LEN;
|
|
113
|
-
|
|
114
|
-
const len4 = WASM_VECTOR_LEN;
|
|
115
|
-
wasm.base_mode_open(retptr, config.ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
|
|
115
|
+
wasm.base_mode_seal(retptr, config.ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
116
116
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
117
117
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
118
118
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
throw takeObject(r2);
|
|
119
|
+
if (r2) {
|
|
120
|
+
throw takeObject(r1);
|
|
122
121
|
}
|
|
123
|
-
|
|
124
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
125
|
-
return v5;
|
|
122
|
+
return EncappedKeyAndCiphertext.__wrap(r0);
|
|
126
123
|
} finally {
|
|
127
124
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
128
125
|
}
|
|
@@ -130,49 +127,54 @@ export function base_mode_open(config, private_key, encapped_key, info, cipherte
|
|
|
130
127
|
|
|
131
128
|
/**
|
|
132
129
|
*
|
|
133
|
-
*`
|
|
134
|
-
*that does not require compile time selection of an
|
|
135
|
-
*
|
|
136
|
-
*
|
|
130
|
+
*`base_mode_open` provides an interface to [`hpke::single_shot_open`]
|
|
131
|
+
*that does not require compile time selection of an algorithm. Instead,
|
|
132
|
+
*the selected algorithm is provided through the [`Config`] passed as
|
|
133
|
+
*the first argument.
|
|
137
134
|
*
|
|
138
|
-
*Requires the `base-mode-
|
|
135
|
+
*Requires the `base-mode-open` crate feature to be enabled.
|
|
139
136
|
*
|
|
140
137
|
*# Errors
|
|
141
138
|
*
|
|
142
139
|
*This will return an `Result::Err` variant if:
|
|
143
140
|
*
|
|
144
|
-
** we are unable to deserialize the
|
|
145
|
-
** there is an error in key
|
|
146
|
-
** there is an error in
|
|
147
|
-
*
|
|
141
|
+
** we are unable to deserialize the private key or encapsulated key
|
|
142
|
+
** there is an error in key decapsulation
|
|
143
|
+
** there is an error in decryption
|
|
148
144
|
*
|
|
149
145
|
* @param {Config} config
|
|
150
|
-
* @param {Uint8Array}
|
|
146
|
+
* @param {Uint8Array} private_key
|
|
147
|
+
* @param {Uint8Array} encapped_key
|
|
151
148
|
* @param {Uint8Array} info
|
|
152
|
-
* @param {Uint8Array}
|
|
149
|
+
* @param {Uint8Array} ciphertext
|
|
153
150
|
* @param {Uint8Array} aad
|
|
154
|
-
* @returns {
|
|
151
|
+
* @returns {Uint8Array}
|
|
155
152
|
*/
|
|
156
|
-
export function
|
|
153
|
+
export function base_mode_open(config, private_key, encapped_key, info, ciphertext, aad) {
|
|
157
154
|
try {
|
|
158
155
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
159
156
|
_assertClass(config, Config);
|
|
160
|
-
const ptr0 = passArray8ToWasm0(
|
|
157
|
+
const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
|
|
161
158
|
const len0 = WASM_VECTOR_LEN;
|
|
162
|
-
const ptr1 = passArray8ToWasm0(
|
|
159
|
+
const ptr1 = passArray8ToWasm0(encapped_key, wasm.__wbindgen_malloc);
|
|
163
160
|
const len1 = WASM_VECTOR_LEN;
|
|
164
|
-
const ptr2 = passArray8ToWasm0(
|
|
161
|
+
const ptr2 = passArray8ToWasm0(info, wasm.__wbindgen_malloc);
|
|
165
162
|
const len2 = WASM_VECTOR_LEN;
|
|
166
|
-
const ptr3 = passArray8ToWasm0(
|
|
163
|
+
const ptr3 = passArray8ToWasm0(ciphertext, wasm.__wbindgen_malloc);
|
|
167
164
|
const len3 = WASM_VECTOR_LEN;
|
|
168
|
-
|
|
165
|
+
const ptr4 = passArray8ToWasm0(aad, wasm.__wbindgen_malloc);
|
|
166
|
+
const len4 = WASM_VECTOR_LEN;
|
|
167
|
+
wasm.base_mode_open(retptr, config.ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
|
|
169
168
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
170
169
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
171
170
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
172
|
+
if (r3) {
|
|
173
|
+
throw takeObject(r2);
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
var v5 = getArrayU8FromWasm0(r0, r1).slice();
|
|
176
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
177
|
+
return v5;
|
|
176
178
|
} finally {
|
|
177
179
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
178
180
|
}
|
|
@@ -266,6 +268,7 @@ export class Config {
|
|
|
266
268
|
}
|
|
267
269
|
/**
|
|
268
270
|
* the [authenticated encryption with additional data encryption function](crate::Aead) to be used
|
|
271
|
+
* @returns {number}
|
|
269
272
|
*/
|
|
270
273
|
get aead() {
|
|
271
274
|
const ret = wasm.__wbg_get_config_aead(this.ptr);
|
|
@@ -280,6 +283,7 @@ export class Config {
|
|
|
280
283
|
}
|
|
281
284
|
/**
|
|
282
285
|
* the [key derivation function](crate::Kdf) to be used
|
|
286
|
+
* @returns {number}
|
|
283
287
|
*/
|
|
284
288
|
get kdf() {
|
|
285
289
|
const ret = wasm.__wbg_get_config_kdf(this.ptr);
|
|
@@ -294,6 +298,7 @@ export class Config {
|
|
|
294
298
|
}
|
|
295
299
|
/**
|
|
296
300
|
* the [asymmetric key encapsulation mechanism](crate::Kem) to be used
|
|
301
|
+
* @returns {number}
|
|
297
302
|
*/
|
|
298
303
|
get kem() {
|
|
299
304
|
const ret = wasm.__wbg_get_config_kem(this.ptr);
|
|
@@ -456,6 +461,7 @@ export class EncappedKeyAndCiphertext {
|
|
|
456
461
|
}
|
|
457
462
|
/**
|
|
458
463
|
* the encapsulated encryption key
|
|
464
|
+
* @returns {Uint8Array}
|
|
459
465
|
*/
|
|
460
466
|
get encapped_key() {
|
|
461
467
|
try {
|
|
@@ -481,6 +487,7 @@ export class EncappedKeyAndCiphertext {
|
|
|
481
487
|
}
|
|
482
488
|
/**
|
|
483
489
|
* the ciphertext, encrypted with the key
|
|
490
|
+
* @returns {Uint8Array}
|
|
484
491
|
*/
|
|
485
492
|
get ciphertext() {
|
|
486
493
|
try {
|
|
@@ -582,6 +589,7 @@ export class Keypair {
|
|
|
582
589
|
}
|
|
583
590
|
/**
|
|
584
591
|
* the public key for this keypair
|
|
592
|
+
* @returns {Uint8Array}
|
|
585
593
|
*/
|
|
586
594
|
get public_key() {
|
|
587
595
|
try {
|
|
@@ -607,6 +615,7 @@ export class Keypair {
|
|
|
607
615
|
}
|
|
608
616
|
/**
|
|
609
617
|
* the private key for this keypair,
|
|
618
|
+
* @returns {Uint8Array}
|
|
610
619
|
*/
|
|
611
620
|
get private_key() {
|
|
612
621
|
try {
|
|
@@ -671,30 +680,18 @@ async function load(module, imports) {
|
|
|
671
680
|
}
|
|
672
681
|
}
|
|
673
682
|
|
|
674
|
-
|
|
675
|
-
if (typeof input === 'undefined') {
|
|
676
|
-
input = new URL('hpke_dispatch_bg.wasm', import.meta.url);
|
|
677
|
-
}
|
|
683
|
+
function getImports() {
|
|
678
684
|
const imports = {};
|
|
679
685
|
imports.wbg = {};
|
|
680
|
-
imports.wbg.__wbg_hpkeerror_new = function(arg0) {
|
|
681
|
-
const ret = HpkeError.__wrap(arg0);
|
|
682
|
-
return addHeapObject(ret);
|
|
683
|
-
};
|
|
684
686
|
imports.wbg.__wbg_idlookuperror_new = function(arg0) {
|
|
685
687
|
const ret = IdLookupError.__wrap(arg0);
|
|
686
688
|
return addHeapObject(ret);
|
|
687
689
|
};
|
|
688
|
-
imports.wbg.
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
692
|
-
takeObject(arg0);
|
|
690
|
+
imports.wbg.__wbg_hpkeerror_new = function(arg0) {
|
|
691
|
+
const ret = HpkeError.__wrap(arg0);
|
|
692
|
+
return addHeapObject(ret);
|
|
693
693
|
};
|
|
694
|
-
imports.wbg.
|
|
695
|
-
getObject(arg0).getRandomValues(getObject(arg1));
|
|
696
|
-
}, arguments) };
|
|
697
|
-
imports.wbg.__wbg_process_70251ed1291754d5 = function(arg0) {
|
|
694
|
+
imports.wbg.__wbg_process_0cc2ada8524d6f83 = function(arg0) {
|
|
698
695
|
const ret = getObject(arg0).process;
|
|
699
696
|
return addHeapObject(ret);
|
|
700
697
|
};
|
|
@@ -703,11 +700,11 @@ async function init(input) {
|
|
|
703
700
|
const ret = typeof(val) === 'object' && val !== null;
|
|
704
701
|
return ret;
|
|
705
702
|
};
|
|
706
|
-
imports.wbg.
|
|
703
|
+
imports.wbg.__wbg_versions_c11acceab27a6c87 = function(arg0) {
|
|
707
704
|
const ret = getObject(arg0).versions;
|
|
708
705
|
return addHeapObject(ret);
|
|
709
706
|
};
|
|
710
|
-
imports.wbg.
|
|
707
|
+
imports.wbg.__wbg_node_7ff1ce49caf23815 = function(arg0) {
|
|
711
708
|
const ret = getObject(arg0).node;
|
|
712
709
|
return addHeapObject(ret);
|
|
713
710
|
};
|
|
@@ -715,27 +712,36 @@ async function init(input) {
|
|
|
715
712
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
716
713
|
return ret;
|
|
717
714
|
};
|
|
718
|
-
imports.wbg.
|
|
715
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
716
|
+
takeObject(arg0);
|
|
717
|
+
};
|
|
718
|
+
imports.wbg.__wbg_crypto_2036bed7c44c25e7 = function(arg0) {
|
|
719
719
|
const ret = getObject(arg0).crypto;
|
|
720
720
|
return addHeapObject(ret);
|
|
721
721
|
};
|
|
722
|
-
imports.wbg.
|
|
722
|
+
imports.wbg.__wbg_msCrypto_a21fc88caf1ecdc8 = function(arg0) {
|
|
723
723
|
const ret = getObject(arg0).msCrypto;
|
|
724
724
|
return addHeapObject(ret);
|
|
725
725
|
};
|
|
726
|
-
imports.wbg.
|
|
726
|
+
imports.wbg.__wbg_static_accessor_NODE_MODULE_cf6401cc1091279e = function() {
|
|
727
727
|
const ret = module;
|
|
728
728
|
return addHeapObject(ret);
|
|
729
729
|
};
|
|
730
|
-
imports.wbg.
|
|
730
|
+
imports.wbg.__wbg_require_a746e79b322b9336 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
731
731
|
const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
|
|
732
732
|
return addHeapObject(ret);
|
|
733
733
|
}, arguments) };
|
|
734
|
-
imports.wbg.
|
|
734
|
+
imports.wbg.__wbg_getRandomValues_b99eec4244a475bb = function() { return handleError(function (arg0, arg1) {
|
|
735
|
+
getObject(arg0).getRandomValues(getObject(arg1));
|
|
736
|
+
}, arguments) };
|
|
737
|
+
imports.wbg.__wbg_randomFillSync_065afffde01daa66 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
738
|
+
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
|
|
739
|
+
}, arguments) };
|
|
740
|
+
imports.wbg.__wbg_newnoargs_b5b063fc6c2f0376 = function(arg0, arg1) {
|
|
735
741
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
736
742
|
return addHeapObject(ret);
|
|
737
743
|
};
|
|
738
|
-
imports.wbg.
|
|
744
|
+
imports.wbg.__wbg_call_97ae9d8645dc388b = function() { return handleError(function (arg0, arg1) {
|
|
739
745
|
const ret = getObject(arg0).call(getObject(arg1));
|
|
740
746
|
return addHeapObject(ret);
|
|
741
747
|
}, arguments) };
|
|
@@ -743,19 +749,19 @@ async function init(input) {
|
|
|
743
749
|
const ret = getObject(arg0);
|
|
744
750
|
return addHeapObject(ret);
|
|
745
751
|
};
|
|
746
|
-
imports.wbg.
|
|
752
|
+
imports.wbg.__wbg_self_6d479506f72c6a71 = function() { return handleError(function () {
|
|
747
753
|
const ret = self.self;
|
|
748
754
|
return addHeapObject(ret);
|
|
749
755
|
}, arguments) };
|
|
750
|
-
imports.wbg.
|
|
756
|
+
imports.wbg.__wbg_window_f2557cc78490aceb = function() { return handleError(function () {
|
|
751
757
|
const ret = window.window;
|
|
752
758
|
return addHeapObject(ret);
|
|
753
759
|
}, arguments) };
|
|
754
|
-
imports.wbg.
|
|
760
|
+
imports.wbg.__wbg_globalThis_7f206bda628d5286 = function() { return handleError(function () {
|
|
755
761
|
const ret = globalThis.globalThis;
|
|
756
762
|
return addHeapObject(ret);
|
|
757
763
|
}, arguments) };
|
|
758
|
-
imports.wbg.
|
|
764
|
+
imports.wbg.__wbg_global_ba75c50d1cf384f4 = function() { return handleError(function () {
|
|
759
765
|
const ret = global.global;
|
|
760
766
|
return addHeapObject(ret);
|
|
761
767
|
}, arguments) };
|
|
@@ -763,26 +769,26 @@ async function init(input) {
|
|
|
763
769
|
const ret = getObject(arg0) === undefined;
|
|
764
770
|
return ret;
|
|
765
771
|
};
|
|
766
|
-
imports.wbg.
|
|
772
|
+
imports.wbg.__wbg_buffer_3f3d764d4747d564 = function(arg0) {
|
|
767
773
|
const ret = getObject(arg0).buffer;
|
|
768
774
|
return addHeapObject(ret);
|
|
769
775
|
};
|
|
770
|
-
imports.wbg.
|
|
776
|
+
imports.wbg.__wbg_new_8c3f0052272a457a = function(arg0) {
|
|
771
777
|
const ret = new Uint8Array(getObject(arg0));
|
|
772
778
|
return addHeapObject(ret);
|
|
773
779
|
};
|
|
774
|
-
imports.wbg.
|
|
780
|
+
imports.wbg.__wbg_set_83db9690f9353e79 = function(arg0, arg1, arg2) {
|
|
775
781
|
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
|
776
782
|
};
|
|
777
|
-
imports.wbg.
|
|
783
|
+
imports.wbg.__wbg_length_9e1ae1900cb0fbd5 = function(arg0) {
|
|
778
784
|
const ret = getObject(arg0).length;
|
|
779
785
|
return ret;
|
|
780
786
|
};
|
|
781
|
-
imports.wbg.
|
|
787
|
+
imports.wbg.__wbg_newwithlength_f5933855e4f48a19 = function(arg0) {
|
|
782
788
|
const ret = new Uint8Array(arg0 >>> 0);
|
|
783
789
|
return addHeapObject(ret);
|
|
784
790
|
};
|
|
785
|
-
imports.wbg.
|
|
791
|
+
imports.wbg.__wbg_subarray_58ad4efbb5bcb886 = function(arg0, arg1, arg2) {
|
|
786
792
|
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
|
787
793
|
return addHeapObject(ret);
|
|
788
794
|
};
|
|
@@ -794,19 +800,53 @@ async function init(input) {
|
|
|
794
800
|
return addHeapObject(ret);
|
|
795
801
|
};
|
|
796
802
|
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
}
|
|
800
|
-
|
|
803
|
+
return imports;
|
|
804
|
+
}
|
|
801
805
|
|
|
806
|
+
function initMemory(imports, maybe_memory) {
|
|
802
807
|
|
|
803
|
-
|
|
808
|
+
}
|
|
804
809
|
|
|
810
|
+
function finalizeInit(instance, module) {
|
|
805
811
|
wasm = instance.exports;
|
|
806
812
|
init.__wbindgen_wasm_module = module;
|
|
813
|
+
cachedInt32Memory0 = new Int32Array();
|
|
814
|
+
cachedUint8Memory0 = new Uint8Array();
|
|
815
|
+
|
|
807
816
|
|
|
808
817
|
return wasm;
|
|
809
818
|
}
|
|
810
819
|
|
|
811
|
-
|
|
820
|
+
function initSync(module) {
|
|
821
|
+
const imports = getImports();
|
|
812
822
|
|
|
823
|
+
initMemory(imports);
|
|
824
|
+
|
|
825
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
826
|
+
module = new WebAssembly.Module(module);
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
830
|
+
|
|
831
|
+
return finalizeInit(instance, module);
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
async function init(input) {
|
|
835
|
+
if (typeof input === 'undefined') {
|
|
836
|
+
input = new URL('hpke_dispatch_bg.wasm', import.meta.url);
|
|
837
|
+
}
|
|
838
|
+
const imports = getImports();
|
|
839
|
+
|
|
840
|
+
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
841
|
+
input = fetch(input);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
initMemory(imports);
|
|
845
|
+
|
|
846
|
+
const { instance, module } = await load(await input, imports);
|
|
847
|
+
|
|
848
|
+
return finalizeInit(instance, module);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
export { initSync }
|
|
852
|
+
export default init;
|
|
Binary file
|
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function base_mode_open(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number): void;
|
|
5
|
-
export function __wbg_config_free(a: number): void;
|
|
6
|
-
export function __wbg_get_config_aead(a: number): number;
|
|
7
|
-
export function __wbg_set_config_aead(a: number, b: number): void;
|
|
8
|
-
export function __wbg_get_config_kdf(a: number): number;
|
|
9
|
-
export function __wbg_set_config_kdf(a: number, b: number): void;
|
|
10
|
-
export function __wbg_get_config_kem(a: number): number;
|
|
11
|
-
export function __wbg_set_config_kem(a: number, b: number): void;
|
|
12
|
-
export function config_base_mode_seal(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number): void;
|
|
13
|
-
export function config_base_mode_open(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number): void;
|
|
14
|
-
export function config_try_from_ids(a: number, b: number, c: number, d: number): void;
|
|
15
4
|
export function __wbg_keypair_free(a: number): void;
|
|
16
5
|
export function __wbg_get_keypair_public_key(a: number, b: number): void;
|
|
17
6
|
export function __wbg_set_keypair_public_key(a: number, b: number, c: number): void;
|
|
18
7
|
export function __wbg_get_keypair_private_key(a: number, b: number): void;
|
|
19
8
|
export function __wbg_set_keypair_private_key(a: number, b: number, c: number): void;
|
|
20
9
|
export function keypair_new(a: number): number;
|
|
21
|
-
export function base_mode_seal(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number): void;
|
|
22
10
|
export function __wbg_encappedkeyandciphertext_free(a: number): void;
|
|
23
11
|
export function __wbg_get_encappedkeyandciphertext_encapped_key(a: number, b: number): void;
|
|
24
12
|
export function __wbg_set_encappedkeyandciphertext_encapped_key(a: number, b: number, c: number): void;
|
|
@@ -26,7 +14,19 @@ export function __wbg_get_encappedkeyandciphertext_ciphertext(a: number, b: numb
|
|
|
26
14
|
export function __wbg_set_encappedkeyandciphertext_ciphertext(a: number, b: number, c: number): void;
|
|
27
15
|
export function __wbg_idlookuperror_free(a: number): void;
|
|
28
16
|
export function __wbg_hpkeerror_free(a: number): void;
|
|
17
|
+
export function base_mode_seal(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number): void;
|
|
18
|
+
export function base_mode_open(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number): void;
|
|
19
|
+
export function __wbg_config_free(a: number): void;
|
|
20
|
+
export function __wbg_get_config_aead(a: number): number;
|
|
21
|
+
export function __wbg_set_config_aead(a: number, b: number): void;
|
|
22
|
+
export function __wbg_get_config_kdf(a: number): number;
|
|
23
|
+
export function __wbg_set_config_kdf(a: number, b: number): void;
|
|
24
|
+
export function __wbg_get_config_kem(a: number): number;
|
|
25
|
+
export function __wbg_set_config_kem(a: number, b: number): void;
|
|
26
|
+
export function config_base_mode_seal(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number): void;
|
|
27
|
+
export function config_base_mode_open(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number): void;
|
|
28
|
+
export function config_try_from_ids(a: number, b: number, c: number, d: number): void;
|
|
29
29
|
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
30
|
-
export function __wbindgen_malloc(a: number): number;
|
|
31
30
|
export function __wbindgen_free(a: number, b: number): void;
|
|
31
|
+
export function __wbindgen_malloc(a: number): number;
|
|
32
32
|
export function __wbindgen_exn_store(a: number): void;
|