hpke 1.1.2 → 1.1.4
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/README.md +3 -3
- package/index.d.ts +148 -100
- package/index.d.ts.map +1 -1
- package/index.js +148 -64
- package/index.ts +248 -164
- package/package.json +20 -15
package/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* asymmetric key exchange with a symmetric cipher. This was originally defined in an Informational
|
|
6
6
|
* document on the IRTF stream as [RFC 9180](https://www.rfc-editor.org/rfc/rfc9180.html) and is now
|
|
7
7
|
* being republished as a Standards Track document of the IETF as
|
|
8
|
-
* [draft-ietf-hpke-hpke](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
8
|
+
* [draft-ietf-hpke-hpke](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04).
|
|
9
9
|
*
|
|
10
10
|
* HPKE provides a variant of public key encryption for arbitrary-sized plaintexts using a recipient
|
|
11
11
|
* public key.
|
|
@@ -58,17 +58,18 @@
|
|
|
58
58
|
*/
|
|
59
59
|
declare class SenderContext {
|
|
60
60
|
#private;
|
|
61
|
-
constructor(suite: Triple, mode:
|
|
61
|
+
constructor(suite: Triple, mode: Mode, key: Uint8Array, base_nonce: Uint8Array, exporter_secret: Uint8Array);
|
|
62
62
|
/**
|
|
63
63
|
* @returns The mode (0x00 = Base, 0x01 = PSK) for this context.
|
|
64
64
|
* @see {@link MODE_BASE}
|
|
65
65
|
* @see {@link MODE_PSK}
|
|
66
66
|
*/
|
|
67
|
-
get mode():
|
|
67
|
+
get mode(): Mode;
|
|
68
68
|
/**
|
|
69
69
|
* @returns The sequence number for this context's next {@link Seal}, initially zero, increments
|
|
70
70
|
* automatically with each successful {@link Seal}. The sequence number provides AEAD nonce
|
|
71
|
-
* uniqueness. The maximum supported sequence number
|
|
71
|
+
* uniqueness. The maximum supported sequence number is the lower of the AEAD nonce-size limit
|
|
72
|
+
* and `2^53-1`.
|
|
72
73
|
*/
|
|
73
74
|
get seq(): number;
|
|
74
75
|
/**
|
|
@@ -95,7 +96,7 @@ declare class SenderContext {
|
|
|
95
96
|
*
|
|
96
97
|
* @returns A Promise that resolves to the ciphertext. The ciphertext is {@link Nt} bytes longer
|
|
97
98
|
* than the plaintext.
|
|
98
|
-
* @see [Context.Seal](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
99
|
+
* @see [Context.Seal](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5.2)
|
|
99
100
|
*/
|
|
100
101
|
Seal(plaintext: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
|
|
101
102
|
/**
|
|
@@ -119,7 +120,7 @@ declare class SenderContext {
|
|
|
119
120
|
* @param length - Desired length of exported secret in bytes
|
|
120
121
|
*
|
|
121
122
|
* @returns A Promise that resolves to the exported secret.
|
|
122
|
-
* @see [Context.Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
123
|
+
* @see [Context.Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5.3)
|
|
123
124
|
*/
|
|
124
125
|
Export(exporterContext: Uint8Array, length: number): Promise<Uint8Array>;
|
|
125
126
|
/**
|
|
@@ -150,17 +151,18 @@ export type { SenderContext };
|
|
|
150
151
|
*/
|
|
151
152
|
declare class RecipientContext {
|
|
152
153
|
#private;
|
|
153
|
-
constructor(suite: Triple, mode:
|
|
154
|
+
constructor(suite: Triple, mode: Mode, key: Uint8Array, base_nonce: Uint8Array, exporter_secret: Uint8Array);
|
|
154
155
|
/**
|
|
155
156
|
* @returns The mode (0x00 = Base, 0x01 = PSK) for this context.
|
|
156
157
|
* @see {@link MODE_BASE}
|
|
157
158
|
* @see {@link MODE_PSK}
|
|
158
159
|
*/
|
|
159
|
-
get mode():
|
|
160
|
+
get mode(): Mode;
|
|
160
161
|
/**
|
|
161
162
|
* @returns The sequence number for this context's next {@link Open}, initially zero, increments
|
|
162
163
|
* automatically with each successful {@link Open}. The sequence number provides AEAD nonce
|
|
163
|
-
* uniqueness. The maximum supported sequence number
|
|
164
|
+
* uniqueness. The maximum supported sequence number is the lower of the AEAD nonce-size limit
|
|
165
|
+
* and `2^53-1`.
|
|
164
166
|
*/
|
|
165
167
|
get seq(): number;
|
|
166
168
|
/**
|
|
@@ -188,7 +190,7 @@ declare class RecipientContext {
|
|
|
188
190
|
* @param aad - Additional authenticated data
|
|
189
191
|
*
|
|
190
192
|
* @returns A Promise that resolves to the decrypted plaintext.
|
|
191
|
-
* @see [Context.Open](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
193
|
+
* @see [Context.Open](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5.2)
|
|
192
194
|
*/
|
|
193
195
|
Open(ciphertext: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
|
|
194
196
|
/**
|
|
@@ -212,7 +214,7 @@ declare class RecipientContext {
|
|
|
212
214
|
* @param length - Desired length of exported secret in bytes
|
|
213
215
|
*
|
|
214
216
|
* @returns A Promise that resolves to the exported secret.
|
|
215
|
-
* @see [Context.Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
217
|
+
* @see [Context.Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5.3)
|
|
216
218
|
*/
|
|
217
219
|
Export(exporterContext: Uint8Array, length: number): Promise<Uint8Array>;
|
|
218
220
|
}
|
|
@@ -224,7 +226,7 @@ export type { RecipientContext };
|
|
|
224
226
|
* asymmetric key exchange with a symmetric cipher. This was originally defined in an Informational
|
|
225
227
|
* document on the IRTF stream as [RFC 9180](https://www.rfc-editor.org/rfc/rfc9180.html) and is now
|
|
226
228
|
* being republished as a Standards Track document of the IETF as
|
|
227
|
-
* [draft-ietf-hpke-hpke](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
229
|
+
* [draft-ietf-hpke-hpke](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04).
|
|
228
230
|
*
|
|
229
231
|
* HPKE provides a variant of public key encryption for arbitrary-sized plaintexts using a recipient
|
|
230
232
|
* public key. It supports two modes:
|
|
@@ -238,9 +240,10 @@ export type { RecipientContext };
|
|
|
238
240
|
* - KDF: Key Derivation Function for deriving symmetric keys
|
|
239
241
|
* - AEAD: Authenticated Encryption with Additional Data for encryption
|
|
240
242
|
*
|
|
243
|
+
* @typeParam K - Key representation produced and consumed by the suite's KEM
|
|
241
244
|
* @group Core
|
|
242
245
|
*/
|
|
243
|
-
export declare class CipherSuite {
|
|
246
|
+
export declare class CipherSuite<K extends Key = Key> {
|
|
244
247
|
#private;
|
|
245
248
|
/**
|
|
246
249
|
* Creates a new HPKE cipher suite by combining a Key Encapsulation Mechanism (KEM), Key
|
|
@@ -303,7 +306,7 @@ export declare class CipherSuite {
|
|
|
303
306
|
* @see {@link KDFFactory Available KDFs}
|
|
304
307
|
* @see {@link AEADFactory Available AEADs}
|
|
305
308
|
*/
|
|
306
|
-
constructor(KEM: KEMFactory
|
|
309
|
+
constructor(KEM: KEMFactory<K>, KDF: KDFFactory, AEAD: AEADFactory);
|
|
307
310
|
/**
|
|
308
311
|
* Provides read-only access to this suite's KEM identifier, name, and other attributes.
|
|
309
312
|
*
|
|
@@ -311,17 +314,17 @@ export declare class CipherSuite {
|
|
|
311
314
|
*/
|
|
312
315
|
get KEM(): {
|
|
313
316
|
/** The identifier of this suite's KEM */
|
|
314
|
-
id: number;
|
|
317
|
+
readonly id: number;
|
|
315
318
|
/** The name of this suite's KEM */
|
|
316
|
-
name: string;
|
|
319
|
+
readonly name: string;
|
|
317
320
|
/** The length in bytes of this suite's KEM produced shared secret */
|
|
318
|
-
Nsecret: number;
|
|
321
|
+
readonly Nsecret: number;
|
|
319
322
|
/** The length in bytes of this suite's KEM produced encapsulated secret */
|
|
320
|
-
Nenc: number;
|
|
323
|
+
readonly Nenc: number;
|
|
321
324
|
/** The length in bytes of this suite's KEM public key */
|
|
322
|
-
Npk: number;
|
|
325
|
+
readonly Npk: number;
|
|
323
326
|
/** The length in bytes of this suite's KEM private key */
|
|
324
|
-
Nsk: number;
|
|
327
|
+
readonly Nsk: number;
|
|
325
328
|
};
|
|
326
329
|
/**
|
|
327
330
|
* Provides read-only access to this suite's KDF identifier, name, and other attributes.
|
|
@@ -330,21 +333,21 @@ export declare class CipherSuite {
|
|
|
330
333
|
*/
|
|
331
334
|
get KDF(): {
|
|
332
335
|
/** The identifier of this suite's KDF */
|
|
333
|
-
id: number;
|
|
336
|
+
readonly id: number;
|
|
334
337
|
/** The name of this suite's KDF */
|
|
335
|
-
name: string;
|
|
338
|
+
readonly name: string;
|
|
336
339
|
/**
|
|
337
340
|
* When 1, this suite's KDF is a one-stage (Derive) KDF.
|
|
338
341
|
*
|
|
339
342
|
* When 2, this suite's KDF is a two-stage (Extract and Expand) KDF.
|
|
340
343
|
*/
|
|
341
|
-
stages: 1 | 2;
|
|
344
|
+
readonly stages: 1 | 2;
|
|
342
345
|
/**
|
|
343
346
|
* For one-stage KDF: The security strength of this suite's KDF, in bytes.
|
|
344
347
|
*
|
|
345
348
|
* For two-stage KDF: The output size of this suite's KDF Extract() function in bytes.
|
|
346
349
|
*/
|
|
347
|
-
Nh: number;
|
|
350
|
+
readonly Nh: number;
|
|
348
351
|
};
|
|
349
352
|
/**
|
|
350
353
|
* Provides read-only access to this suite's AEAD identifier, name, and other attributes.
|
|
@@ -354,15 +357,15 @@ export declare class CipherSuite {
|
|
|
354
357
|
*/
|
|
355
358
|
get AEAD(): {
|
|
356
359
|
/** The identifier of this suite's AEAD */
|
|
357
|
-
id: number;
|
|
360
|
+
readonly id: number;
|
|
358
361
|
/** The name of this suite's AEAD */
|
|
359
|
-
name: string;
|
|
362
|
+
readonly name: string;
|
|
360
363
|
/** The length in bytes of a key for this suite's AEAD */
|
|
361
|
-
Nk: number;
|
|
364
|
+
readonly Nk: number;
|
|
362
365
|
/** The length in bytes of a nonce for this suite's AEAD */
|
|
363
|
-
Nn: number;
|
|
366
|
+
readonly Nn: number;
|
|
364
367
|
/** The length in bytes of an authentication tag for this suite's AEAD */
|
|
365
|
-
Nt: number;
|
|
368
|
+
readonly Nt: number;
|
|
366
369
|
};
|
|
367
370
|
/**
|
|
368
371
|
* Generates a random key pair for this CipherSuite. By default, private keys are generated as
|
|
@@ -381,7 +384,7 @@ export declare class CipherSuite {
|
|
|
381
384
|
*
|
|
382
385
|
* @returns A Promise that resolves to a generated key pair.
|
|
383
386
|
*/
|
|
384
|
-
GenerateKeyPair(extractable?: boolean): Promise<KeyPair
|
|
387
|
+
GenerateKeyPair(extractable?: boolean): Promise<KeyPair<K>>;
|
|
385
388
|
/**
|
|
386
389
|
* Deterministically derives a key pair for this CipherSuite's KEM from input keying material. By
|
|
387
390
|
* default, private keys are derived as non-extractable (their value cannot be exported).
|
|
@@ -409,7 +412,7 @@ export declare class CipherSuite {
|
|
|
409
412
|
*
|
|
410
413
|
* @returns A Promise that resolves to the derived key pair.
|
|
411
414
|
*/
|
|
412
|
-
DeriveKeyPair(ikm: Uint8Array, extractable?: boolean): Promise<KeyPair
|
|
415
|
+
DeriveKeyPair(ikm: Uint8Array, extractable?: boolean): Promise<KeyPair<K>>;
|
|
413
416
|
/**
|
|
414
417
|
* Serializes an extractable private key to bytes.
|
|
415
418
|
*
|
|
@@ -426,7 +429,7 @@ export declare class CipherSuite {
|
|
|
426
429
|
*
|
|
427
430
|
* @returns A Promise that resolves to the serialized private key.
|
|
428
431
|
*/
|
|
429
|
-
SerializePrivateKey(privateKey:
|
|
432
|
+
SerializePrivateKey(privateKey: K): Promise<Uint8Array>;
|
|
430
433
|
/**
|
|
431
434
|
* Serializes a public key to bytes.
|
|
432
435
|
*
|
|
@@ -443,7 +446,7 @@ export declare class CipherSuite {
|
|
|
443
446
|
*
|
|
444
447
|
* @returns A Promise that resolves to the serialized public key.
|
|
445
448
|
*/
|
|
446
|
-
SerializePublicKey(publicKey:
|
|
449
|
+
SerializePublicKey(publicKey: K): Promise<Uint8Array>;
|
|
447
450
|
/**
|
|
448
451
|
* Deserializes a private key from bytes. By default, private keys are deserialized as
|
|
449
452
|
* non-extractable (their value cannot be exported).
|
|
@@ -463,7 +466,7 @@ export declare class CipherSuite {
|
|
|
463
466
|
*
|
|
464
467
|
* @returns A Promise that resolves to the deserialized private key.
|
|
465
468
|
*/
|
|
466
|
-
DeserializePrivateKey(privateKey: Uint8Array, extractable?: boolean): Promise<
|
|
469
|
+
DeserializePrivateKey(privateKey: Uint8Array, extractable?: boolean): Promise<K>;
|
|
467
470
|
/**
|
|
468
471
|
* Deserializes a public key from bytes. Public keys are always deserialized as extractable (their
|
|
469
472
|
* value can be exported, e.g. by {@link SerializePublicKey}).
|
|
@@ -481,7 +484,7 @@ export declare class CipherSuite {
|
|
|
481
484
|
*
|
|
482
485
|
* @returns A Promise that resolves to the deserialized public key.
|
|
483
486
|
*/
|
|
484
|
-
DeserializePublicKey(publicKey: Uint8Array): Promise<
|
|
487
|
+
DeserializePublicKey(publicKey: Uint8Array): Promise<K>;
|
|
485
488
|
/**
|
|
486
489
|
* Single-shot API for encrypting a single message. It combines context setup and encryption in
|
|
487
490
|
* one call.
|
|
@@ -514,9 +517,9 @@ export declare class CipherSuite {
|
|
|
514
517
|
* @returns A Promise that resolves to an object containing the encapsulated secret and
|
|
515
518
|
* ciphertext. The ciphertext is {@link CipherSuite.AEAD Nt} bytes longer than the plaintext. The
|
|
516
519
|
* encapsulated secret is {@link CipherSuite.KEM Nenc} bytes.
|
|
517
|
-
* @see [Single-Shot Encryption](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
520
|
+
* @see [Single-Shot Encryption](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-6.1)
|
|
518
521
|
*/
|
|
519
|
-
Seal(publicKey:
|
|
522
|
+
Seal(publicKey: K, plaintext: Uint8Array, options?: {
|
|
520
523
|
aad?: Uint8Array;
|
|
521
524
|
info?: Uint8Array;
|
|
522
525
|
psk?: Uint8Array;
|
|
@@ -559,9 +562,9 @@ export declare class CipherSuite {
|
|
|
559
562
|
* @param options.pskId - Pre-shared key identifier (for PSK mode)
|
|
560
563
|
*
|
|
561
564
|
* @returns A Promise that resolves to the decrypted plaintext.
|
|
562
|
-
* @see [Single-Shot Decryption](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
565
|
+
* @see [Single-Shot Decryption](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-6.1)
|
|
563
566
|
*/
|
|
564
|
-
Open(privateKey:
|
|
567
|
+
Open(privateKey: K | KeyPair<K>, encapsulatedSecret: Uint8Array, ciphertext: Uint8Array, options?: {
|
|
565
568
|
aad?: Uint8Array;
|
|
566
569
|
info?: Uint8Array;
|
|
567
570
|
psk?: Uint8Array;
|
|
@@ -600,9 +603,9 @@ export declare class CipherSuite {
|
|
|
600
603
|
*
|
|
601
604
|
* @returns A Promise that resolves to an object containing the encapsulated secret and the
|
|
602
605
|
* exported secret.
|
|
603
|
-
* @see [Single-Shot Secret Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
606
|
+
* @see [Single-Shot Secret Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-6.2)
|
|
604
607
|
*/
|
|
605
|
-
SendExport(publicKey:
|
|
608
|
+
SendExport(publicKey: K, exporterContext: Uint8Array, length: number, options?: {
|
|
606
609
|
info?: Uint8Array;
|
|
607
610
|
psk?: Uint8Array;
|
|
608
611
|
pskId?: Uint8Array;
|
|
@@ -645,9 +648,9 @@ export declare class CipherSuite {
|
|
|
645
648
|
* @param options.pskId - Pre-shared key identifier (for PSK mode)
|
|
646
649
|
*
|
|
647
650
|
* @returns A Promise that resolves to the exported secret.
|
|
648
|
-
* @see [Single-Shot Secret Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
651
|
+
* @see [Single-Shot Secret Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-6.2)
|
|
649
652
|
*/
|
|
650
|
-
ReceiveExport(privateKey:
|
|
653
|
+
ReceiveExport(privateKey: K | KeyPair<K>, encapsulatedSecret: Uint8Array, exporterContext: Uint8Array, length: number, options?: {
|
|
651
654
|
info?: Uint8Array;
|
|
652
655
|
psk?: Uint8Array;
|
|
653
656
|
pskId?: Uint8Array;
|
|
@@ -693,9 +696,9 @@ export declare class CipherSuite {
|
|
|
693
696
|
*
|
|
694
697
|
* @returns A Promise that resolves to an object containing the encapsulated secret and the sender
|
|
695
698
|
* context (`ctx`). The encapsulated secret is {@link CipherSuite.KEM Nenc} bytes.
|
|
696
|
-
* @see [SetupBaseS / SetupPSKS](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
699
|
+
* @see [SetupBaseS / SetupPSKS](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5.1.1)
|
|
697
700
|
*/
|
|
698
|
-
SetupSender(publicKey:
|
|
701
|
+
SetupSender(publicKey: K, options?: {
|
|
699
702
|
info?: Uint8Array;
|
|
700
703
|
psk?: Uint8Array;
|
|
701
704
|
pskId?: Uint8Array;
|
|
@@ -749,9 +752,9 @@ export declare class CipherSuite {
|
|
|
749
752
|
* @param options.pskId - Pre-shared key identifier (for PSK mode)
|
|
750
753
|
*
|
|
751
754
|
* @returns A Promise that resolves to the recipient context.
|
|
752
|
-
* @see [SetupBaseR / SetupPSKR](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
755
|
+
* @see [SetupBaseR / SetupPSKR](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5.1.1)
|
|
753
756
|
*/
|
|
754
|
-
SetupRecipient(privateKey:
|
|
757
|
+
SetupRecipient(privateKey: K | KeyPair<K>, encapsulatedSecret: Uint8Array, options?: {
|
|
755
758
|
info?: Uint8Array;
|
|
756
759
|
psk?: Uint8Array;
|
|
757
760
|
pskId?: Uint8Array;
|
|
@@ -845,9 +848,9 @@ export declare class NotSupportedError extends Error {
|
|
|
845
848
|
cause?: unknown;
|
|
846
849
|
});
|
|
847
850
|
}
|
|
848
|
-
interface Triple {
|
|
851
|
+
interface Triple<K extends Key = Key> {
|
|
849
852
|
readonly id: Uint8Array;
|
|
850
|
-
readonly KEM: Readonly<KEM
|
|
853
|
+
readonly KEM: Readonly<KEM<K>>;
|
|
851
854
|
readonly KDF: Readonly<KDF>;
|
|
852
855
|
readonly AEAD: Readonly<AEAD>;
|
|
853
856
|
}
|
|
@@ -857,7 +860,7 @@ interface Triple {
|
|
|
857
860
|
* Base mode provides encryption to a public key without sender authentication. The recipient cannot
|
|
858
861
|
* verify who encrypted the message, only that someone with access to their public key did.
|
|
859
862
|
*
|
|
860
|
-
* @see [HPKE Modes](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
863
|
+
* @see [HPKE Modes](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5)
|
|
861
864
|
*/
|
|
862
865
|
export declare const MODE_BASE = 0;
|
|
863
866
|
/**
|
|
@@ -867,9 +870,11 @@ export declare const MODE_BASE = 0;
|
|
|
867
870
|
* sender and recipient must possess the same PSK and PSK ID. This provides implicit sender
|
|
868
871
|
* authentication.
|
|
869
872
|
*
|
|
870
|
-
* @see [HPKE Modes](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
873
|
+
* @see [HPKE Modes](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5)
|
|
871
874
|
*/
|
|
872
875
|
export declare const MODE_PSK = 1;
|
|
876
|
+
/** Mode supported by this implementation. */
|
|
877
|
+
export type Mode = typeof MODE_BASE | typeof MODE_PSK;
|
|
873
878
|
/**
|
|
874
879
|
* Factory function that returns a KEM implementation.
|
|
875
880
|
*
|
|
@@ -901,8 +906,10 @@ export declare const MODE_PSK = 1;
|
|
|
901
906
|
* > returning an object conforming to the {@link KEM} interface can be used. Such implementations not
|
|
902
907
|
* > reliant on Web Cryptography are exported by
|
|
903
908
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
909
|
+
*
|
|
910
|
+
* @typeParam K - Key representation produced and consumed by the KEM
|
|
904
911
|
*/
|
|
905
|
-
export type KEMFactory = () => Readonly<KEM
|
|
912
|
+
export type KEMFactory<K extends Key = Key> = () => Readonly<KEM<K>>;
|
|
906
913
|
/**
|
|
907
914
|
* Factory function that returns a KDF implementation.
|
|
908
915
|
*
|
|
@@ -956,12 +963,14 @@ export type AEADFactory = () => Readonly<AEAD>;
|
|
|
956
963
|
* - Private Key: Used by recipients for decryption operations (passed to
|
|
957
964
|
* {@link CipherSuite.SetupRecipient} or {@link CipherSuite.Open}). These are not distributed and
|
|
958
965
|
* kept private.
|
|
966
|
+
*
|
|
967
|
+
* @typeParam K - Key representation contained in the pair
|
|
959
968
|
*/
|
|
960
|
-
export interface KeyPair {
|
|
969
|
+
export interface KeyPair<K extends Key = Key> {
|
|
961
970
|
/** The public key, used for encryption operations. */
|
|
962
|
-
readonly publicKey: Readonly<
|
|
971
|
+
readonly publicKey: Readonly<K>;
|
|
963
972
|
/** The private key, used for decryption operations. */
|
|
964
|
-
readonly privateKey: Readonly<
|
|
973
|
+
readonly privateKey: Readonly<K>;
|
|
965
974
|
}
|
|
966
975
|
/**
|
|
967
976
|
* A minimal key representation interface.
|
|
@@ -984,6 +993,38 @@ export interface Key {
|
|
|
984
993
|
/** The type of key: 'private' or 'public' */
|
|
985
994
|
readonly type: 'private' | 'public' | (string & {});
|
|
986
995
|
}
|
|
996
|
+
/**
|
|
997
|
+
* A Web Cryptography key as declared by the host runtime.
|
|
998
|
+
*
|
|
999
|
+
* This aliases the key type returned by the host's `SubtleCrypto.generateKey()` API when it is
|
|
1000
|
+
* exposed on `globalThis`. A structural fallback is used otherwise, keeping the package portable to
|
|
1001
|
+
* runtimes and TypeScript projects that do not include DOM or Node.js ambient types.
|
|
1002
|
+
*/
|
|
1003
|
+
export type CryptoKey = typeof globalThis extends {
|
|
1004
|
+
crypto: {
|
|
1005
|
+
subtle: {
|
|
1006
|
+
generateKey(...args: any[]): Promise<infer R>;
|
|
1007
|
+
};
|
|
1008
|
+
};
|
|
1009
|
+
} ? Extract<R, {
|
|
1010
|
+
type: string;
|
|
1011
|
+
}> : CryptoKeyStructuralFallback;
|
|
1012
|
+
/**
|
|
1013
|
+
* Used as {@link CryptoKey} when the host runtime's `crypto` global is not exposed on `typeof
|
|
1014
|
+
* globalThis`, including when it is absent from ambient types or declared with `const` or `let`. It
|
|
1015
|
+
* remains structurally compatible with host {@link !CryptoKey} declarations so values flow freely to
|
|
1016
|
+
* and from {@link !SubtleCrypto} APIs.
|
|
1017
|
+
*
|
|
1018
|
+
* @internal
|
|
1019
|
+
*/
|
|
1020
|
+
interface CryptoKeyStructuralFallback {
|
|
1021
|
+
readonly algorithm: {
|
|
1022
|
+
name: string;
|
|
1023
|
+
};
|
|
1024
|
+
readonly extractable: boolean;
|
|
1025
|
+
readonly type: string;
|
|
1026
|
+
readonly usages: string[];
|
|
1027
|
+
}
|
|
987
1028
|
/**
|
|
988
1029
|
* Concatenates multiple Uint8Array buffers into a single Uint8Array. It's exported for use in
|
|
989
1030
|
* custom KEM, KDF, or AEAD implementations.
|
|
@@ -1023,7 +1064,7 @@ export declare function encode(string: string): Uint8Array;
|
|
|
1023
1064
|
* ensures domain separation between different uses of the KDF in HPKE.
|
|
1024
1065
|
*
|
|
1025
1066
|
* @group Utilities
|
|
1026
|
-
* @see [LabeledDerive](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-
|
|
1067
|
+
* @see [LabeledDerive](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-5)
|
|
1027
1068
|
*/
|
|
1028
1069
|
export declare function LabeledDerive(KDF: Pick<KDF, 'Derive'>, suite_id: Uint8Array, ikm: Uint8Array, label: Uint8Array, context: Uint8Array, L: number): Promise<Uint8Array>;
|
|
1029
1070
|
/**
|
|
@@ -1091,7 +1132,7 @@ export declare function LabeledDerive(KDF: Pick<KDF, 'Derive'>, suite_id: Uint8A
|
|
|
1091
1132
|
|
|
1092
1133
|
|
|
1093
1134
|
|
|
1094
|
-
* @see [HPKE Key Derivation Functions](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1135
|
+
* @see [HPKE Key Derivation Functions](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-4.2)
|
|
1095
1136
|
*/
|
|
1096
1137
|
export interface KDF {
|
|
1097
1138
|
/** KDF algorithm identifier */
|
|
@@ -1152,7 +1193,7 @@ export interface KDF {
|
|
|
1152
1193
|
* pseudorandom key. This ensures domain separation between different uses of the KDF in HPKE.
|
|
1153
1194
|
*
|
|
1154
1195
|
* @group Utilities
|
|
1155
|
-
* @see [LabeledExtract](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1196
|
+
* @see [LabeledExtract](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-4.4)
|
|
1156
1197
|
*/
|
|
1157
1198
|
export declare function LabeledExtract(KDF: Pick<KDF, 'Extract'>, suite_id: Uint8Array, salt: Uint8Array, label: Uint8Array, ikm: Uint8Array): Promise<Uint8Array>;
|
|
1158
1199
|
/**
|
|
@@ -1172,7 +1213,7 @@ export declare function LabeledExtract(KDF: Pick<KDF, 'Extract'>, suite_id: Uint
|
|
|
1172
1213
|
* of the KDF in HPKE.
|
|
1173
1214
|
*
|
|
1174
1215
|
* @group Utilities
|
|
1175
|
-
* @see [LabeledExpand](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1216
|
+
* @see [LabeledExpand](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-4.4)
|
|
1176
1217
|
*/
|
|
1177
1218
|
export declare function LabeledExpand(KDF: Pick<KDF, 'Expand'>, suite_id: Uint8Array, prk: Uint8Array, label: Uint8Array, info: Uint8Array, L: number): Promise<Uint8Array>;
|
|
1178
1219
|
/**
|
|
@@ -1266,9 +1307,10 @@ export declare function LabeledExpand(KDF: Pick<KDF, 'Expand'>, suite_id: Uint8A
|
|
|
1266
1307
|
|
|
1267
1308
|
|
|
1268
1309
|
|
|
1269
|
-
* @
|
|
1310
|
+
* @typeParam K - Key representation produced and consumed by the KEM
|
|
1311
|
+
* @see [HPKE Key Encapsulation Mechanisms](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-4.1)
|
|
1270
1312
|
*/
|
|
1271
|
-
export interface KEM {
|
|
1313
|
+
export interface KEM<K extends Key = Key> {
|
|
1272
1314
|
/** KEM algorithm identifier */
|
|
1273
1315
|
readonly id: number;
|
|
1274
1316
|
/** Type discriminator, always 'KEM' */
|
|
@@ -1291,7 +1333,7 @@ export interface KEM {
|
|
|
1291
1333
|
*
|
|
1292
1334
|
* @returns A promise resolving to a {@link KeyPair}
|
|
1293
1335
|
*/
|
|
1294
|
-
DeriveKeyPair(ikm: Uint8Array, extractable: boolean): Promise<KeyPair
|
|
1336
|
+
DeriveKeyPair(ikm: Uint8Array, extractable: boolean): Promise<KeyPair<K>>;
|
|
1295
1337
|
/**
|
|
1296
1338
|
* Generates a random key pair.
|
|
1297
1339
|
*
|
|
@@ -1299,7 +1341,7 @@ export interface KEM {
|
|
|
1299
1341
|
*
|
|
1300
1342
|
* @returns A promise resolving to a {@link KeyPair}
|
|
1301
1343
|
*/
|
|
1302
|
-
GenerateKeyPair(extractable: boolean): Promise<KeyPair
|
|
1344
|
+
GenerateKeyPair(extractable: boolean): Promise<KeyPair<K>>;
|
|
1303
1345
|
/**
|
|
1304
1346
|
* Serializes a public key to bytes.
|
|
1305
1347
|
*
|
|
@@ -1307,7 +1349,7 @@ export interface KEM {
|
|
|
1307
1349
|
*
|
|
1308
1350
|
* @returns A promise resolving to the serialized public key
|
|
1309
1351
|
*/
|
|
1310
|
-
SerializePublicKey(key:
|
|
1352
|
+
SerializePublicKey(key: K): Promise<Uint8Array>;
|
|
1311
1353
|
/**
|
|
1312
1354
|
* Deserializes a public key from bytes.
|
|
1313
1355
|
*
|
|
@@ -1315,7 +1357,7 @@ export interface KEM {
|
|
|
1315
1357
|
*
|
|
1316
1358
|
* @returns A promise resolving to a {@link !Key} or a Key interface-conforming object
|
|
1317
1359
|
*/
|
|
1318
|
-
DeserializePublicKey(key: Uint8Array): Promise<
|
|
1360
|
+
DeserializePublicKey(key: Uint8Array): Promise<K>;
|
|
1319
1361
|
/**
|
|
1320
1362
|
* Serializes a private key to bytes.
|
|
1321
1363
|
*
|
|
@@ -1323,7 +1365,7 @@ export interface KEM {
|
|
|
1323
1365
|
*
|
|
1324
1366
|
* @returns A promise resolving to the serialized private key
|
|
1325
1367
|
*/
|
|
1326
|
-
SerializePrivateKey(key:
|
|
1368
|
+
SerializePrivateKey(key: K): Promise<Uint8Array>;
|
|
1327
1369
|
/**
|
|
1328
1370
|
* Deserializes a private key from bytes.
|
|
1329
1371
|
*
|
|
@@ -1332,7 +1374,7 @@ export interface KEM {
|
|
|
1332
1374
|
*
|
|
1333
1375
|
* @returns A promise resolving to a {@link !Key} or a Key interface-conforming object
|
|
1334
1376
|
*/
|
|
1335
|
-
DeserializePrivateKey(key: Uint8Array, extractable: boolean): Promise<
|
|
1377
|
+
DeserializePrivateKey(key: Uint8Array, extractable: boolean): Promise<K>;
|
|
1336
1378
|
/**
|
|
1337
1379
|
* Encapsulates a shared secret to a recipient's public key.
|
|
1338
1380
|
*
|
|
@@ -1344,7 +1386,7 @@ export interface KEM {
|
|
|
1344
1386
|
*
|
|
1345
1387
|
* @returns A promise resolving to an object containing the shared secret and encapsulated secret
|
|
1346
1388
|
*/
|
|
1347
|
-
Encap(pkR:
|
|
1389
|
+
Encap(pkR: K): Promise<{
|
|
1348
1390
|
shared_secret: Uint8Array;
|
|
1349
1391
|
enc: Uint8Array;
|
|
1350
1392
|
}>;
|
|
@@ -1361,7 +1403,7 @@ export interface KEM {
|
|
|
1361
1403
|
*
|
|
1362
1404
|
* @returns A promise resolving to the shared secret
|
|
1363
1405
|
*/
|
|
1364
|
-
Decap(enc: Uint8Array, skR:
|
|
1406
|
+
Decap(enc: Uint8Array, skR: K, pkR: K | undefined): Promise<Uint8Array>;
|
|
1365
1407
|
}
|
|
1366
1408
|
/**
|
|
1367
1409
|
* Authenticated Encryption with Associated Data (AEAD) implementation interface.
|
|
@@ -1416,7 +1458,7 @@ export interface KEM {
|
|
|
1416
1458
|
|
|
1417
1459
|
|
|
1418
1460
|
|
|
1419
|
-
* @see [HPKE AEAD Encryption Algorithm](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1461
|
+
* @see [HPKE AEAD Encryption Algorithm](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-4.3)
|
|
1420
1462
|
*/
|
|
1421
1463
|
export interface AEAD {
|
|
1422
1464
|
/** AEAD algorithm identifier */
|
|
@@ -1434,12 +1476,18 @@ export interface AEAD {
|
|
|
1434
1476
|
/**
|
|
1435
1477
|
* Encrypts and authenticates plaintext with associated data.
|
|
1436
1478
|
*
|
|
1479
|
+
* Implementations must enforce the AEAD algorithm's per-invocation plaintext length limit (P_MAX)
|
|
1480
|
+
* before encryption. HPKE's explicit error list maps `MessageLimitReachedError` to context
|
|
1481
|
+
* sequence number overflow; it does not prescribe a specific error for P_MAX violations. Report
|
|
1482
|
+
* them as ordinary input range errors, such as `RangeError`.
|
|
1483
|
+
*
|
|
1437
1484
|
* @param key - The encryption key of {@link Nk} bytes
|
|
1438
1485
|
* @param nonce - The nonce of {@link Nn} bytes
|
|
1439
1486
|
* @param aad - Additional authenticated data
|
|
1440
1487
|
* @param pt - Plaintext to encrypt
|
|
1441
1488
|
*
|
|
1442
1489
|
* @returns A promise resolving to the ciphertext with authentication tag appended
|
|
1490
|
+
* @see [Context.Seal P_MAX handling](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5.2)
|
|
1443
1491
|
*/
|
|
1444
1492
|
Seal(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, pt: Uint8Array): Promise<Uint8Array>;
|
|
1445
1493
|
/**
|
|
@@ -1477,7 +1525,7 @@ export declare function I2OSP(n: number, w: number): Uint8Array;
|
|
|
1477
1525
|
* This is a factory function that must be passed to the {@link CipherSuite} constructor.
|
|
1478
1526
|
*
|
|
1479
1527
|
* @group AEAD Algorithms
|
|
1480
|
-
* @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1528
|
+
* @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.3)
|
|
1481
1529
|
*/
|
|
1482
1530
|
export declare const AEAD_EXPORT_ONLY: AEADFactory;
|
|
1483
1531
|
/**
|
|
@@ -1497,7 +1545,7 @@ export declare const AEAD_EXPORT_ONLY: AEADFactory;
|
|
|
1497
1545
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1498
1546
|
*
|
|
1499
1547
|
* @group KDF Algorithms
|
|
1500
|
-
* @see [HPKE KDF Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1548
|
+
* @see [HPKE KDF Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.2)
|
|
1501
1549
|
*/
|
|
1502
1550
|
export declare const KDF_HKDF_SHA256: KDFFactory;
|
|
1503
1551
|
/**
|
|
@@ -1517,7 +1565,7 @@ export declare const KDF_HKDF_SHA256: KDFFactory;
|
|
|
1517
1565
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1518
1566
|
*
|
|
1519
1567
|
* @group KDF Algorithms
|
|
1520
|
-
* @see [HPKE KDF Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1568
|
+
* @see [HPKE KDF Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.2)
|
|
1521
1569
|
*/
|
|
1522
1570
|
export declare const KDF_HKDF_SHA384: KDFFactory;
|
|
1523
1571
|
/**
|
|
@@ -1537,7 +1585,7 @@ export declare const KDF_HKDF_SHA384: KDFFactory;
|
|
|
1537
1585
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1538
1586
|
*
|
|
1539
1587
|
* @group KDF Algorithms
|
|
1540
|
-
* @see [HPKE KDF Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1588
|
+
* @see [HPKE KDF Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.2)
|
|
1541
1589
|
*/
|
|
1542
1590
|
export declare const KDF_HKDF_SHA512: KDFFactory;
|
|
1543
1591
|
/**
|
|
@@ -1557,7 +1605,7 @@ export declare const KDF_HKDF_SHA512: KDFFactory;
|
|
|
1557
1605
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1558
1606
|
*
|
|
1559
1607
|
* @group KDF Algorithms
|
|
1560
|
-
* @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-
|
|
1608
|
+
* @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-5)
|
|
1561
1609
|
*/
|
|
1562
1610
|
export declare const KDF_SHAKE128: KDFFactory;
|
|
1563
1611
|
/**
|
|
@@ -1577,7 +1625,7 @@ export declare const KDF_SHAKE128: KDFFactory;
|
|
|
1577
1625
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1578
1626
|
*
|
|
1579
1627
|
* @group KDF Algorithms
|
|
1580
|
-
* @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-
|
|
1628
|
+
* @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-5)
|
|
1581
1629
|
*/
|
|
1582
1630
|
export declare const KDF_SHAKE256: KDFFactory;
|
|
1583
1631
|
/**
|
|
@@ -1597,7 +1645,7 @@ export declare const KDF_SHAKE256: KDFFactory;
|
|
|
1597
1645
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1598
1646
|
*
|
|
1599
1647
|
* @group KDF Algorithms
|
|
1600
|
-
* @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-
|
|
1648
|
+
* @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-5)
|
|
1601
1649
|
*/
|
|
1602
1650
|
export declare const KDF_TurboSHAKE128: KDFFactory;
|
|
1603
1651
|
/**
|
|
@@ -1617,7 +1665,7 @@ export declare const KDF_TurboSHAKE128: KDFFactory;
|
|
|
1617
1665
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1618
1666
|
*
|
|
1619
1667
|
* @group KDF Algorithms
|
|
1620
|
-
* @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-
|
|
1668
|
+
* @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-5)
|
|
1621
1669
|
*/
|
|
1622
1670
|
export declare const KDF_TurboSHAKE256: KDFFactory;
|
|
1623
1671
|
/**
|
|
@@ -1638,9 +1686,9 @@ export declare const KDF_TurboSHAKE256: KDFFactory;
|
|
|
1638
1686
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1639
1687
|
*
|
|
1640
1688
|
* @group KEM Algorithms
|
|
1641
|
-
* @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1689
|
+
* @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.1)
|
|
1642
1690
|
*/
|
|
1643
|
-
export declare const KEM_DHKEM_P256_HKDF_SHA256: KEMFactory
|
|
1691
|
+
export declare const KEM_DHKEM_P256_HKDF_SHA256: KEMFactory<CryptoKey>;
|
|
1644
1692
|
/**
|
|
1645
1693
|
* Diffie-Hellman Key Encapsulation Mechanism using NIST P-384 curve and HKDF-SHA384.
|
|
1646
1694
|
*
|
|
@@ -1659,9 +1707,9 @@ export declare const KEM_DHKEM_P256_HKDF_SHA256: KEMFactory;
|
|
|
1659
1707
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1660
1708
|
*
|
|
1661
1709
|
* @group KEM Algorithms
|
|
1662
|
-
* @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1710
|
+
* @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.1)
|
|
1663
1711
|
*/
|
|
1664
|
-
export declare const KEM_DHKEM_P384_HKDF_SHA384: KEMFactory
|
|
1712
|
+
export declare const KEM_DHKEM_P384_HKDF_SHA384: KEMFactory<CryptoKey>;
|
|
1665
1713
|
/**
|
|
1666
1714
|
* Diffie-Hellman Key Encapsulation Mechanism using NIST P-521 curve and HKDF-SHA512.
|
|
1667
1715
|
*
|
|
@@ -1680,9 +1728,9 @@ export declare const KEM_DHKEM_P384_HKDF_SHA384: KEMFactory;
|
|
|
1680
1728
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1681
1729
|
*
|
|
1682
1730
|
* @group KEM Algorithms
|
|
1683
|
-
* @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1731
|
+
* @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.1)
|
|
1684
1732
|
*/
|
|
1685
|
-
export declare const KEM_DHKEM_P521_HKDF_SHA512: KEMFactory
|
|
1733
|
+
export declare const KEM_DHKEM_P521_HKDF_SHA512: KEMFactory<CryptoKey>;
|
|
1686
1734
|
/**
|
|
1687
1735
|
* Diffie-Hellman Key Encapsulation Mechanism using Curve25519 and HKDF-SHA256.
|
|
1688
1736
|
*
|
|
@@ -1701,9 +1749,9 @@ export declare const KEM_DHKEM_P521_HKDF_SHA512: KEMFactory;
|
|
|
1701
1749
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1702
1750
|
*
|
|
1703
1751
|
* @group KEM Algorithms
|
|
1704
|
-
* @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1752
|
+
* @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.1)
|
|
1705
1753
|
*/
|
|
1706
|
-
export declare const KEM_DHKEM_X25519_HKDF_SHA256: KEMFactory
|
|
1754
|
+
export declare const KEM_DHKEM_X25519_HKDF_SHA256: KEMFactory<CryptoKey>;
|
|
1707
1755
|
/**
|
|
1708
1756
|
* Diffie-Hellman Key Encapsulation Mechanism using Curve448 and HKDF-SHA512.
|
|
1709
1757
|
*
|
|
@@ -1722,9 +1770,9 @@ export declare const KEM_DHKEM_X25519_HKDF_SHA256: KEMFactory;
|
|
|
1722
1770
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1723
1771
|
*
|
|
1724
1772
|
* @group KEM Algorithms
|
|
1725
|
-
* @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1773
|
+
* @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.1)
|
|
1726
1774
|
*/
|
|
1727
|
-
export declare const KEM_DHKEM_X448_HKDF_SHA512: KEMFactory
|
|
1775
|
+
export declare const KEM_DHKEM_X448_HKDF_SHA512: KEMFactory<CryptoKey>;
|
|
1728
1776
|
/**
|
|
1729
1777
|
* Module-Lattice-Based Key Encapsulation Mechanism (ML-KEM-512).
|
|
1730
1778
|
*
|
|
@@ -1746,9 +1794,9 @@ export declare const KEM_DHKEM_X448_HKDF_SHA512: KEMFactory;
|
|
|
1746
1794
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1747
1795
|
*
|
|
1748
1796
|
* @group KEM Algorithms
|
|
1749
|
-
* @see [HPKE-PQ KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-
|
|
1797
|
+
* @see [HPKE-PQ KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-3)
|
|
1750
1798
|
*/
|
|
1751
|
-
export declare const KEM_ML_KEM_512: KEMFactory
|
|
1799
|
+
export declare const KEM_ML_KEM_512: KEMFactory<CryptoKey>;
|
|
1752
1800
|
/**
|
|
1753
1801
|
* Module-Lattice-Based Key Encapsulation Mechanism (ML-KEM-768).
|
|
1754
1802
|
*
|
|
@@ -1766,9 +1814,9 @@ export declare const KEM_ML_KEM_512: KEMFactory;
|
|
|
1766
1814
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1767
1815
|
*
|
|
1768
1816
|
* @group KEM Algorithms
|
|
1769
|
-
* @see [HPKE-PQ KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-
|
|
1817
|
+
* @see [HPKE-PQ KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-3)
|
|
1770
1818
|
*/
|
|
1771
|
-
export declare const KEM_ML_KEM_768: KEMFactory
|
|
1819
|
+
export declare const KEM_ML_KEM_768: KEMFactory<CryptoKey>;
|
|
1772
1820
|
/**
|
|
1773
1821
|
* Module-Lattice-Based Key Encapsulation Mechanism (ML-KEM-1024).
|
|
1774
1822
|
*
|
|
@@ -1786,9 +1834,9 @@ export declare const KEM_ML_KEM_768: KEMFactory;
|
|
|
1786
1834
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1787
1835
|
*
|
|
1788
1836
|
* @group KEM Algorithms
|
|
1789
|
-
* @see [HPKE-PQ KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-
|
|
1837
|
+
* @see [HPKE-PQ KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-3)
|
|
1790
1838
|
*/
|
|
1791
|
-
export declare const KEM_ML_KEM_1024: KEMFactory
|
|
1839
|
+
export declare const KEM_ML_KEM_1024: KEMFactory<CryptoKey>;
|
|
1792
1840
|
/**
|
|
1793
1841
|
* AES-128-GCM Authenticated Encryption with Associated Data (AEAD).
|
|
1794
1842
|
*
|
|
@@ -1805,7 +1853,7 @@ export declare const KEM_ML_KEM_1024: KEMFactory;
|
|
|
1805
1853
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1806
1854
|
*
|
|
1807
1855
|
* @group AEAD Algorithms
|
|
1808
|
-
* @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1856
|
+
* @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.3)
|
|
1809
1857
|
*/
|
|
1810
1858
|
export declare const AEAD_AES_128_GCM: AEADFactory;
|
|
1811
1859
|
/**
|
|
@@ -1824,7 +1872,7 @@ export declare const AEAD_AES_128_GCM: AEADFactory;
|
|
|
1824
1872
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1825
1873
|
*
|
|
1826
1874
|
* @group AEAD Algorithms
|
|
1827
|
-
* @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1875
|
+
* @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.3)
|
|
1828
1876
|
*/
|
|
1829
1877
|
export declare const AEAD_AES_256_GCM: AEADFactory;
|
|
1830
1878
|
/**
|
|
@@ -1843,7 +1891,7 @@ export declare const AEAD_AES_256_GCM: AEADFactory;
|
|
|
1843
1891
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1844
1892
|
*
|
|
1845
1893
|
* @group AEAD Algorithms
|
|
1846
|
-
* @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1894
|
+
* @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.3)
|
|
1847
1895
|
*/
|
|
1848
1896
|
export declare const AEAD_ChaCha20Poly1305: AEADFactory;
|
|
1849
1897
|
/**
|
|
@@ -1863,7 +1911,7 @@ export declare const AEAD_ChaCha20Poly1305: AEADFactory;
|
|
|
1863
1911
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1864
1912
|
*
|
|
1865
1913
|
* @group KEM Algorithms
|
|
1866
|
-
* @see [HPKE-PQ Hybrid KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-
|
|
1914
|
+
* @see [HPKE-PQ Hybrid KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-4)
|
|
1867
1915
|
*/
|
|
1868
1916
|
export declare const KEM_MLKEM768_X25519: KEMFactory;
|
|
1869
1917
|
/**
|
|
@@ -1883,7 +1931,7 @@ export declare const KEM_MLKEM768_X25519: KEMFactory;
|
|
|
1883
1931
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1884
1932
|
*
|
|
1885
1933
|
* @group KEM Algorithms
|
|
1886
|
-
* @see [HPKE-PQ Hybrid KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-
|
|
1934
|
+
* @see [HPKE-PQ Hybrid KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-4)
|
|
1887
1935
|
*/
|
|
1888
1936
|
export declare const KEM_MLKEM768_P256: KEMFactory;
|
|
1889
1937
|
/**
|
|
@@ -1903,6 +1951,6 @@ export declare const KEM_MLKEM768_P256: KEMFactory;
|
|
|
1903
1951
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1904
1952
|
*
|
|
1905
1953
|
* @group KEM Algorithms
|
|
1906
|
-
* @see [HPKE-PQ Hybrid KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-
|
|
1954
|
+
* @see [HPKE-PQ Hybrid KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-4)
|
|
1907
1955
|
*/
|
|
1908
1956
|
export declare const KEM_MLKEM1024_P384: KEMFactory;
|