@reallyme/crypto 0.1.8 → 0.3.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/LICENSE +201 -0
- package/README.md +148 -18
- package/dist/aead.d.ts +4 -0
- package/dist/aead.js +40 -16
- package/dist/aesKw.d.ts +8 -2
- package/dist/aesKw.js +69 -12
- package/dist/algorithms.d.ts +12 -4
- package/dist/algorithms.js +8 -2
- package/dist/argon2id.d.ts +3 -0
- package/dist/argon2id.js +18 -3
- package/dist/cryptoFacade.d.ts +66 -5
- package/dist/cryptoFacade.js +99 -38
- package/dist/errors.d.ts +1 -1
- package/dist/hkdf.d.ts +1 -0
- package/dist/hkdf.js +5 -1
- package/dist/hmac.d.ts +3 -0
- package/dist/hmac.js +24 -3
- package/dist/hpke.d.ts +4 -1
- package/dist/hpke.js +45 -14
- package/dist/index.d.ts +14 -13
- package/dist/index.js +12 -10
- package/dist/jwaConcatKdf.js +8 -4
- package/dist/jwk.d.ts +2 -1
- package/dist/jwk.js +158 -122
- package/dist/kmac.d.ts +11 -0
- package/dist/kmac.js +49 -0
- package/dist/memory.d.ts +8 -0
- package/dist/memory.js +13 -0
- package/dist/mlDsa.d.ts +5 -0
- package/dist/mlDsa.js +43 -9
- package/dist/mlKem.d.ts +5 -2
- package/dist/mlKem.js +37 -26
- package/dist/operationResponse.d.ts +16 -0
- package/dist/operationResponse.js +46 -0
- package/dist/p256Ecdh.js +5 -1
- package/dist/p384Ecdh.js +5 -1
- package/dist/p521Ecdh.js +5 -1
- package/dist/pbkdf2.d.ts +6 -8
- package/dist/pbkdf2.js +12 -12
- package/dist/proto/generated/reallyme/crypto/v1/crypto_pb.d.ts +2859 -128
- package/dist/proto/generated/reallyme/crypto/v1/crypto_pb.js +992 -132
- package/dist/proto.d.ts +99 -7
- package/dist/proto.js +741 -16
- package/dist/rsa.d.ts +4 -1
- package/dist/rsa.js +23 -16
- package/dist/slhDsa.d.ts +5 -0
- package/dist/slhDsa.js +40 -9
- package/dist/validateBytes.d.ts +7 -1
- package/dist/validateBytes.js +63 -3
- package/dist/wasm/reallyme_crypto_wasm.js +77 -365
- package/dist/wasm/reallyme_crypto_wasm_bg.wasm +0 -0
- package/dist/wasmModuleTypes.d.ts +9 -21
- package/dist/wasmProvider.d.ts +12 -29
- package/dist/wasmProvider.js +25 -43
- package/dist/xWing.d.ts +5 -4
- package/dist/xWing.js +40 -40
- package/package.json +20 -2
- package/dist/codecs.d.ts +0 -35
- package/dist/codecs.js +0 -216
- package/dist/proto/generated/reallyme/codec/v1/codec_pb.d.ts +0 -253
- package/dist/proto/generated/reallyme/codec/v1/codec_pb.js +0 -160
|
@@ -32,6 +32,34 @@ export function aes128GcmSeal(key, nonce, aad, plaintext) {
|
|
|
32
32
|
return takeFromExternrefTable0(ret[0]);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Unwrap key material with AES-128-KW.
|
|
37
|
+
* @param {Uint8Array} kek
|
|
38
|
+
* @param {Uint8Array} wrapped_key
|
|
39
|
+
* @returns {Uint8Array}
|
|
40
|
+
*/
|
|
41
|
+
export function aes128KwUnwrapKey(kek, wrapped_key) {
|
|
42
|
+
const ret = wasm.aes128KwUnwrapKey(kek, wrapped_key);
|
|
43
|
+
if (ret[2]) {
|
|
44
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
45
|
+
}
|
|
46
|
+
return takeFromExternrefTable0(ret[0]);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Wrap key material with AES-128-KW.
|
|
51
|
+
* @param {Uint8Array} kek
|
|
52
|
+
* @param {Uint8Array} key_data
|
|
53
|
+
* @returns {Uint8Array}
|
|
54
|
+
*/
|
|
55
|
+
export function aes128KwWrapKey(kek, key_data) {
|
|
56
|
+
const ret = wasm.aes128KwWrapKey(kek, key_data);
|
|
57
|
+
if (ret[2]) {
|
|
58
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
59
|
+
}
|
|
60
|
+
return takeFromExternrefTable0(ret[0]);
|
|
61
|
+
}
|
|
62
|
+
|
|
35
63
|
/**
|
|
36
64
|
* Open and authenticate an AES-192-GCM `ciphertext || tag`.
|
|
37
65
|
* @param {Uint8Array} key
|
|
@@ -64,6 +92,34 @@ export function aes192GcmSeal(key, nonce, aad, plaintext) {
|
|
|
64
92
|
return takeFromExternrefTable0(ret[0]);
|
|
65
93
|
}
|
|
66
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Unwrap key material with AES-192-KW.
|
|
97
|
+
* @param {Uint8Array} kek
|
|
98
|
+
* @param {Uint8Array} wrapped_key
|
|
99
|
+
* @returns {Uint8Array}
|
|
100
|
+
*/
|
|
101
|
+
export function aes192KwUnwrapKey(kek, wrapped_key) {
|
|
102
|
+
const ret = wasm.aes192KwUnwrapKey(kek, wrapped_key);
|
|
103
|
+
if (ret[2]) {
|
|
104
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
105
|
+
}
|
|
106
|
+
return takeFromExternrefTable0(ret[0]);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Wrap key material with AES-192-KW.
|
|
111
|
+
* @param {Uint8Array} kek
|
|
112
|
+
* @param {Uint8Array} key_data
|
|
113
|
+
* @returns {Uint8Array}
|
|
114
|
+
*/
|
|
115
|
+
export function aes192KwWrapKey(kek, key_data) {
|
|
116
|
+
const ret = wasm.aes192KwWrapKey(kek, key_data);
|
|
117
|
+
if (ret[2]) {
|
|
118
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
119
|
+
}
|
|
120
|
+
return takeFromExternrefTable0(ret[0]);
|
|
121
|
+
}
|
|
122
|
+
|
|
67
123
|
/**
|
|
68
124
|
* Open and authenticate an AES-256-GCM `ciphertext || tag`.
|
|
69
125
|
* @param {Uint8Array} key
|
|
@@ -129,7 +185,7 @@ export function aes256GcmSivSeal(key, nonce, aad, plaintext) {
|
|
|
129
185
|
}
|
|
130
186
|
|
|
131
187
|
/**
|
|
132
|
-
* Unwrap
|
|
188
|
+
* Unwrap key material with AES-256-KW.
|
|
133
189
|
* @param {Uint8Array} kek
|
|
134
190
|
* @param {Uint8Array} wrapped_key
|
|
135
191
|
* @returns {Uint8Array}
|
|
@@ -143,7 +199,7 @@ export function aes256KwUnwrapKey(kek, wrapped_key) {
|
|
|
143
199
|
}
|
|
144
200
|
|
|
145
201
|
/**
|
|
146
|
-
* Wrap key material with AES-256-KW
|
|
202
|
+
* Wrap key material with AES-256-KW.
|
|
147
203
|
* @param {Uint8Array} kek
|
|
148
204
|
* @param {Uint8Array} key_data
|
|
149
205
|
* @returns {Uint8Array}
|
|
@@ -171,39 +227,6 @@ export function argon2idDeriveKey(kdf_version, secret, salt) {
|
|
|
171
227
|
return takeFromExternrefTable0(ret[0]);
|
|
172
228
|
}
|
|
173
229
|
|
|
174
|
-
/**
|
|
175
|
-
* Decode strict, unpadded RFC 4648 URL-safe base64.
|
|
176
|
-
* @param {string} encoded
|
|
177
|
-
* @returns {Uint8Array}
|
|
178
|
-
*/
|
|
179
|
-
export function base64urlDecode(encoded) {
|
|
180
|
-
const ptr0 = passStringToWasm0(encoded, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
181
|
-
const len0 = WASM_VECTOR_LEN;
|
|
182
|
-
const ret = wasm.base64urlDecode(ptr0, len0);
|
|
183
|
-
if (ret[2]) {
|
|
184
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
185
|
-
}
|
|
186
|
-
return takeFromExternrefTable0(ret[0]);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Encode bytes as RFC 4648 URL-safe base64 without padding.
|
|
191
|
-
* @param {Uint8Array} bytes
|
|
192
|
-
* @returns {string}
|
|
193
|
-
*/
|
|
194
|
-
export function base64urlEncode(bytes) {
|
|
195
|
-
let deferred1_0;
|
|
196
|
-
let deferred1_1;
|
|
197
|
-
try {
|
|
198
|
-
const ret = wasm.base64urlEncode(bytes);
|
|
199
|
-
deferred1_0 = ret[0];
|
|
200
|
-
deferred1_1 = ret[1];
|
|
201
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
202
|
-
} finally {
|
|
203
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
230
|
/**
|
|
208
231
|
* Open and authenticate a ChaCha20-Poly1305 `ciphertext || tag`.
|
|
209
232
|
* @param {Uint8Array} key
|
|
@@ -236,40 +259,6 @@ export function chacha20Poly1305Seal(key, nonce, aad, plaintext) {
|
|
|
236
259
|
return takeFromExternrefTable0(ret[0]);
|
|
237
260
|
}
|
|
238
261
|
|
|
239
|
-
/**
|
|
240
|
-
* Compute a CIDv1 dag-cbor/sha2-256 string for already-canonical DAG-CBOR bytes.
|
|
241
|
-
* @param {Uint8Array} bytes
|
|
242
|
-
* @returns {string}
|
|
243
|
-
*/
|
|
244
|
-
export function dagCborComputeCid(bytes) {
|
|
245
|
-
let deferred1_0;
|
|
246
|
-
let deferred1_1;
|
|
247
|
-
try {
|
|
248
|
-
const ret = wasm.dagCborComputeCid(bytes);
|
|
249
|
-
deferred1_0 = ret[0];
|
|
250
|
-
deferred1_1 = ret[1];
|
|
251
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
252
|
-
} finally {
|
|
253
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Recompute and compare a CIDv1 dag-cbor/sha2-256 string.
|
|
259
|
-
* @param {string} cid
|
|
260
|
-
* @param {Uint8Array} bytes
|
|
261
|
-
* @returns {any}
|
|
262
|
-
*/
|
|
263
|
-
export function dagCborVerifyCid(cid, bytes) {
|
|
264
|
-
const ptr0 = passStringToWasm0(cid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
265
|
-
const len0 = WASM_VECTOR_LEN;
|
|
266
|
-
const ret = wasm.dagCborVerifyCid(ptr0, len0, bytes);
|
|
267
|
-
if (ret[2]) {
|
|
268
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
269
|
-
}
|
|
270
|
-
return takeFromExternrefTable0(ret[0]);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
262
|
/**
|
|
274
263
|
* Open one RFC 9180 HPKE Base-mode message.
|
|
275
264
|
* @param {number} suite
|
|
@@ -306,17 +295,15 @@ export function hpkeSealBase(suite, recipient_public_key, info, aad, plaintext)
|
|
|
306
295
|
}
|
|
307
296
|
|
|
308
297
|
/**
|
|
309
|
-
*
|
|
310
|
-
* @param {
|
|
311
|
-
* @param {Uint8Array}
|
|
312
|
-
* @param {Uint8Array}
|
|
313
|
-
* @param {
|
|
314
|
-
* @
|
|
315
|
-
* @param {Uint8Array} plaintext
|
|
316
|
-
* @returns {any}
|
|
298
|
+
* Derive key material with KMAC256.
|
|
299
|
+
* @param {Uint8Array} key
|
|
300
|
+
* @param {Uint8Array} context
|
|
301
|
+
* @param {Uint8Array} customization
|
|
302
|
+
* @param {number} output_length
|
|
303
|
+
* @returns {Uint8Array}
|
|
317
304
|
*/
|
|
318
|
-
export function
|
|
319
|
-
const ret = wasm.
|
|
305
|
+
export function kmac256Derive(key, context, customization, output_length) {
|
|
306
|
+
const ret = wasm.kmac256Derive(key, context, customization, output_length);
|
|
320
307
|
if (ret[2]) {
|
|
321
308
|
throw takeFromExternrefTable0(ret[1]);
|
|
322
309
|
}
|
|
@@ -519,20 +506,6 @@ export function mlKem1024Encapsulate(public_key) {
|
|
|
519
506
|
return takeFromExternrefTable0(ret[0]);
|
|
520
507
|
}
|
|
521
508
|
|
|
522
|
-
/**
|
|
523
|
-
* Deterministically encapsulate to an ML-KEM-1024 public key.
|
|
524
|
-
* @param {Uint8Array} public_key
|
|
525
|
-
* @param {Uint8Array} randomness
|
|
526
|
-
* @returns {any}
|
|
527
|
-
*/
|
|
528
|
-
export function mlKem1024EncapsulateDerand(public_key, randomness) {
|
|
529
|
-
const ret = wasm.mlKem1024EncapsulateDerand(public_key, randomness);
|
|
530
|
-
if (ret[2]) {
|
|
531
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
532
|
-
}
|
|
533
|
-
return takeFromExternrefTable0(ret[0]);
|
|
534
|
-
}
|
|
535
|
-
|
|
536
509
|
/**
|
|
537
510
|
* Generate an ML-KEM-1024 keypair.
|
|
538
511
|
* @returns {any}
|
|
@@ -585,20 +558,6 @@ export function mlKem512Encapsulate(public_key) {
|
|
|
585
558
|
return takeFromExternrefTable0(ret[0]);
|
|
586
559
|
}
|
|
587
560
|
|
|
588
|
-
/**
|
|
589
|
-
* Deterministically encapsulate to an ML-KEM-512 public key.
|
|
590
|
-
* @param {Uint8Array} public_key
|
|
591
|
-
* @param {Uint8Array} randomness
|
|
592
|
-
* @returns {any}
|
|
593
|
-
*/
|
|
594
|
-
export function mlKem512EncapsulateDerand(public_key, randomness) {
|
|
595
|
-
const ret = wasm.mlKem512EncapsulateDerand(public_key, randomness);
|
|
596
|
-
if (ret[2]) {
|
|
597
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
598
|
-
}
|
|
599
|
-
return takeFromExternrefTable0(ret[0]);
|
|
600
|
-
}
|
|
601
|
-
|
|
602
561
|
/**
|
|
603
562
|
* Generate an ML-KEM-512 keypair.
|
|
604
563
|
* @returns {any}
|
|
@@ -651,20 +610,6 @@ export function mlKem768Encapsulate(public_key) {
|
|
|
651
610
|
return takeFromExternrefTable0(ret[0]);
|
|
652
611
|
}
|
|
653
612
|
|
|
654
|
-
/**
|
|
655
|
-
* Deterministically encapsulate to an ML-KEM-768 public key.
|
|
656
|
-
* @param {Uint8Array} public_key
|
|
657
|
-
* @param {Uint8Array} randomness
|
|
658
|
-
* @returns {any}
|
|
659
|
-
*/
|
|
660
|
-
export function mlKem768EncapsulateDerand(public_key, randomness) {
|
|
661
|
-
const ret = wasm.mlKem768EncapsulateDerand(public_key, randomness);
|
|
662
|
-
if (ret[2]) {
|
|
663
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
664
|
-
}
|
|
665
|
-
return takeFromExternrefTable0(ret[0]);
|
|
666
|
-
}
|
|
667
|
-
|
|
668
613
|
/**
|
|
669
614
|
* Generate an ML-KEM-768 keypair.
|
|
670
615
|
* @returns {any}
|
|
@@ -678,124 +623,23 @@ export function mlKem768GenerateKeypair() {
|
|
|
678
623
|
}
|
|
679
624
|
|
|
680
625
|
/**
|
|
681
|
-
*
|
|
682
|
-
* @param {Uint8Array}
|
|
683
|
-
* @returns {string}
|
|
684
|
-
*/
|
|
685
|
-
export function multibaseBase58btcEncode(bytes) {
|
|
686
|
-
let deferred1_0;
|
|
687
|
-
let deferred1_1;
|
|
688
|
-
try {
|
|
689
|
-
const ret = wasm.multibaseBase58btcEncode(bytes);
|
|
690
|
-
deferred1_0 = ret[0];
|
|
691
|
-
deferred1_1 = ret[1];
|
|
692
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
693
|
-
} finally {
|
|
694
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
/**
|
|
699
|
-
* Encode bytes with the multibase base64url prefix.
|
|
700
|
-
* @param {Uint8Array} bytes
|
|
701
|
-
* @returns {string}
|
|
702
|
-
*/
|
|
703
|
-
export function multibaseBase64urlEncode(bytes) {
|
|
704
|
-
let deferred1_0;
|
|
705
|
-
let deferred1_1;
|
|
706
|
-
try {
|
|
707
|
-
const ret = wasm.multibaseBase64urlEncode(bytes);
|
|
708
|
-
deferred1_0 = ret[0];
|
|
709
|
-
deferred1_1 = ret[1];
|
|
710
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
711
|
-
} finally {
|
|
712
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
/**
|
|
717
|
-
* Decode a supported multibase string.
|
|
718
|
-
* @param {string} encoded
|
|
626
|
+
* Execute one generated binary protobuf request and return a binary `CryptoOperationResponse`.
|
|
627
|
+
* @param {Uint8Array} request
|
|
719
628
|
* @returns {Uint8Array}
|
|
720
629
|
*/
|
|
721
|
-
export function
|
|
722
|
-
const
|
|
723
|
-
|
|
724
|
-
const ret = wasm.multibaseDecode(ptr0, len0);
|
|
725
|
-
if (ret[2]) {
|
|
726
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
727
|
-
}
|
|
728
|
-
return takeFromExternrefTable0(ret[0]);
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
/**
|
|
732
|
-
* Resolve a byte slice that starts with a known multicodec prefix.
|
|
733
|
-
* @param {Uint8Array} bytes
|
|
734
|
-
* @returns {any}
|
|
735
|
-
*/
|
|
736
|
-
export function multicodecLookupPrefix(bytes) {
|
|
737
|
-
const ret = wasm.multicodecLookupPrefix(bytes);
|
|
738
|
-
if (ret[2]) {
|
|
739
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
740
|
-
}
|
|
741
|
-
return takeFromExternrefTable0(ret[0]);
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
/**
|
|
745
|
-
* Return multicodec metadata for a canonical codec name.
|
|
746
|
-
* @param {string} codec_name
|
|
747
|
-
* @returns {any}
|
|
748
|
-
*/
|
|
749
|
-
export function multicodecPrefixForName(codec_name) {
|
|
750
|
-
const ptr0 = passStringToWasm0(codec_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
751
|
-
const len0 = WASM_VECTOR_LEN;
|
|
752
|
-
const ret = wasm.multicodecPrefixForName(ptr0, len0);
|
|
753
|
-
if (ret[2]) {
|
|
754
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
755
|
-
}
|
|
756
|
-
return takeFromExternrefTable0(ret[0]);
|
|
630
|
+
export function processOperationResponse(request) {
|
|
631
|
+
const ret = wasm.processOperationResponse(request);
|
|
632
|
+
return ret;
|
|
757
633
|
}
|
|
758
634
|
|
|
759
635
|
/**
|
|
760
|
-
*
|
|
761
|
-
* @param {
|
|
762
|
-
* @
|
|
763
|
-
* @returns {string}
|
|
764
|
-
*/
|
|
765
|
-
export function multikeyEncode(codec_name, public_key) {
|
|
766
|
-
let deferred3_0;
|
|
767
|
-
let deferred3_1;
|
|
768
|
-
try {
|
|
769
|
-
const ptr0 = passStringToWasm0(codec_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
770
|
-
const len0 = WASM_VECTOR_LEN;
|
|
771
|
-
const ret = wasm.multikeyEncode(ptr0, len0, public_key);
|
|
772
|
-
var ptr2 = ret[0];
|
|
773
|
-
var len2 = ret[1];
|
|
774
|
-
if (ret[3]) {
|
|
775
|
-
ptr2 = 0; len2 = 0;
|
|
776
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
777
|
-
}
|
|
778
|
-
deferred3_0 = ptr2;
|
|
779
|
-
deferred3_1 = len2;
|
|
780
|
-
return getStringFromWasm0(ptr2, len2);
|
|
781
|
-
} finally {
|
|
782
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
/**
|
|
787
|
-
* Parse and validate a multikey string.
|
|
788
|
-
* @param {string} multikey
|
|
789
|
-
* @returns {any}
|
|
636
|
+
* Execute one generated ProtoJSON request and return a binary `CryptoOperationResponse`.
|
|
637
|
+
* @param {Uint8Array} request_json
|
|
638
|
+
* @returns {Uint8Array}
|
|
790
639
|
*/
|
|
791
|
-
export function
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
const ret = wasm.multikeyParse(ptr0, len0);
|
|
795
|
-
if (ret[2]) {
|
|
796
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
797
|
-
}
|
|
798
|
-
return takeFromExternrefTable0(ret[0]);
|
|
640
|
+
export function processOperationResponseJson(request_json) {
|
|
641
|
+
const ret = wasm.processOperationResponseJson(request_json);
|
|
642
|
+
return ret;
|
|
799
643
|
}
|
|
800
644
|
|
|
801
645
|
/**
|
|
@@ -884,72 +728,6 @@ export function slhDsaSha2128sVerify(public_key, message, signature) {
|
|
|
884
728
|
}
|
|
885
729
|
}
|
|
886
730
|
|
|
887
|
-
/**
|
|
888
|
-
* Decapsulate an X-Wing-1024 ciphertext with a 32-byte secret seed.
|
|
889
|
-
* @param {Uint8Array} ciphertext
|
|
890
|
-
* @param {Uint8Array} secret_key
|
|
891
|
-
* @returns {Uint8Array}
|
|
892
|
-
*/
|
|
893
|
-
export function xWing1024Decapsulate(ciphertext, secret_key) {
|
|
894
|
-
const ret = wasm.xWing1024Decapsulate(ciphertext, secret_key);
|
|
895
|
-
if (ret[2]) {
|
|
896
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
897
|
-
}
|
|
898
|
-
return takeFromExternrefTable0(ret[0]);
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
/**
|
|
902
|
-
* Derive an X-Wing-1024 public key from a 32-byte secret seed.
|
|
903
|
-
* @param {Uint8Array} secret_key
|
|
904
|
-
* @returns {any}
|
|
905
|
-
*/
|
|
906
|
-
export function xWing1024DeriveKeypair(secret_key) {
|
|
907
|
-
const ret = wasm.xWing1024DeriveKeypair(secret_key);
|
|
908
|
-
if (ret[2]) {
|
|
909
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
910
|
-
}
|
|
911
|
-
return takeFromExternrefTable0(ret[0]);
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
/**
|
|
915
|
-
* Randomly encapsulate to an X-Wing-1024 public key.
|
|
916
|
-
* @param {Uint8Array} public_key
|
|
917
|
-
* @returns {any}
|
|
918
|
-
*/
|
|
919
|
-
export function xWing1024Encapsulate(public_key) {
|
|
920
|
-
const ret = wasm.xWing1024Encapsulate(public_key);
|
|
921
|
-
if (ret[2]) {
|
|
922
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
923
|
-
}
|
|
924
|
-
return takeFromExternrefTable0(ret[0]);
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
/**
|
|
928
|
-
* Deterministically encapsulate to an X-Wing-1024 public key for conformance tests.
|
|
929
|
-
* @param {Uint8Array} public_key
|
|
930
|
-
* @param {Uint8Array} seed
|
|
931
|
-
* @returns {any}
|
|
932
|
-
*/
|
|
933
|
-
export function xWing1024EncapsulateDerand(public_key, seed) {
|
|
934
|
-
const ret = wasm.xWing1024EncapsulateDerand(public_key, seed);
|
|
935
|
-
if (ret[2]) {
|
|
936
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
937
|
-
}
|
|
938
|
-
return takeFromExternrefTable0(ret[0]);
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
/**
|
|
942
|
-
* Generate a random X-Wing-1024 keypair for the TypeScript WASM provider.
|
|
943
|
-
* @returns {any}
|
|
944
|
-
*/
|
|
945
|
-
export function xWing1024GenerateKeypair() {
|
|
946
|
-
const ret = wasm.xWing1024GenerateKeypair();
|
|
947
|
-
if (ret[2]) {
|
|
948
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
949
|
-
}
|
|
950
|
-
return takeFromExternrefTable0(ret[0]);
|
|
951
|
-
}
|
|
952
|
-
|
|
953
731
|
/**
|
|
954
732
|
* Decapsulate an X-Wing-768 ciphertext with a 32-byte secret seed.
|
|
955
733
|
* @param {Uint8Array} ciphertext
|
|
@@ -990,20 +768,6 @@ export function xWing768Encapsulate(public_key) {
|
|
|
990
768
|
return takeFromExternrefTable0(ret[0]);
|
|
991
769
|
}
|
|
992
770
|
|
|
993
|
-
/**
|
|
994
|
-
* Deterministically encapsulate to an X-Wing-768 public key for conformance tests.
|
|
995
|
-
* @param {Uint8Array} public_key
|
|
996
|
-
* @param {Uint8Array} seed
|
|
997
|
-
* @returns {any}
|
|
998
|
-
*/
|
|
999
|
-
export function xWing768EncapsulateDerand(public_key, seed) {
|
|
1000
|
-
const ret = wasm.xWing768EncapsulateDerand(public_key, seed);
|
|
1001
|
-
if (ret[2]) {
|
|
1002
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1003
|
-
}
|
|
1004
|
-
return takeFromExternrefTable0(ret[0]);
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
771
|
/**
|
|
1008
772
|
* Generate a random X-Wing-768 keypair for the TypeScript WASM provider.
|
|
1009
773
|
* @returns {any}
|
|
@@ -1133,43 +897,6 @@ function handleError(f, args) {
|
|
|
1133
897
|
}
|
|
1134
898
|
}
|
|
1135
899
|
|
|
1136
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
1137
|
-
if (realloc === undefined) {
|
|
1138
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
1139
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
1140
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
1141
|
-
WASM_VECTOR_LEN = buf.length;
|
|
1142
|
-
return ptr;
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
let len = arg.length;
|
|
1146
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
1147
|
-
|
|
1148
|
-
const mem = getUint8ArrayMemory0();
|
|
1149
|
-
|
|
1150
|
-
let offset = 0;
|
|
1151
|
-
|
|
1152
|
-
for (; offset < len; offset++) {
|
|
1153
|
-
const code = arg.charCodeAt(offset);
|
|
1154
|
-
if (code > 0x7F) break;
|
|
1155
|
-
mem[ptr + offset] = code;
|
|
1156
|
-
}
|
|
1157
|
-
if (offset !== len) {
|
|
1158
|
-
if (offset !== 0) {
|
|
1159
|
-
arg = arg.slice(offset);
|
|
1160
|
-
}
|
|
1161
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
1162
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
1163
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
1164
|
-
|
|
1165
|
-
offset += ret.written;
|
|
1166
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
WASM_VECTOR_LEN = offset;
|
|
1170
|
-
return ptr;
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
900
|
function takeFromExternrefTable0(idx) {
|
|
1174
901
|
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
1175
902
|
wasm.__externref_table_dealloc(idx);
|
|
@@ -1190,21 +917,6 @@ function decodeText(ptr, len) {
|
|
|
1190
917
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
1191
918
|
}
|
|
1192
919
|
|
|
1193
|
-
const cachedTextEncoder = new TextEncoder();
|
|
1194
|
-
|
|
1195
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
1196
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
1197
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
1198
|
-
view.set(buf);
|
|
1199
|
-
return {
|
|
1200
|
-
read: arg.length,
|
|
1201
|
-
written: buf.length
|
|
1202
|
-
};
|
|
1203
|
-
};
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
let WASM_VECTOR_LEN = 0;
|
|
1207
|
-
|
|
1208
920
|
let wasmModule, wasmInstance, wasm;
|
|
1209
921
|
function __wbg_finalize_init(instance, module) {
|
|
1210
922
|
wasmInstance = instance;
|
|
Binary file
|
|
@@ -4,6 +4,8 @@ export type ReallyMeWasmInitOutput = Readonly<{
|
|
|
4
4
|
export declare function initSync(module: {
|
|
5
5
|
module: Uint8Array;
|
|
6
6
|
}): ReallyMeWasmInitOutput;
|
|
7
|
+
export declare function processOperationResponse(request: Uint8Array): Uint8Array;
|
|
8
|
+
export declare function processOperationResponseJson(requestJson: Uint8Array): Uint8Array;
|
|
7
9
|
export declare function aes128GcmOpen(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, ciphertextWithTag: Uint8Array): Uint8Array;
|
|
8
10
|
export declare function aes128GcmSeal(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, plaintext: Uint8Array): Uint8Array;
|
|
9
11
|
export declare function aes192GcmOpen(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, ciphertextWithTag: Uint8Array): Uint8Array;
|
|
@@ -12,37 +14,27 @@ export declare function aes256GcmOpen(key: Uint8Array, nonce: Uint8Array, aad: U
|
|
|
12
14
|
export declare function aes256GcmSeal(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, plaintext: Uint8Array): Uint8Array;
|
|
13
15
|
export declare function aes256GcmSivOpen(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, ciphertextWithTag: Uint8Array): Uint8Array;
|
|
14
16
|
export declare function aes256GcmSivSeal(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, plaintext: Uint8Array): Uint8Array;
|
|
17
|
+
export declare function aes128KwUnwrapKey(wrappingKey: Uint8Array, wrappedKey: Uint8Array): Uint8Array;
|
|
18
|
+
export declare function aes128KwWrapKey(wrappingKey: Uint8Array, keyToWrap: Uint8Array): Uint8Array;
|
|
19
|
+
export declare function aes192KwUnwrapKey(wrappingKey: Uint8Array, wrappedKey: Uint8Array): Uint8Array;
|
|
20
|
+
export declare function aes192KwWrapKey(wrappingKey: Uint8Array, keyToWrap: Uint8Array): Uint8Array;
|
|
15
21
|
export declare function aes256KwUnwrapKey(wrappingKey: Uint8Array, wrappedKey: Uint8Array): Uint8Array;
|
|
16
22
|
export declare function aes256KwWrapKey(wrappingKey: Uint8Array, keyToWrap: Uint8Array): Uint8Array;
|
|
17
23
|
export declare function argon2idDeriveKey(kdfVersion: number, secret: Uint8Array, salt: Uint8Array): Uint8Array;
|
|
18
|
-
export declare function
|
|
19
|
-
export declare function base64urlEncode(bytes: Uint8Array): string;
|
|
20
|
-
export declare function dagCborComputeCid(bytes: Uint8Array): string;
|
|
21
|
-
export declare function dagCborVerifyCid(cid: string, bytes: Uint8Array): unknown;
|
|
22
|
-
export declare function multibaseBase58btcEncode(bytes: Uint8Array): string;
|
|
23
|
-
export declare function multibaseBase64urlEncode(bytes: Uint8Array): string;
|
|
24
|
-
export declare function multibaseDecode(encoded: string): Uint8Array;
|
|
25
|
-
export declare function multicodecLookupPrefix(bytes: Uint8Array): unknown;
|
|
26
|
-
export declare function multicodecPrefixForName(codecName: string): unknown;
|
|
27
|
-
export declare function multikeyEncode(codecName: string, publicKey: Uint8Array): string;
|
|
28
|
-
export declare function multikeyParse(multikey: string): unknown;
|
|
24
|
+
export declare function kmac256Derive(key: Uint8Array, context: Uint8Array, customization: Uint8Array, outputLength: number): Uint8Array;
|
|
29
25
|
export declare function hpkeOpenBase(suite: number, recipientSecretKey: Uint8Array, encapsulatedKey: Uint8Array, info: Uint8Array, aad: Uint8Array, ciphertext: Uint8Array): Uint8Array;
|
|
30
26
|
export declare function hpkeSealBase(suite: number, recipientPublicKey: Uint8Array, info: Uint8Array, aad: Uint8Array, plaintext: Uint8Array): unknown;
|
|
31
|
-
export declare function hpkeSealBaseDerand(suite: number, recipientPublicKey: Uint8Array, encapsulationRandomness: Uint8Array, info: Uint8Array, aad: Uint8Array, plaintext: Uint8Array): unknown;
|
|
32
27
|
export declare function mlKem512GenerateKeypair(): unknown;
|
|
33
28
|
export declare function mlKem512DeriveKeypair(secretKey: Uint8Array): unknown;
|
|
34
29
|
export declare function mlKem512Encapsulate(publicKey: Uint8Array): unknown;
|
|
35
|
-
export declare function mlKem512EncapsulateDerand(publicKey: Uint8Array, randomness: Uint8Array): unknown;
|
|
36
30
|
export declare function mlKem512Decapsulate(ciphertext: Uint8Array, secretKey: Uint8Array): Uint8Array;
|
|
37
31
|
export declare function mlKem768GenerateKeypair(): unknown;
|
|
38
32
|
export declare function mlKem768DeriveKeypair(secretKey: Uint8Array): unknown;
|
|
39
33
|
export declare function mlKem768Encapsulate(publicKey: Uint8Array): unknown;
|
|
40
|
-
export declare function mlKem768EncapsulateDerand(publicKey: Uint8Array, randomness: Uint8Array): unknown;
|
|
41
34
|
export declare function mlKem768Decapsulate(ciphertext: Uint8Array, secretKey: Uint8Array): Uint8Array;
|
|
42
35
|
export declare function mlKem1024GenerateKeypair(): unknown;
|
|
43
36
|
export declare function mlKem1024DeriveKeypair(secretKey: Uint8Array): unknown;
|
|
44
37
|
export declare function mlKem1024Encapsulate(publicKey: Uint8Array): unknown;
|
|
45
|
-
export declare function mlKem1024EncapsulateDerand(publicKey: Uint8Array, randomness: Uint8Array): unknown;
|
|
46
38
|
export declare function mlKem1024Decapsulate(ciphertext: Uint8Array, secretKey: Uint8Array): Uint8Array;
|
|
47
39
|
export declare function mlDsa44GenerateKeypair(): unknown;
|
|
48
40
|
export declare function mlDsa44DeriveKeypair(secretKey: Uint8Array): unknown;
|
|
@@ -56,6 +48,8 @@ export declare function mlDsa87GenerateKeypair(): unknown;
|
|
|
56
48
|
export declare function mlDsa87DeriveKeypair(secretKey: Uint8Array): unknown;
|
|
57
49
|
export declare function mlDsa87Sign(secretKey: Uint8Array, message: Uint8Array): Uint8Array;
|
|
58
50
|
export declare function mlDsa87Verify(publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array): void;
|
|
51
|
+
export declare function rsaVerifyPkcs1v15(publicKeyDer: Uint8Array, publicKeyEncoding: number, hashSuite: number, message: Uint8Array, signature: Uint8Array): void;
|
|
52
|
+
export declare function rsaVerifyPss(publicKeyDer: Uint8Array, publicKeyEncoding: number, messageHashSuite: number, mgf1HashSuite: number, saltLength: number, message: Uint8Array, signature: Uint8Array): void;
|
|
59
53
|
export declare function slhDsaSha2128sGenerateKeypair(): unknown;
|
|
60
54
|
export declare function slhDsaSha2128sDeriveKeypair(skSeed: Uint8Array, skPrf: Uint8Array, pkSeed: Uint8Array): unknown;
|
|
61
55
|
export declare function slhDsaSha2128sSign(secretKey: Uint8Array, message: Uint8Array): Uint8Array;
|
|
@@ -64,13 +58,7 @@ export declare function chacha20Poly1305Open(key: Uint8Array, nonce: Uint8Array,
|
|
|
64
58
|
export declare function chacha20Poly1305Seal(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, plaintext: Uint8Array): Uint8Array;
|
|
65
59
|
export declare function xchacha20Poly1305Open(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, ciphertextWithTag: Uint8Array): Uint8Array;
|
|
66
60
|
export declare function xchacha20Poly1305Seal(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, plaintext: Uint8Array): Uint8Array;
|
|
67
|
-
export declare function xWing1024Decapsulate(ciphertext: Uint8Array, secretKey: Uint8Array): Uint8Array;
|
|
68
|
-
export declare function xWing1024DeriveKeypair(secretKey: Uint8Array): unknown;
|
|
69
|
-
export declare function xWing1024Encapsulate(publicKey: Uint8Array): unknown;
|
|
70
|
-
export declare function xWing1024EncapsulateDerand(publicKey: Uint8Array, seed: Uint8Array): unknown;
|
|
71
|
-
export declare function xWing1024GenerateKeypair(): unknown;
|
|
72
61
|
export declare function xWing768Decapsulate(ciphertext: Uint8Array, secretKey: Uint8Array): Uint8Array;
|
|
73
62
|
export declare function xWing768DeriveKeypair(secretKey: Uint8Array): unknown;
|
|
74
63
|
export declare function xWing768Encapsulate(publicKey: Uint8Array): unknown;
|
|
75
|
-
export declare function xWing768EncapsulateDerand(publicKey: Uint8Array, seed: Uint8Array): unknown;
|
|
76
64
|
export declare function xWing768GenerateKeypair(): unknown;
|