hpke 0.4.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 +1 -1
- package/pkg/node/hpke_dispatch.d.ts +42 -42
- package/pkg/node/hpke_dispatch.js +94 -94
- 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 +55 -55
- package/pkg/web/hpke_dispatch.js +91 -91
- 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.spec.mjs +0 -4625
- package/pkg/node/index.spec.mjs.map +0 -7
- package/pkg/node/module.mjs +0 -582
- package/pkg/node/module.mjs.map +0 -7
- package/pkg/node/tests.js +0 -57
package/package.json
CHANGED
|
@@ -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,23 +28,30 @@ 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
|
*
|
|
57
|
-
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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}
|
|
71
53
|
*/
|
|
72
|
-
|
|
73
|
-
}
|
|
54
|
+
export function base_mode_open(config: Config, private_key: Uint8Array, encapped_key: Uint8Array, info: Uint8Array, ciphertext: Uint8Array, aad: Uint8Array): Uint8Array;
|
|
74
55
|
/**
|
|
75
56
|
*
|
|
76
57
|
*Aead represents an authenticated encryption with additional data
|
|
@@ -92,6 +73,25 @@ export enum Aead {
|
|
|
92
73
|
}
|
|
93
74
|
/**
|
|
94
75
|
*
|
|
76
|
+
*Kdf represents an key derivation function, as per
|
|
77
|
+
*[RFC9180§7.2](https://www.rfc-editor.org/rfc/rfc9180.html#section-7.2)
|
|
78
|
+
*/
|
|
79
|
+
export enum Kdf {
|
|
80
|
+
/**
|
|
81
|
+
* Sha256 [RFC5869](https://www.rfc-editor.org/info/rfc5869)
|
|
82
|
+
*/
|
|
83
|
+
Sha256,
|
|
84
|
+
/**
|
|
85
|
+
* Sha384 [RFC5869](https://www.rfc-editor.org/info/rfc5869)
|
|
86
|
+
*/
|
|
87
|
+
Sha384,
|
|
88
|
+
/**
|
|
89
|
+
* Sha512 [RFC5869](https://www.rfc-editor.org/info/rfc5869)
|
|
90
|
+
*/
|
|
91
|
+
Sha512,
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
*
|
|
95
95
|
*Kem represents an asymmetric key encapsulation mechanism, as per
|
|
96
96
|
*[RFC9180§7.1][section-7.1]. Currently only two of options listed in
|
|
97
97
|
*the hpke draft are available.
|
|
@@ -49,11 +49,17 @@ function getStringFromWasm0(ptr, len) {
|
|
|
49
49
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
let cachedInt32Memory0 = new Int32Array();
|
|
53
|
+
|
|
54
|
+
function getInt32Memory0() {
|
|
55
|
+
if (cachedInt32Memory0.byteLength === 0) {
|
|
56
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
55
57
|
}
|
|
56
|
-
return
|
|
58
|
+
return cachedInt32Memory0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
62
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
let WASM_VECTOR_LEN = 0;
|
|
@@ -65,68 +71,57 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
65
71
|
return ptr;
|
|
66
72
|
}
|
|
67
73
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (cachedInt32Memory0.byteLength === 0) {
|
|
72
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
74
|
+
function _assertClass(instance, klass) {
|
|
75
|
+
if (!(instance instanceof klass)) {
|
|
76
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
73
77
|
}
|
|
74
|
-
return
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
78
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
78
|
+
return instance.ptr;
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
81
|
*
|
|
82
|
-
*`
|
|
83
|
-
*that does not require compile time selection of an
|
|
84
|
-
*the selected algorithm is provided through the
|
|
85
|
-
*the first argument.
|
|
82
|
+
*`base_mode_seal` provides an interface to [`hpke::single_shot_seal`]
|
|
83
|
+
*that does not require compile time selection of an
|
|
84
|
+
*algorithm. Instead, the selected algorithm is provided through the
|
|
85
|
+
*[`Config`] passed as the first argument.
|
|
86
86
|
*
|
|
87
|
-
*Requires the `base-mode-
|
|
87
|
+
*Requires the `base-mode-seal` crate feature to be enabled.
|
|
88
88
|
*
|
|
89
89
|
*# Errors
|
|
90
90
|
*
|
|
91
91
|
*This will return an `Result::Err` variant if:
|
|
92
92
|
*
|
|
93
|
-
** we are unable to deserialize the
|
|
94
|
-
** there is an error in key
|
|
95
|
-
** there is an error in
|
|
93
|
+
** we are unable to deserialize the recipient public key
|
|
94
|
+
** there is an error in key encapsultion
|
|
95
|
+
** there is an error in encryption
|
|
96
|
+
*
|
|
96
97
|
*
|
|
97
98
|
* @param {Config} config
|
|
98
|
-
* @param {Uint8Array}
|
|
99
|
-
* @param {Uint8Array} encapped_key
|
|
99
|
+
* @param {Uint8Array} recipient_public_key
|
|
100
100
|
* @param {Uint8Array} info
|
|
101
|
-
* @param {Uint8Array}
|
|
101
|
+
* @param {Uint8Array} plaintext
|
|
102
102
|
* @param {Uint8Array} aad
|
|
103
|
-
* @returns {
|
|
103
|
+
* @returns {EncappedKeyAndCiphertext}
|
|
104
104
|
*/
|
|
105
|
-
module.exports.
|
|
105
|
+
module.exports.base_mode_seal = function(config, recipient_public_key, info, plaintext, aad) {
|
|
106
106
|
try {
|
|
107
107
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
108
108
|
_assertClass(config, Config);
|
|
109
|
-
const ptr0 = passArray8ToWasm0(
|
|
109
|
+
const ptr0 = passArray8ToWasm0(recipient_public_key, wasm.__wbindgen_malloc);
|
|
110
110
|
const len0 = WASM_VECTOR_LEN;
|
|
111
|
-
const ptr1 = passArray8ToWasm0(
|
|
111
|
+
const ptr1 = passArray8ToWasm0(info, wasm.__wbindgen_malloc);
|
|
112
112
|
const len1 = WASM_VECTOR_LEN;
|
|
113
|
-
const ptr2 = passArray8ToWasm0(
|
|
113
|
+
const ptr2 = passArray8ToWasm0(plaintext, wasm.__wbindgen_malloc);
|
|
114
114
|
const len2 = WASM_VECTOR_LEN;
|
|
115
|
-
const ptr3 = passArray8ToWasm0(
|
|
115
|
+
const ptr3 = passArray8ToWasm0(aad, wasm.__wbindgen_malloc);
|
|
116
116
|
const len3 = WASM_VECTOR_LEN;
|
|
117
|
-
|
|
118
|
-
const len4 = WASM_VECTOR_LEN;
|
|
119
|
-
wasm.base_mode_open(retptr, config.ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
|
|
117
|
+
wasm.base_mode_seal(retptr, config.ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
120
118
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
121
119
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
122
120
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
throw takeObject(r2);
|
|
121
|
+
if (r2) {
|
|
122
|
+
throw takeObject(r1);
|
|
126
123
|
}
|
|
127
|
-
|
|
128
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
129
|
-
return v5;
|
|
124
|
+
return EncappedKeyAndCiphertext.__wrap(r0);
|
|
130
125
|
} finally {
|
|
131
126
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
132
127
|
}
|
|
@@ -134,49 +129,54 @@ module.exports.base_mode_open = function(config, private_key, encapped_key, info
|
|
|
134
129
|
|
|
135
130
|
/**
|
|
136
131
|
*
|
|
137
|
-
*`
|
|
138
|
-
*that does not require compile time selection of an
|
|
139
|
-
*
|
|
140
|
-
*
|
|
132
|
+
*`base_mode_open` provides an interface to [`hpke::single_shot_open`]
|
|
133
|
+
*that does not require compile time selection of an algorithm. Instead,
|
|
134
|
+
*the selected algorithm is provided through the [`Config`] passed as
|
|
135
|
+
*the first argument.
|
|
141
136
|
*
|
|
142
|
-
*Requires the `base-mode-
|
|
137
|
+
*Requires the `base-mode-open` crate feature to be enabled.
|
|
143
138
|
*
|
|
144
139
|
*# Errors
|
|
145
140
|
*
|
|
146
141
|
*This will return an `Result::Err` variant if:
|
|
147
142
|
*
|
|
148
|
-
** we are unable to deserialize the
|
|
149
|
-
** there is an error in key
|
|
150
|
-
** there is an error in
|
|
151
|
-
*
|
|
143
|
+
** we are unable to deserialize the private key or encapsulated key
|
|
144
|
+
** there is an error in key decapsulation
|
|
145
|
+
** there is an error in decryption
|
|
152
146
|
*
|
|
153
147
|
* @param {Config} config
|
|
154
|
-
* @param {Uint8Array}
|
|
148
|
+
* @param {Uint8Array} private_key
|
|
149
|
+
* @param {Uint8Array} encapped_key
|
|
155
150
|
* @param {Uint8Array} info
|
|
156
|
-
* @param {Uint8Array}
|
|
151
|
+
* @param {Uint8Array} ciphertext
|
|
157
152
|
* @param {Uint8Array} aad
|
|
158
|
-
* @returns {
|
|
153
|
+
* @returns {Uint8Array}
|
|
159
154
|
*/
|
|
160
|
-
module.exports.
|
|
155
|
+
module.exports.base_mode_open = function(config, private_key, encapped_key, info, ciphertext, aad) {
|
|
161
156
|
try {
|
|
162
157
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
163
158
|
_assertClass(config, Config);
|
|
164
|
-
const ptr0 = passArray8ToWasm0(
|
|
159
|
+
const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
|
|
165
160
|
const len0 = WASM_VECTOR_LEN;
|
|
166
|
-
const ptr1 = passArray8ToWasm0(
|
|
161
|
+
const ptr1 = passArray8ToWasm0(encapped_key, wasm.__wbindgen_malloc);
|
|
167
162
|
const len1 = WASM_VECTOR_LEN;
|
|
168
|
-
const ptr2 = passArray8ToWasm0(
|
|
163
|
+
const ptr2 = passArray8ToWasm0(info, wasm.__wbindgen_malloc);
|
|
169
164
|
const len2 = WASM_VECTOR_LEN;
|
|
170
|
-
const ptr3 = passArray8ToWasm0(
|
|
165
|
+
const ptr3 = passArray8ToWasm0(ciphertext, wasm.__wbindgen_malloc);
|
|
171
166
|
const len3 = WASM_VECTOR_LEN;
|
|
172
|
-
|
|
167
|
+
const ptr4 = passArray8ToWasm0(aad, wasm.__wbindgen_malloc);
|
|
168
|
+
const len4 = WASM_VECTOR_LEN;
|
|
169
|
+
wasm.base_mode_open(retptr, config.ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
|
|
173
170
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
174
171
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
175
172
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
176
|
-
|
|
177
|
-
|
|
173
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
174
|
+
if (r3) {
|
|
175
|
+
throw takeObject(r2);
|
|
178
176
|
}
|
|
179
|
-
|
|
177
|
+
var v5 = getArrayU8FromWasm0(r0, r1).slice();
|
|
178
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
179
|
+
return v5;
|
|
180
180
|
} finally {
|
|
181
181
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
182
182
|
}
|
|
@@ -191,24 +191,6 @@ function handleError(f, args) {
|
|
|
191
191
|
}
|
|
192
192
|
/**
|
|
193
193
|
*
|
|
194
|
-
*Kdf represents an key derivation function, as per
|
|
195
|
-
*[RFC9180§7.2](https://www.rfc-editor.org/rfc/rfc9180.html#section-7.2)
|
|
196
|
-
*/
|
|
197
|
-
module.exports.Kdf = Object.freeze({
|
|
198
|
-
/**
|
|
199
|
-
* Sha256 [RFC5869](https://www.rfc-editor.org/info/rfc5869)
|
|
200
|
-
*/
|
|
201
|
-
Sha256:1,"1":"Sha256",
|
|
202
|
-
/**
|
|
203
|
-
* Sha384 [RFC5869](https://www.rfc-editor.org/info/rfc5869)
|
|
204
|
-
*/
|
|
205
|
-
Sha384:2,"2":"Sha384",
|
|
206
|
-
/**
|
|
207
|
-
* Sha512 [RFC5869](https://www.rfc-editor.org/info/rfc5869)
|
|
208
|
-
*/
|
|
209
|
-
Sha512:3,"3":"Sha512", });
|
|
210
|
-
/**
|
|
211
|
-
*
|
|
212
194
|
*Aead represents an authenticated encryption with additional data
|
|
213
195
|
*encryption function, as per [RFC9180§7.3](https://www.rfc-editor.org/rfc/rfc9180.html#section-7.3)
|
|
214
196
|
*/
|
|
@@ -227,6 +209,24 @@ AesGcm256:2,"2":"AesGcm256",
|
|
|
227
209
|
ChaCha20Poly1305:3,"3":"ChaCha20Poly1305", });
|
|
228
210
|
/**
|
|
229
211
|
*
|
|
212
|
+
*Kdf represents an key derivation function, as per
|
|
213
|
+
*[RFC9180§7.2](https://www.rfc-editor.org/rfc/rfc9180.html#section-7.2)
|
|
214
|
+
*/
|
|
215
|
+
module.exports.Kdf = Object.freeze({
|
|
216
|
+
/**
|
|
217
|
+
* Sha256 [RFC5869](https://www.rfc-editor.org/info/rfc5869)
|
|
218
|
+
*/
|
|
219
|
+
Sha256:1,"1":"Sha256",
|
|
220
|
+
/**
|
|
221
|
+
* Sha384 [RFC5869](https://www.rfc-editor.org/info/rfc5869)
|
|
222
|
+
*/
|
|
223
|
+
Sha384:2,"2":"Sha384",
|
|
224
|
+
/**
|
|
225
|
+
* Sha512 [RFC5869](https://www.rfc-editor.org/info/rfc5869)
|
|
226
|
+
*/
|
|
227
|
+
Sha512:3,"3":"Sha512", });
|
|
228
|
+
/**
|
|
229
|
+
*
|
|
230
230
|
*Kem represents an asymmetric key encapsulation mechanism, as per
|
|
231
231
|
*[RFC9180§7.1][section-7.1]. Currently only two of options listed in
|
|
232
232
|
*the hpke draft are available.
|
|
@@ -656,28 +656,16 @@ class Keypair {
|
|
|
656
656
|
}
|
|
657
657
|
module.exports.Keypair = Keypair;
|
|
658
658
|
|
|
659
|
-
module.exports.__wbg_hpkeerror_new = function(arg0) {
|
|
660
|
-
const ret = HpkeError.__wrap(arg0);
|
|
661
|
-
return addHeapObject(ret);
|
|
662
|
-
};
|
|
663
|
-
|
|
664
659
|
module.exports.__wbg_idlookuperror_new = function(arg0) {
|
|
665
660
|
const ret = IdLookupError.__wrap(arg0);
|
|
666
661
|
return addHeapObject(ret);
|
|
667
662
|
};
|
|
668
663
|
|
|
669
|
-
module.exports.
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
674
|
-
takeObject(arg0);
|
|
664
|
+
module.exports.__wbg_hpkeerror_new = function(arg0) {
|
|
665
|
+
const ret = HpkeError.__wrap(arg0);
|
|
666
|
+
return addHeapObject(ret);
|
|
675
667
|
};
|
|
676
668
|
|
|
677
|
-
module.exports.__wbg_getRandomValues_b99eec4244a475bb = function() { return handleError(function (arg0, arg1) {
|
|
678
|
-
getObject(arg0).getRandomValues(getObject(arg1));
|
|
679
|
-
}, arguments) };
|
|
680
|
-
|
|
681
669
|
module.exports.__wbg_process_0cc2ada8524d6f83 = function(arg0) {
|
|
682
670
|
const ret = getObject(arg0).process;
|
|
683
671
|
return addHeapObject(ret);
|
|
@@ -704,6 +692,10 @@ module.exports.__wbindgen_is_string = function(arg0) {
|
|
|
704
692
|
return ret;
|
|
705
693
|
};
|
|
706
694
|
|
|
695
|
+
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
696
|
+
takeObject(arg0);
|
|
697
|
+
};
|
|
698
|
+
|
|
707
699
|
module.exports.__wbg_crypto_2036bed7c44c25e7 = function(arg0) {
|
|
708
700
|
const ret = getObject(arg0).crypto;
|
|
709
701
|
return addHeapObject(ret);
|
|
@@ -724,6 +716,14 @@ module.exports.__wbg_require_a746e79b322b9336 = function() { return handleError(
|
|
|
724
716
|
return addHeapObject(ret);
|
|
725
717
|
}, arguments) };
|
|
726
718
|
|
|
719
|
+
module.exports.__wbg_getRandomValues_b99eec4244a475bb = function() { return handleError(function (arg0, arg1) {
|
|
720
|
+
getObject(arg0).getRandomValues(getObject(arg1));
|
|
721
|
+
}, arguments) };
|
|
722
|
+
|
|
723
|
+
module.exports.__wbg_randomFillSync_065afffde01daa66 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
724
|
+
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
|
|
725
|
+
}, arguments) };
|
|
726
|
+
|
|
727
727
|
module.exports.__wbg_newnoargs_b5b063fc6c2f0376 = function(arg0, arg1) {
|
|
728
728
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
729
729
|
return addHeapObject(ret);
|
|
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;
|
package/pkg/node/package.json
CHANGED
|
@@ -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,23 +28,30 @@ 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
|
*
|
|
57
|
-
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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}
|
|
71
53
|
*/
|
|
72
|
-
|
|
73
|
-
}
|
|
54
|
+
export function base_mode_open(config: Config, private_key: Uint8Array, encapped_key: Uint8Array, info: Uint8Array, ciphertext: Uint8Array, aad: Uint8Array): Uint8Array;
|
|
74
55
|
/**
|
|
75
56
|
*
|
|
76
57
|
*Aead represents an authenticated encryption with additional data
|
|
@@ -92,6 +73,25 @@ export enum Aead {
|
|
|
92
73
|
}
|
|
93
74
|
/**
|
|
94
75
|
*
|
|
76
|
+
*Kdf represents an key derivation function, as per
|
|
77
|
+
*[RFC9180§7.2](https://www.rfc-editor.org/rfc/rfc9180.html#section-7.2)
|
|
78
|
+
*/
|
|
79
|
+
export enum Kdf {
|
|
80
|
+
/**
|
|
81
|
+
* Sha256 [RFC5869](https://www.rfc-editor.org/info/rfc5869)
|
|
82
|
+
*/
|
|
83
|
+
Sha256,
|
|
84
|
+
/**
|
|
85
|
+
* Sha384 [RFC5869](https://www.rfc-editor.org/info/rfc5869)
|
|
86
|
+
*/
|
|
87
|
+
Sha384,
|
|
88
|
+
/**
|
|
89
|
+
* Sha512 [RFC5869](https://www.rfc-editor.org/info/rfc5869)
|
|
90
|
+
*/
|
|
91
|
+
Sha512,
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
*
|
|
95
95
|
*Kem represents an asymmetric key encapsulation mechanism, as per
|
|
96
96
|
*[RFC9180§7.1][section-7.1]. Currently only two of options listed in
|
|
97
97
|
*the hpke draft are available.
|
|
@@ -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,9 +257,21 @@ 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
|
|