hpke 1.1.3 → 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 +2 -2
- package/index.d.ts +139 -99
- package/index.d.ts.map +1 -1
- package/index.js +81 -35
- package/index.ts +178 -132
- package/package.json +16 -11
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,13 +58,13 @@
|
|
|
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
|
|
@@ -96,7 +96,7 @@ declare class SenderContext {
|
|
|
96
96
|
*
|
|
97
97
|
* @returns A Promise that resolves to the ciphertext. The ciphertext is {@link Nt} bytes longer
|
|
98
98
|
* than the plaintext.
|
|
99
|
-
* @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)
|
|
100
100
|
*/
|
|
101
101
|
Seal(plaintext: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
|
|
102
102
|
/**
|
|
@@ -120,7 +120,7 @@ declare class SenderContext {
|
|
|
120
120
|
* @param length - Desired length of exported secret in bytes
|
|
121
121
|
*
|
|
122
122
|
* @returns A Promise that resolves to the exported secret.
|
|
123
|
-
* @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)
|
|
124
124
|
*/
|
|
125
125
|
Export(exporterContext: Uint8Array, length: number): Promise<Uint8Array>;
|
|
126
126
|
/**
|
|
@@ -151,13 +151,13 @@ export type { SenderContext };
|
|
|
151
151
|
*/
|
|
152
152
|
declare class RecipientContext {
|
|
153
153
|
#private;
|
|
154
|
-
constructor(suite: Triple, mode:
|
|
154
|
+
constructor(suite: Triple, mode: Mode, key: Uint8Array, base_nonce: Uint8Array, exporter_secret: Uint8Array);
|
|
155
155
|
/**
|
|
156
156
|
* @returns The mode (0x00 = Base, 0x01 = PSK) for this context.
|
|
157
157
|
* @see {@link MODE_BASE}
|
|
158
158
|
* @see {@link MODE_PSK}
|
|
159
159
|
*/
|
|
160
|
-
get mode():
|
|
160
|
+
get mode(): Mode;
|
|
161
161
|
/**
|
|
162
162
|
* @returns The sequence number for this context's next {@link Open}, initially zero, increments
|
|
163
163
|
* automatically with each successful {@link Open}. The sequence number provides AEAD nonce
|
|
@@ -190,7 +190,7 @@ declare class RecipientContext {
|
|
|
190
190
|
* @param aad - Additional authenticated data
|
|
191
191
|
*
|
|
192
192
|
* @returns A Promise that resolves to the decrypted plaintext.
|
|
193
|
-
* @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)
|
|
194
194
|
*/
|
|
195
195
|
Open(ciphertext: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
|
|
196
196
|
/**
|
|
@@ -214,7 +214,7 @@ declare class RecipientContext {
|
|
|
214
214
|
* @param length - Desired length of exported secret in bytes
|
|
215
215
|
*
|
|
216
216
|
* @returns A Promise that resolves to the exported secret.
|
|
217
|
-
* @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)
|
|
218
218
|
*/
|
|
219
219
|
Export(exporterContext: Uint8Array, length: number): Promise<Uint8Array>;
|
|
220
220
|
}
|
|
@@ -226,7 +226,7 @@ export type { RecipientContext };
|
|
|
226
226
|
* asymmetric key exchange with a symmetric cipher. This was originally defined in an Informational
|
|
227
227
|
* document on the IRTF stream as [RFC 9180](https://www.rfc-editor.org/rfc/rfc9180.html) and is now
|
|
228
228
|
* being republished as a Standards Track document of the IETF as
|
|
229
|
-
* [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).
|
|
230
230
|
*
|
|
231
231
|
* HPKE provides a variant of public key encryption for arbitrary-sized plaintexts using a recipient
|
|
232
232
|
* public key. It supports two modes:
|
|
@@ -240,9 +240,10 @@ export type { RecipientContext };
|
|
|
240
240
|
* - KDF: Key Derivation Function for deriving symmetric keys
|
|
241
241
|
* - AEAD: Authenticated Encryption with Additional Data for encryption
|
|
242
242
|
*
|
|
243
|
+
* @typeParam K - Key representation produced and consumed by the suite's KEM
|
|
243
244
|
* @group Core
|
|
244
245
|
*/
|
|
245
|
-
export declare class CipherSuite {
|
|
246
|
+
export declare class CipherSuite<K extends Key = Key> {
|
|
246
247
|
#private;
|
|
247
248
|
/**
|
|
248
249
|
* Creates a new HPKE cipher suite by combining a Key Encapsulation Mechanism (KEM), Key
|
|
@@ -305,7 +306,7 @@ export declare class CipherSuite {
|
|
|
305
306
|
* @see {@link KDFFactory Available KDFs}
|
|
306
307
|
* @see {@link AEADFactory Available AEADs}
|
|
307
308
|
*/
|
|
308
|
-
constructor(KEM: KEMFactory
|
|
309
|
+
constructor(KEM: KEMFactory<K>, KDF: KDFFactory, AEAD: AEADFactory);
|
|
309
310
|
/**
|
|
310
311
|
* Provides read-only access to this suite's KEM identifier, name, and other attributes.
|
|
311
312
|
*
|
|
@@ -313,17 +314,17 @@ export declare class CipherSuite {
|
|
|
313
314
|
*/
|
|
314
315
|
get KEM(): {
|
|
315
316
|
/** The identifier of this suite's KEM */
|
|
316
|
-
id: number;
|
|
317
|
+
readonly id: number;
|
|
317
318
|
/** The name of this suite's KEM */
|
|
318
|
-
name: string;
|
|
319
|
+
readonly name: string;
|
|
319
320
|
/** The length in bytes of this suite's KEM produced shared secret */
|
|
320
|
-
Nsecret: number;
|
|
321
|
+
readonly Nsecret: number;
|
|
321
322
|
/** The length in bytes of this suite's KEM produced encapsulated secret */
|
|
322
|
-
Nenc: number;
|
|
323
|
+
readonly Nenc: number;
|
|
323
324
|
/** The length in bytes of this suite's KEM public key */
|
|
324
|
-
Npk: number;
|
|
325
|
+
readonly Npk: number;
|
|
325
326
|
/** The length in bytes of this suite's KEM private key */
|
|
326
|
-
Nsk: number;
|
|
327
|
+
readonly Nsk: number;
|
|
327
328
|
};
|
|
328
329
|
/**
|
|
329
330
|
* Provides read-only access to this suite's KDF identifier, name, and other attributes.
|
|
@@ -332,21 +333,21 @@ export declare class CipherSuite {
|
|
|
332
333
|
*/
|
|
333
334
|
get KDF(): {
|
|
334
335
|
/** The identifier of this suite's KDF */
|
|
335
|
-
id: number;
|
|
336
|
+
readonly id: number;
|
|
336
337
|
/** The name of this suite's KDF */
|
|
337
|
-
name: string;
|
|
338
|
+
readonly name: string;
|
|
338
339
|
/**
|
|
339
340
|
* When 1, this suite's KDF is a one-stage (Derive) KDF.
|
|
340
341
|
*
|
|
341
342
|
* When 2, this suite's KDF is a two-stage (Extract and Expand) KDF.
|
|
342
343
|
*/
|
|
343
|
-
stages: 1 | 2;
|
|
344
|
+
readonly stages: 1 | 2;
|
|
344
345
|
/**
|
|
345
346
|
* For one-stage KDF: The security strength of this suite's KDF, in bytes.
|
|
346
347
|
*
|
|
347
348
|
* For two-stage KDF: The output size of this suite's KDF Extract() function in bytes.
|
|
348
349
|
*/
|
|
349
|
-
Nh: number;
|
|
350
|
+
readonly Nh: number;
|
|
350
351
|
};
|
|
351
352
|
/**
|
|
352
353
|
* Provides read-only access to this suite's AEAD identifier, name, and other attributes.
|
|
@@ -356,15 +357,15 @@ export declare class CipherSuite {
|
|
|
356
357
|
*/
|
|
357
358
|
get AEAD(): {
|
|
358
359
|
/** The identifier of this suite's AEAD */
|
|
359
|
-
id: number;
|
|
360
|
+
readonly id: number;
|
|
360
361
|
/** The name of this suite's AEAD */
|
|
361
|
-
name: string;
|
|
362
|
+
readonly name: string;
|
|
362
363
|
/** The length in bytes of a key for this suite's AEAD */
|
|
363
|
-
Nk: number;
|
|
364
|
+
readonly Nk: number;
|
|
364
365
|
/** The length in bytes of a nonce for this suite's AEAD */
|
|
365
|
-
Nn: number;
|
|
366
|
+
readonly Nn: number;
|
|
366
367
|
/** The length in bytes of an authentication tag for this suite's AEAD */
|
|
367
|
-
Nt: number;
|
|
368
|
+
readonly Nt: number;
|
|
368
369
|
};
|
|
369
370
|
/**
|
|
370
371
|
* Generates a random key pair for this CipherSuite. By default, private keys are generated as
|
|
@@ -383,7 +384,7 @@ export declare class CipherSuite {
|
|
|
383
384
|
*
|
|
384
385
|
* @returns A Promise that resolves to a generated key pair.
|
|
385
386
|
*/
|
|
386
|
-
GenerateKeyPair(extractable?: boolean): Promise<KeyPair
|
|
387
|
+
GenerateKeyPair(extractable?: boolean): Promise<KeyPair<K>>;
|
|
387
388
|
/**
|
|
388
389
|
* Deterministically derives a key pair for this CipherSuite's KEM from input keying material. By
|
|
389
390
|
* default, private keys are derived as non-extractable (their value cannot be exported).
|
|
@@ -411,7 +412,7 @@ export declare class CipherSuite {
|
|
|
411
412
|
*
|
|
412
413
|
* @returns A Promise that resolves to the derived key pair.
|
|
413
414
|
*/
|
|
414
|
-
DeriveKeyPair(ikm: Uint8Array, extractable?: boolean): Promise<KeyPair
|
|
415
|
+
DeriveKeyPair(ikm: Uint8Array, extractable?: boolean): Promise<KeyPair<K>>;
|
|
415
416
|
/**
|
|
416
417
|
* Serializes an extractable private key to bytes.
|
|
417
418
|
*
|
|
@@ -428,7 +429,7 @@ export declare class CipherSuite {
|
|
|
428
429
|
*
|
|
429
430
|
* @returns A Promise that resolves to the serialized private key.
|
|
430
431
|
*/
|
|
431
|
-
SerializePrivateKey(privateKey:
|
|
432
|
+
SerializePrivateKey(privateKey: K): Promise<Uint8Array>;
|
|
432
433
|
/**
|
|
433
434
|
* Serializes a public key to bytes.
|
|
434
435
|
*
|
|
@@ -445,7 +446,7 @@ export declare class CipherSuite {
|
|
|
445
446
|
*
|
|
446
447
|
* @returns A Promise that resolves to the serialized public key.
|
|
447
448
|
*/
|
|
448
|
-
SerializePublicKey(publicKey:
|
|
449
|
+
SerializePublicKey(publicKey: K): Promise<Uint8Array>;
|
|
449
450
|
/**
|
|
450
451
|
* Deserializes a private key from bytes. By default, private keys are deserialized as
|
|
451
452
|
* non-extractable (their value cannot be exported).
|
|
@@ -465,7 +466,7 @@ export declare class CipherSuite {
|
|
|
465
466
|
*
|
|
466
467
|
* @returns A Promise that resolves to the deserialized private key.
|
|
467
468
|
*/
|
|
468
|
-
DeserializePrivateKey(privateKey: Uint8Array, extractable?: boolean): Promise<
|
|
469
|
+
DeserializePrivateKey(privateKey: Uint8Array, extractable?: boolean): Promise<K>;
|
|
469
470
|
/**
|
|
470
471
|
* Deserializes a public key from bytes. Public keys are always deserialized as extractable (their
|
|
471
472
|
* value can be exported, e.g. by {@link SerializePublicKey}).
|
|
@@ -483,7 +484,7 @@ export declare class CipherSuite {
|
|
|
483
484
|
*
|
|
484
485
|
* @returns A Promise that resolves to the deserialized public key.
|
|
485
486
|
*/
|
|
486
|
-
DeserializePublicKey(publicKey: Uint8Array): Promise<
|
|
487
|
+
DeserializePublicKey(publicKey: Uint8Array): Promise<K>;
|
|
487
488
|
/**
|
|
488
489
|
* Single-shot API for encrypting a single message. It combines context setup and encryption in
|
|
489
490
|
* one call.
|
|
@@ -516,9 +517,9 @@ export declare class CipherSuite {
|
|
|
516
517
|
* @returns A Promise that resolves to an object containing the encapsulated secret and
|
|
517
518
|
* ciphertext. The ciphertext is {@link CipherSuite.AEAD Nt} bytes longer than the plaintext. The
|
|
518
519
|
* encapsulated secret is {@link CipherSuite.KEM Nenc} bytes.
|
|
519
|
-
* @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)
|
|
520
521
|
*/
|
|
521
|
-
Seal(publicKey:
|
|
522
|
+
Seal(publicKey: K, plaintext: Uint8Array, options?: {
|
|
522
523
|
aad?: Uint8Array;
|
|
523
524
|
info?: Uint8Array;
|
|
524
525
|
psk?: Uint8Array;
|
|
@@ -561,9 +562,9 @@ export declare class CipherSuite {
|
|
|
561
562
|
* @param options.pskId - Pre-shared key identifier (for PSK mode)
|
|
562
563
|
*
|
|
563
564
|
* @returns A Promise that resolves to the decrypted plaintext.
|
|
564
|
-
* @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)
|
|
565
566
|
*/
|
|
566
|
-
Open(privateKey:
|
|
567
|
+
Open(privateKey: K | KeyPair<K>, encapsulatedSecret: Uint8Array, ciphertext: Uint8Array, options?: {
|
|
567
568
|
aad?: Uint8Array;
|
|
568
569
|
info?: Uint8Array;
|
|
569
570
|
psk?: Uint8Array;
|
|
@@ -602,9 +603,9 @@ export declare class CipherSuite {
|
|
|
602
603
|
*
|
|
603
604
|
* @returns A Promise that resolves to an object containing the encapsulated secret and the
|
|
604
605
|
* exported secret.
|
|
605
|
-
* @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)
|
|
606
607
|
*/
|
|
607
|
-
SendExport(publicKey:
|
|
608
|
+
SendExport(publicKey: K, exporterContext: Uint8Array, length: number, options?: {
|
|
608
609
|
info?: Uint8Array;
|
|
609
610
|
psk?: Uint8Array;
|
|
610
611
|
pskId?: Uint8Array;
|
|
@@ -647,9 +648,9 @@ export declare class CipherSuite {
|
|
|
647
648
|
* @param options.pskId - Pre-shared key identifier (for PSK mode)
|
|
648
649
|
*
|
|
649
650
|
* @returns A Promise that resolves to the exported secret.
|
|
650
|
-
* @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)
|
|
651
652
|
*/
|
|
652
|
-
ReceiveExport(privateKey:
|
|
653
|
+
ReceiveExport(privateKey: K | KeyPair<K>, encapsulatedSecret: Uint8Array, exporterContext: Uint8Array, length: number, options?: {
|
|
653
654
|
info?: Uint8Array;
|
|
654
655
|
psk?: Uint8Array;
|
|
655
656
|
pskId?: Uint8Array;
|
|
@@ -695,9 +696,9 @@ export declare class CipherSuite {
|
|
|
695
696
|
*
|
|
696
697
|
* @returns A Promise that resolves to an object containing the encapsulated secret and the sender
|
|
697
698
|
* context (`ctx`). The encapsulated secret is {@link CipherSuite.KEM Nenc} bytes.
|
|
698
|
-
* @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)
|
|
699
700
|
*/
|
|
700
|
-
SetupSender(publicKey:
|
|
701
|
+
SetupSender(publicKey: K, options?: {
|
|
701
702
|
info?: Uint8Array;
|
|
702
703
|
psk?: Uint8Array;
|
|
703
704
|
pskId?: Uint8Array;
|
|
@@ -751,9 +752,9 @@ export declare class CipherSuite {
|
|
|
751
752
|
* @param options.pskId - Pre-shared key identifier (for PSK mode)
|
|
752
753
|
*
|
|
753
754
|
* @returns A Promise that resolves to the recipient context.
|
|
754
|
-
* @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)
|
|
755
756
|
*/
|
|
756
|
-
SetupRecipient(privateKey:
|
|
757
|
+
SetupRecipient(privateKey: K | KeyPair<K>, encapsulatedSecret: Uint8Array, options?: {
|
|
757
758
|
info?: Uint8Array;
|
|
758
759
|
psk?: Uint8Array;
|
|
759
760
|
pskId?: Uint8Array;
|
|
@@ -847,9 +848,9 @@ export declare class NotSupportedError extends Error {
|
|
|
847
848
|
cause?: unknown;
|
|
848
849
|
});
|
|
849
850
|
}
|
|
850
|
-
interface Triple {
|
|
851
|
+
interface Triple<K extends Key = Key> {
|
|
851
852
|
readonly id: Uint8Array;
|
|
852
|
-
readonly KEM: Readonly<KEM
|
|
853
|
+
readonly KEM: Readonly<KEM<K>>;
|
|
853
854
|
readonly KDF: Readonly<KDF>;
|
|
854
855
|
readonly AEAD: Readonly<AEAD>;
|
|
855
856
|
}
|
|
@@ -859,7 +860,7 @@ interface Triple {
|
|
|
859
860
|
* Base mode provides encryption to a public key without sender authentication. The recipient cannot
|
|
860
861
|
* verify who encrypted the message, only that someone with access to their public key did.
|
|
861
862
|
*
|
|
862
|
-
* @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)
|
|
863
864
|
*/
|
|
864
865
|
export declare const MODE_BASE = 0;
|
|
865
866
|
/**
|
|
@@ -869,9 +870,11 @@ export declare const MODE_BASE = 0;
|
|
|
869
870
|
* sender and recipient must possess the same PSK and PSK ID. This provides implicit sender
|
|
870
871
|
* authentication.
|
|
871
872
|
*
|
|
872
|
-
* @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)
|
|
873
874
|
*/
|
|
874
875
|
export declare const MODE_PSK = 1;
|
|
876
|
+
/** Mode supported by this implementation. */
|
|
877
|
+
export type Mode = typeof MODE_BASE | typeof MODE_PSK;
|
|
875
878
|
/**
|
|
876
879
|
* Factory function that returns a KEM implementation.
|
|
877
880
|
*
|
|
@@ -903,8 +906,10 @@ export declare const MODE_PSK = 1;
|
|
|
903
906
|
* > returning an object conforming to the {@link KEM} interface can be used. Such implementations not
|
|
904
907
|
* > reliant on Web Cryptography are exported by
|
|
905
908
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
909
|
+
*
|
|
910
|
+
* @typeParam K - Key representation produced and consumed by the KEM
|
|
906
911
|
*/
|
|
907
|
-
export type KEMFactory = () => Readonly<KEM
|
|
912
|
+
export type KEMFactory<K extends Key = Key> = () => Readonly<KEM<K>>;
|
|
908
913
|
/**
|
|
909
914
|
* Factory function that returns a KDF implementation.
|
|
910
915
|
*
|
|
@@ -958,12 +963,14 @@ export type AEADFactory = () => Readonly<AEAD>;
|
|
|
958
963
|
* - Private Key: Used by recipients for decryption operations (passed to
|
|
959
964
|
* {@link CipherSuite.SetupRecipient} or {@link CipherSuite.Open}). These are not distributed and
|
|
960
965
|
* kept private.
|
|
966
|
+
*
|
|
967
|
+
* @typeParam K - Key representation contained in the pair
|
|
961
968
|
*/
|
|
962
|
-
export interface KeyPair {
|
|
969
|
+
export interface KeyPair<K extends Key = Key> {
|
|
963
970
|
/** The public key, used for encryption operations. */
|
|
964
|
-
readonly publicKey: Readonly<
|
|
971
|
+
readonly publicKey: Readonly<K>;
|
|
965
972
|
/** The private key, used for decryption operations. */
|
|
966
|
-
readonly privateKey: Readonly<
|
|
973
|
+
readonly privateKey: Readonly<K>;
|
|
967
974
|
}
|
|
968
975
|
/**
|
|
969
976
|
* A minimal key representation interface.
|
|
@@ -986,6 +993,38 @@ export interface Key {
|
|
|
986
993
|
/** The type of key: 'private' or 'public' */
|
|
987
994
|
readonly type: 'private' | 'public' | (string & {});
|
|
988
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
|
+
}
|
|
989
1028
|
/**
|
|
990
1029
|
* Concatenates multiple Uint8Array buffers into a single Uint8Array. It's exported for use in
|
|
991
1030
|
* custom KEM, KDF, or AEAD implementations.
|
|
@@ -1025,7 +1064,7 @@ export declare function encode(string: string): Uint8Array;
|
|
|
1025
1064
|
* ensures domain separation between different uses of the KDF in HPKE.
|
|
1026
1065
|
*
|
|
1027
1066
|
* @group Utilities
|
|
1028
|
-
* @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)
|
|
1029
1068
|
*/
|
|
1030
1069
|
export declare function LabeledDerive(KDF: Pick<KDF, 'Derive'>, suite_id: Uint8Array, ikm: Uint8Array, label: Uint8Array, context: Uint8Array, L: number): Promise<Uint8Array>;
|
|
1031
1070
|
/**
|
|
@@ -1093,7 +1132,7 @@ export declare function LabeledDerive(KDF: Pick<KDF, 'Derive'>, suite_id: Uint8A
|
|
|
1093
1132
|
|
|
1094
1133
|
|
|
1095
1134
|
|
|
1096
|
-
* @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)
|
|
1097
1136
|
*/
|
|
1098
1137
|
export interface KDF {
|
|
1099
1138
|
/** KDF algorithm identifier */
|
|
@@ -1154,7 +1193,7 @@ export interface KDF {
|
|
|
1154
1193
|
* pseudorandom key. This ensures domain separation between different uses of the KDF in HPKE.
|
|
1155
1194
|
*
|
|
1156
1195
|
* @group Utilities
|
|
1157
|
-
* @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)
|
|
1158
1197
|
*/
|
|
1159
1198
|
export declare function LabeledExtract(KDF: Pick<KDF, 'Extract'>, suite_id: Uint8Array, salt: Uint8Array, label: Uint8Array, ikm: Uint8Array): Promise<Uint8Array>;
|
|
1160
1199
|
/**
|
|
@@ -1174,7 +1213,7 @@ export declare function LabeledExtract(KDF: Pick<KDF, 'Extract'>, suite_id: Uint
|
|
|
1174
1213
|
* of the KDF in HPKE.
|
|
1175
1214
|
*
|
|
1176
1215
|
* @group Utilities
|
|
1177
|
-
* @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)
|
|
1178
1217
|
*/
|
|
1179
1218
|
export declare function LabeledExpand(KDF: Pick<KDF, 'Expand'>, suite_id: Uint8Array, prk: Uint8Array, label: Uint8Array, info: Uint8Array, L: number): Promise<Uint8Array>;
|
|
1180
1219
|
/**
|
|
@@ -1268,9 +1307,10 @@ export declare function LabeledExpand(KDF: Pick<KDF, 'Expand'>, suite_id: Uint8A
|
|
|
1268
1307
|
|
|
1269
1308
|
|
|
1270
1309
|
|
|
1271
|
-
* @
|
|
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)
|
|
1272
1312
|
*/
|
|
1273
|
-
export interface KEM {
|
|
1313
|
+
export interface KEM<K extends Key = Key> {
|
|
1274
1314
|
/** KEM algorithm identifier */
|
|
1275
1315
|
readonly id: number;
|
|
1276
1316
|
/** Type discriminator, always 'KEM' */
|
|
@@ -1293,7 +1333,7 @@ export interface KEM {
|
|
|
1293
1333
|
*
|
|
1294
1334
|
* @returns A promise resolving to a {@link KeyPair}
|
|
1295
1335
|
*/
|
|
1296
|
-
DeriveKeyPair(ikm: Uint8Array, extractable: boolean): Promise<KeyPair
|
|
1336
|
+
DeriveKeyPair(ikm: Uint8Array, extractable: boolean): Promise<KeyPair<K>>;
|
|
1297
1337
|
/**
|
|
1298
1338
|
* Generates a random key pair.
|
|
1299
1339
|
*
|
|
@@ -1301,7 +1341,7 @@ export interface KEM {
|
|
|
1301
1341
|
*
|
|
1302
1342
|
* @returns A promise resolving to a {@link KeyPair}
|
|
1303
1343
|
*/
|
|
1304
|
-
GenerateKeyPair(extractable: boolean): Promise<KeyPair
|
|
1344
|
+
GenerateKeyPair(extractable: boolean): Promise<KeyPair<K>>;
|
|
1305
1345
|
/**
|
|
1306
1346
|
* Serializes a public key to bytes.
|
|
1307
1347
|
*
|
|
@@ -1309,7 +1349,7 @@ export interface KEM {
|
|
|
1309
1349
|
*
|
|
1310
1350
|
* @returns A promise resolving to the serialized public key
|
|
1311
1351
|
*/
|
|
1312
|
-
SerializePublicKey(key:
|
|
1352
|
+
SerializePublicKey(key: K): Promise<Uint8Array>;
|
|
1313
1353
|
/**
|
|
1314
1354
|
* Deserializes a public key from bytes.
|
|
1315
1355
|
*
|
|
@@ -1317,7 +1357,7 @@ export interface KEM {
|
|
|
1317
1357
|
*
|
|
1318
1358
|
* @returns A promise resolving to a {@link !Key} or a Key interface-conforming object
|
|
1319
1359
|
*/
|
|
1320
|
-
DeserializePublicKey(key: Uint8Array): Promise<
|
|
1360
|
+
DeserializePublicKey(key: Uint8Array): Promise<K>;
|
|
1321
1361
|
/**
|
|
1322
1362
|
* Serializes a private key to bytes.
|
|
1323
1363
|
*
|
|
@@ -1325,7 +1365,7 @@ export interface KEM {
|
|
|
1325
1365
|
*
|
|
1326
1366
|
* @returns A promise resolving to the serialized private key
|
|
1327
1367
|
*/
|
|
1328
|
-
SerializePrivateKey(key:
|
|
1368
|
+
SerializePrivateKey(key: K): Promise<Uint8Array>;
|
|
1329
1369
|
/**
|
|
1330
1370
|
* Deserializes a private key from bytes.
|
|
1331
1371
|
*
|
|
@@ -1334,7 +1374,7 @@ export interface KEM {
|
|
|
1334
1374
|
*
|
|
1335
1375
|
* @returns A promise resolving to a {@link !Key} or a Key interface-conforming object
|
|
1336
1376
|
*/
|
|
1337
|
-
DeserializePrivateKey(key: Uint8Array, extractable: boolean): Promise<
|
|
1377
|
+
DeserializePrivateKey(key: Uint8Array, extractable: boolean): Promise<K>;
|
|
1338
1378
|
/**
|
|
1339
1379
|
* Encapsulates a shared secret to a recipient's public key.
|
|
1340
1380
|
*
|
|
@@ -1346,7 +1386,7 @@ export interface KEM {
|
|
|
1346
1386
|
*
|
|
1347
1387
|
* @returns A promise resolving to an object containing the shared secret and encapsulated secret
|
|
1348
1388
|
*/
|
|
1349
|
-
Encap(pkR:
|
|
1389
|
+
Encap(pkR: K): Promise<{
|
|
1350
1390
|
shared_secret: Uint8Array;
|
|
1351
1391
|
enc: Uint8Array;
|
|
1352
1392
|
}>;
|
|
@@ -1363,7 +1403,7 @@ export interface KEM {
|
|
|
1363
1403
|
*
|
|
1364
1404
|
* @returns A promise resolving to the shared secret
|
|
1365
1405
|
*/
|
|
1366
|
-
Decap(enc: Uint8Array, skR:
|
|
1406
|
+
Decap(enc: Uint8Array, skR: K, pkR: K | undefined): Promise<Uint8Array>;
|
|
1367
1407
|
}
|
|
1368
1408
|
/**
|
|
1369
1409
|
* Authenticated Encryption with Associated Data (AEAD) implementation interface.
|
|
@@ -1418,7 +1458,7 @@ export interface KEM {
|
|
|
1418
1458
|
|
|
1419
1459
|
|
|
1420
1460
|
|
|
1421
|
-
* @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)
|
|
1422
1462
|
*/
|
|
1423
1463
|
export interface AEAD {
|
|
1424
1464
|
/** AEAD algorithm identifier */
|
|
@@ -1447,7 +1487,7 @@ export interface AEAD {
|
|
|
1447
1487
|
* @param pt - Plaintext to encrypt
|
|
1448
1488
|
*
|
|
1449
1489
|
* @returns A promise resolving to the ciphertext with authentication tag appended
|
|
1450
|
-
* @see [Context.Seal P_MAX handling](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-
|
|
1490
|
+
* @see [Context.Seal P_MAX handling](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5.2)
|
|
1451
1491
|
*/
|
|
1452
1492
|
Seal(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, pt: Uint8Array): Promise<Uint8Array>;
|
|
1453
1493
|
/**
|
|
@@ -1485,7 +1525,7 @@ export declare function I2OSP(n: number, w: number): Uint8Array;
|
|
|
1485
1525
|
* This is a factory function that must be passed to the {@link CipherSuite} constructor.
|
|
1486
1526
|
*
|
|
1487
1527
|
* @group AEAD Algorithms
|
|
1488
|
-
* @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)
|
|
1489
1529
|
*/
|
|
1490
1530
|
export declare const AEAD_EXPORT_ONLY: AEADFactory;
|
|
1491
1531
|
/**
|
|
@@ -1505,7 +1545,7 @@ export declare const AEAD_EXPORT_ONLY: AEADFactory;
|
|
|
1505
1545
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1506
1546
|
*
|
|
1507
1547
|
* @group KDF Algorithms
|
|
1508
|
-
* @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)
|
|
1509
1549
|
*/
|
|
1510
1550
|
export declare const KDF_HKDF_SHA256: KDFFactory;
|
|
1511
1551
|
/**
|
|
@@ -1525,7 +1565,7 @@ export declare const KDF_HKDF_SHA256: KDFFactory;
|
|
|
1525
1565
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1526
1566
|
*
|
|
1527
1567
|
* @group KDF Algorithms
|
|
1528
|
-
* @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)
|
|
1529
1569
|
*/
|
|
1530
1570
|
export declare const KDF_HKDF_SHA384: KDFFactory;
|
|
1531
1571
|
/**
|
|
@@ -1545,7 +1585,7 @@ export declare const KDF_HKDF_SHA384: KDFFactory;
|
|
|
1545
1585
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1546
1586
|
*
|
|
1547
1587
|
* @group KDF Algorithms
|
|
1548
|
-
* @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)
|
|
1549
1589
|
*/
|
|
1550
1590
|
export declare const KDF_HKDF_SHA512: KDFFactory;
|
|
1551
1591
|
/**
|
|
@@ -1565,7 +1605,7 @@ export declare const KDF_HKDF_SHA512: KDFFactory;
|
|
|
1565
1605
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1566
1606
|
*
|
|
1567
1607
|
* @group KDF Algorithms
|
|
1568
|
-
* @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)
|
|
1569
1609
|
*/
|
|
1570
1610
|
export declare const KDF_SHAKE128: KDFFactory;
|
|
1571
1611
|
/**
|
|
@@ -1585,7 +1625,7 @@ export declare const KDF_SHAKE128: KDFFactory;
|
|
|
1585
1625
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1586
1626
|
*
|
|
1587
1627
|
* @group KDF Algorithms
|
|
1588
|
-
* @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)
|
|
1589
1629
|
*/
|
|
1590
1630
|
export declare const KDF_SHAKE256: KDFFactory;
|
|
1591
1631
|
/**
|
|
@@ -1605,7 +1645,7 @@ export declare const KDF_SHAKE256: KDFFactory;
|
|
|
1605
1645
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1606
1646
|
*
|
|
1607
1647
|
* @group KDF Algorithms
|
|
1608
|
-
* @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)
|
|
1609
1649
|
*/
|
|
1610
1650
|
export declare const KDF_TurboSHAKE128: KDFFactory;
|
|
1611
1651
|
/**
|
|
@@ -1625,7 +1665,7 @@ export declare const KDF_TurboSHAKE128: KDFFactory;
|
|
|
1625
1665
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1626
1666
|
*
|
|
1627
1667
|
* @group KDF Algorithms
|
|
1628
|
-
* @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)
|
|
1629
1669
|
*/
|
|
1630
1670
|
export declare const KDF_TurboSHAKE256: KDFFactory;
|
|
1631
1671
|
/**
|
|
@@ -1646,9 +1686,9 @@ export declare const KDF_TurboSHAKE256: KDFFactory;
|
|
|
1646
1686
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1647
1687
|
*
|
|
1648
1688
|
* @group KEM Algorithms
|
|
1649
|
-
* @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)
|
|
1650
1690
|
*/
|
|
1651
|
-
export declare const KEM_DHKEM_P256_HKDF_SHA256: KEMFactory
|
|
1691
|
+
export declare const KEM_DHKEM_P256_HKDF_SHA256: KEMFactory<CryptoKey>;
|
|
1652
1692
|
/**
|
|
1653
1693
|
* Diffie-Hellman Key Encapsulation Mechanism using NIST P-384 curve and HKDF-SHA384.
|
|
1654
1694
|
*
|
|
@@ -1667,9 +1707,9 @@ export declare const KEM_DHKEM_P256_HKDF_SHA256: KEMFactory;
|
|
|
1667
1707
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1668
1708
|
*
|
|
1669
1709
|
* @group KEM Algorithms
|
|
1670
|
-
* @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)
|
|
1671
1711
|
*/
|
|
1672
|
-
export declare const KEM_DHKEM_P384_HKDF_SHA384: KEMFactory
|
|
1712
|
+
export declare const KEM_DHKEM_P384_HKDF_SHA384: KEMFactory<CryptoKey>;
|
|
1673
1713
|
/**
|
|
1674
1714
|
* Diffie-Hellman Key Encapsulation Mechanism using NIST P-521 curve and HKDF-SHA512.
|
|
1675
1715
|
*
|
|
@@ -1688,9 +1728,9 @@ export declare const KEM_DHKEM_P384_HKDF_SHA384: KEMFactory;
|
|
|
1688
1728
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1689
1729
|
*
|
|
1690
1730
|
* @group KEM Algorithms
|
|
1691
|
-
* @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)
|
|
1692
1732
|
*/
|
|
1693
|
-
export declare const KEM_DHKEM_P521_HKDF_SHA512: KEMFactory
|
|
1733
|
+
export declare const KEM_DHKEM_P521_HKDF_SHA512: KEMFactory<CryptoKey>;
|
|
1694
1734
|
/**
|
|
1695
1735
|
* Diffie-Hellman Key Encapsulation Mechanism using Curve25519 and HKDF-SHA256.
|
|
1696
1736
|
*
|
|
@@ -1709,9 +1749,9 @@ export declare const KEM_DHKEM_P521_HKDF_SHA512: KEMFactory;
|
|
|
1709
1749
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1710
1750
|
*
|
|
1711
1751
|
* @group KEM Algorithms
|
|
1712
|
-
* @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)
|
|
1713
1753
|
*/
|
|
1714
|
-
export declare const KEM_DHKEM_X25519_HKDF_SHA256: KEMFactory
|
|
1754
|
+
export declare const KEM_DHKEM_X25519_HKDF_SHA256: KEMFactory<CryptoKey>;
|
|
1715
1755
|
/**
|
|
1716
1756
|
* Diffie-Hellman Key Encapsulation Mechanism using Curve448 and HKDF-SHA512.
|
|
1717
1757
|
*
|
|
@@ -1730,9 +1770,9 @@ export declare const KEM_DHKEM_X25519_HKDF_SHA256: KEMFactory;
|
|
|
1730
1770
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1731
1771
|
*
|
|
1732
1772
|
* @group KEM Algorithms
|
|
1733
|
-
* @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)
|
|
1734
1774
|
*/
|
|
1735
|
-
export declare const KEM_DHKEM_X448_HKDF_SHA512: KEMFactory
|
|
1775
|
+
export declare const KEM_DHKEM_X448_HKDF_SHA512: KEMFactory<CryptoKey>;
|
|
1736
1776
|
/**
|
|
1737
1777
|
* Module-Lattice-Based Key Encapsulation Mechanism (ML-KEM-512).
|
|
1738
1778
|
*
|
|
@@ -1754,9 +1794,9 @@ export declare const KEM_DHKEM_X448_HKDF_SHA512: KEMFactory;
|
|
|
1754
1794
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1755
1795
|
*
|
|
1756
1796
|
* @group KEM Algorithms
|
|
1757
|
-
* @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)
|
|
1758
1798
|
*/
|
|
1759
|
-
export declare const KEM_ML_KEM_512: KEMFactory
|
|
1799
|
+
export declare const KEM_ML_KEM_512: KEMFactory<CryptoKey>;
|
|
1760
1800
|
/**
|
|
1761
1801
|
* Module-Lattice-Based Key Encapsulation Mechanism (ML-KEM-768).
|
|
1762
1802
|
*
|
|
@@ -1774,9 +1814,9 @@ export declare const KEM_ML_KEM_512: KEMFactory;
|
|
|
1774
1814
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1775
1815
|
*
|
|
1776
1816
|
* @group KEM Algorithms
|
|
1777
|
-
* @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)
|
|
1778
1818
|
*/
|
|
1779
|
-
export declare const KEM_ML_KEM_768: KEMFactory
|
|
1819
|
+
export declare const KEM_ML_KEM_768: KEMFactory<CryptoKey>;
|
|
1780
1820
|
/**
|
|
1781
1821
|
* Module-Lattice-Based Key Encapsulation Mechanism (ML-KEM-1024).
|
|
1782
1822
|
*
|
|
@@ -1794,9 +1834,9 @@ export declare const KEM_ML_KEM_768: KEMFactory;
|
|
|
1794
1834
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1795
1835
|
*
|
|
1796
1836
|
* @group KEM Algorithms
|
|
1797
|
-
* @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)
|
|
1798
1838
|
*/
|
|
1799
|
-
export declare const KEM_ML_KEM_1024: KEMFactory
|
|
1839
|
+
export declare const KEM_ML_KEM_1024: KEMFactory<CryptoKey>;
|
|
1800
1840
|
/**
|
|
1801
1841
|
* AES-128-GCM Authenticated Encryption with Associated Data (AEAD).
|
|
1802
1842
|
*
|
|
@@ -1813,7 +1853,7 @@ export declare const KEM_ML_KEM_1024: KEMFactory;
|
|
|
1813
1853
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1814
1854
|
*
|
|
1815
1855
|
* @group AEAD Algorithms
|
|
1816
|
-
* @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)
|
|
1817
1857
|
*/
|
|
1818
1858
|
export declare const AEAD_AES_128_GCM: AEADFactory;
|
|
1819
1859
|
/**
|
|
@@ -1832,7 +1872,7 @@ export declare const AEAD_AES_128_GCM: AEADFactory;
|
|
|
1832
1872
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1833
1873
|
*
|
|
1834
1874
|
* @group AEAD Algorithms
|
|
1835
|
-
* @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)
|
|
1836
1876
|
*/
|
|
1837
1877
|
export declare const AEAD_AES_256_GCM: AEADFactory;
|
|
1838
1878
|
/**
|
|
@@ -1851,7 +1891,7 @@ export declare const AEAD_AES_256_GCM: AEADFactory;
|
|
|
1851
1891
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1852
1892
|
*
|
|
1853
1893
|
* @group AEAD Algorithms
|
|
1854
|
-
* @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)
|
|
1855
1895
|
*/
|
|
1856
1896
|
export declare const AEAD_ChaCha20Poly1305: AEADFactory;
|
|
1857
1897
|
/**
|
|
@@ -1871,7 +1911,7 @@ export declare const AEAD_ChaCha20Poly1305: AEADFactory;
|
|
|
1871
1911
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1872
1912
|
*
|
|
1873
1913
|
* @group KEM Algorithms
|
|
1874
|
-
* @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)
|
|
1875
1915
|
*/
|
|
1876
1916
|
export declare const KEM_MLKEM768_X25519: KEMFactory;
|
|
1877
1917
|
/**
|
|
@@ -1891,7 +1931,7 @@ export declare const KEM_MLKEM768_X25519: KEMFactory;
|
|
|
1891
1931
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1892
1932
|
*
|
|
1893
1933
|
* @group KEM Algorithms
|
|
1894
|
-
* @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)
|
|
1895
1935
|
*/
|
|
1896
1936
|
export declare const KEM_MLKEM768_P256: KEMFactory;
|
|
1897
1937
|
/**
|
|
@@ -1911,6 +1951,6 @@ export declare const KEM_MLKEM768_P256: KEMFactory;
|
|
|
1911
1951
|
* > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
|
|
1912
1952
|
*
|
|
1913
1953
|
* @group KEM Algorithms
|
|
1914
|
-
* @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)
|
|
1915
1955
|
*/
|
|
1916
1956
|
export declare const KEM_MLKEM1024_P384: KEMFactory;
|