hpke 1.1.7 → 1.1.8

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 CHANGED
@@ -97,10 +97,10 @@ Below are the algorithms built in (based on Web Cryptography) and their runtime
97
97
  | DHKEM(X25519, HKDF-SHA256) <sub>`0x0020`</sub> | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
98
98
  | DHKEM(X448, HKDF-SHA512) <sub>`0x0021`</sub> | ✓ | ✓ | | | | ✓ |
99
99
  | ML-KEM-512 <sub>`0x0040`</sub> | ✓ | ✓ | | | | ✓ |
100
- | ML-KEM-768 <sub>`0x0041`</sub> | ✓ | ✓ | ✓ | | | ✓ |
101
- | ML-KEM-1024 <sub>`0x0042`</sub> | ✓ | ✓ | ✓ | | | ✓ |
100
+ | ML-KEM-768 <sub>`0x0041`</sub> | ✓ | ✓ | ✓ | ✓[^cf-pqc] | ◐[^chromium] | ✓ |
101
+ | ML-KEM-1024 <sub>`0x0042`</sub> | ✓ | ✓ | ✓ | ✓[^cf-pqc] | ◐[^chromium] | ✓ |
102
102
  | MLKEM768-P256 <sub>`0x0050`</sub> | ✓ | ✓ | | | | ✓ |
103
- | MLKEM768-X25519 <sub>`0x647a`</sub> | ✓ | ✓ | | | | ✓ |
103
+ | MLKEM768-X25519 <sub>`0x647a`</sub> | ✓ | ✓ | | | ◐[^chromium] | ✓ |
104
104
  | MLKEM1024-P384 <sub>`0x0051`</sub> | ✓ | ✓ | | | | ✓ |
105
105
 
106
106
  ### Key Derivation Functions (KDF)
@@ -121,11 +121,22 @@ Below are the algorithms built in (based on Web Cryptography) and their runtime
121
121
  | :----------------------------------- | :-----: | :--: | :-: | :--------: | :----------: | :---------------: |
122
122
  | AES-128-GCM <sub>`0x0001`</sub> | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
123
123
  | AES-256-GCM <sub>`0x0002`</sub> | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
124
- | ChaCha20Poly1305 <sub>`0x0003`</sub> | ✓ | ✓ | ✓ | | | ✓ |
124
+ | ChaCha20Poly1305 <sub>`0x0003`</sub> | ✓ | ✓ | ✓ | | ◐[^chromium] | ✓ |
125
+
126
+ [^chromium]: Chromium
127
+
128
+ [^firefox]: Firefox
129
+
130
+ [^webkit]: WebKit
131
+
132
+ [^cf-pqc]:
133
+ Requires the
134
+ [`webcrypto_modern_algorithms`](https://developers.cloudflare.com/workers/configuration/compatibility-flags/#web-crypto-modern-algorithms)
135
+ compatibility flag.
125
136
 
126
137
  ## Specifications
127
138
 
128
- - [Hybrid Public Key Encryption](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04)
139
+ - [Hybrid Public Key Encryption](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06)
129
140
  - [Post-Quantum and Post-Quantum/Traditional Hybrid Algorithms for HPKE](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05)
130
141
 
131
142
  The algorithm implementations are being tested using test vectors from their respective
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-04).
8
+ * [draft-ietf-hpke-hpke](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06).
9
9
  *
10
10
  * HPKE provides a variant of public key encryption for arbitrary-sized plaintexts using a recipient
11
11
  * public key.
@@ -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-04.html#section-5.2)
99
+ * @see [Context.Seal](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-5.2)
100
100
  */
101
101
  Seal(plaintext: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
102
102
  /**
@@ -104,6 +104,11 @@ declare class SenderContext {
104
104
  *
105
105
  * The exported secret is indistinguishable from a uniformly random bitstring of equal length.
106
106
  *
107
+ * HPKE does not provide replay protection. A replayed encapsulated secret produces the same
108
+ * exported secrets. Applications must only use these secrets where repeated values are safe.
109
+ * Deriving AEAD keys and nonces requires a fresh value for each derivation, such as a
110
+ * recipient-provided nonce.
111
+ *
107
112
 
108
113
 
109
114
 
@@ -120,7 +125,7 @@ declare class SenderContext {
120
125
  * @param length - Desired length of exported secret in bytes
121
126
  *
122
127
  * @returns A Promise that resolves to the exported secret.
123
- * @see [Context.Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5.3)
128
+ * @see [Context.Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-5.3)
124
129
  */
125
130
  Export(exporterContext: Uint8Array, length: number): Promise<Uint8Array>;
126
131
  /**
@@ -190,7 +195,7 @@ declare class RecipientContext {
190
195
  * @param aad - Additional authenticated data
191
196
  *
192
197
  * @returns A Promise that resolves to the decrypted plaintext.
193
- * @see [Context.Open](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5.2)
198
+ * @see [Context.Open](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-5.2)
194
199
  */
195
200
  Open(ciphertext: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
196
201
  /**
@@ -198,6 +203,11 @@ declare class RecipientContext {
198
203
  *
199
204
  * The exported secret is indistinguishable from a uniformly random bitstring of equal length.
200
205
  *
206
+ * HPKE does not provide replay protection. A replayed encapsulated secret produces the same
207
+ * exported secrets. Applications must only use these secrets where repeated values are safe.
208
+ * Deriving AEAD keys and nonces requires a fresh value for each derivation, such as a
209
+ * recipient-provided nonce.
210
+ *
201
211
 
202
212
 
203
213
 
@@ -214,7 +224,7 @@ declare class RecipientContext {
214
224
  * @param length - Desired length of exported secret in bytes
215
225
  *
216
226
  * @returns A Promise that resolves to the exported secret.
217
- * @see [Context.Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5.3)
227
+ * @see [Context.Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-5.3)
218
228
  */
219
229
  Export(exporterContext: Uint8Array, length: number): Promise<Uint8Array>;
220
230
  }
@@ -226,7 +236,7 @@ export type { RecipientContext };
226
236
  * asymmetric key exchange with a symmetric cipher. This was originally defined in an Informational
227
237
  * document on the IRTF stream as [RFC 9180](https://www.rfc-editor.org/rfc/rfc9180.html) and is now
228
238
  * 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-04).
239
+ * [draft-ietf-hpke-hpke](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06).
230
240
  *
231
241
  * HPKE provides a variant of public key encryption for arbitrary-sized plaintexts using a recipient
232
242
  * public key. It supports two modes:
@@ -296,12 +306,12 @@ export declare class CipherSuite<K extends Key = Key> {
296
306
 
297
307
 
298
308
 
299
- * @param KEM - KEM implementation factory. Must return an object conforming to the {@link KEM}
300
- * interface.
301
- * @param KDF - KDF implementation factory. Must return an object conforming to the {@link KDF}
302
- * interface.
303
- * @param AEAD - AEAD implementation factory. Must return an object conforming to the {@link AEAD}
304
- * interface.
309
+ * @param KEM - KEM implementation factory. Must return an object conforming to the
310
+ * {@link !KEM KEM} interface.
311
+ * @param KDF - KDF implementation factory. Must return an object conforming to the
312
+ * {@link !KDF KDF} interface.
313
+ * @param AEAD - AEAD implementation factory. Must return an object conforming to the
314
+ * {@link !AEAD AEAD} interface.
305
315
  * @see {@link KEMFactory Available KEMs}
306
316
  * @see {@link KDFFactory Available KDFs}
307
317
  * @see {@link AEADFactory Available AEADs}
@@ -489,6 +499,9 @@ export declare class CipherSuite<K extends Key = Key> {
489
499
  * Single-shot API for encrypting a single message. It combines context setup and encryption in
490
500
  * one call.
491
501
  *
502
+ * Applications should prefer `options.info` for authenticated information that applies to the
503
+ * whole context, reserving `options.aad` for information specific to the message.
504
+ *
492
505
  * Mode selection:
493
506
  *
494
507
  * - If the options `psk` and `pskId` are omitted: Base mode (unauthenticated)
@@ -517,7 +530,8 @@ export declare class CipherSuite<K extends Key = Key> {
517
530
  * @returns A Promise that resolves to an object containing the encapsulated secret and
518
531
  * ciphertext. The ciphertext is {@link CipherSuite.AEAD Nt} bytes longer than the plaintext. The
519
532
  * encapsulated secret is {@link CipherSuite.KEM Nenc} bytes.
520
- * @see [Single-Shot Encryption](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-6.1)
533
+ * @see [Single-Shot Encryption](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-6.1)
534
+ * @see [Auxiliary Authenticated Application Information](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-8.1)
521
535
  */
522
536
  Seal(publicKey: K, plaintext: Uint8Array, options?: {
523
537
  aad?: Uint8Array;
@@ -533,6 +547,9 @@ export declare class CipherSuite<K extends Key = Key> {
533
547
  *
534
548
  * It combines context setup and decryption in one call.
535
549
  *
550
+ * Applications should prefer `options.info` for authenticated information that applies to the
551
+ * whole context, reserving `options.aad` for information specific to the message.
552
+ *
536
553
  * Mode selection:
537
554
  *
538
555
  * - If the options `psk` and `pskId` are omitted: Base mode (unauthenticated)
@@ -562,7 +579,8 @@ export declare class CipherSuite<K extends Key = Key> {
562
579
  * @param options.pskId - Pre-shared key identifier (for PSK mode)
563
580
  *
564
581
  * @returns A Promise that resolves to the decrypted plaintext.
565
- * @see [Single-Shot Decryption](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-6.1)
582
+ * @see [Single-Shot Decryption](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-6.1)
583
+ * @see [Auxiliary Authenticated Application Information](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-8.1)
566
584
  */
567
585
  Open(privateKey: K | KeyPair<K>, encapsulatedSecret: Uint8Array, ciphertext: Uint8Array, options?: {
568
586
  aad?: Uint8Array;
@@ -575,8 +593,16 @@ export declare class CipherSuite<K extends Key = Key> {
575
593
  *
576
594
  * It combines context setup and secret export in one call.
577
595
  *
596
+ * Applications should prefer `options.info` for authenticated information that applies to the
597
+ * whole context, reserving `exporterContext` for information specific to the exported secret.
598
+ *
578
599
  * The exported secret is indistinguishable from a uniformly random bitstring of equal length.
579
600
  *
601
+ * HPKE does not provide replay protection. A replayed encapsulated secret produces the same
602
+ * exported secrets. Applications must only use these secrets where repeated values are safe.
603
+ * Deriving AEAD keys and nonces requires a fresh value for each derivation, such as a
604
+ * recipient-provided nonce.
605
+ *
580
606
  * @category Single-Shot APIs
581
607
 
582
608
 
@@ -603,7 +629,8 @@ export declare class CipherSuite<K extends Key = Key> {
603
629
  *
604
630
  * @returns A Promise that resolves to an object containing the encapsulated secret and the
605
631
  * exported secret.
606
- * @see [Single-Shot Secret Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-6.2)
632
+ * @see [Single-Shot Secret Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-6.2)
633
+ * @see [Auxiliary Authenticated Application Information](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-8.1)
607
634
  */
608
635
  SendExport(publicKey: K, exporterContext: Uint8Array, length: number, options?: {
609
636
  info?: Uint8Array;
@@ -618,6 +645,14 @@ export declare class CipherSuite<K extends Key = Key> {
618
645
  *
619
646
  * It combines context setup and secret export in one call.
620
647
  *
648
+ * Applications should prefer `options.info` for authenticated information that applies to the
649
+ * whole context, reserving `exporterContext` for information specific to the exported secret.
650
+ *
651
+ * HPKE does not provide replay protection. A replayed encapsulated secret produces the same
652
+ * exported secrets. Applications must only use these secrets where repeated values are safe.
653
+ * Deriving AEAD keys and nonces requires a fresh value for each derivation, such as a
654
+ * recipient-provided nonce.
655
+ *
621
656
  * @category Single-Shot APIs
622
657
 
623
658
 
@@ -648,7 +683,8 @@ export declare class CipherSuite<K extends Key = Key> {
648
683
  * @param options.pskId - Pre-shared key identifier (for PSK mode)
649
684
  *
650
685
  * @returns A Promise that resolves to the exported secret.
651
- * @see [Single-Shot Secret Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-6.2)
686
+ * @see [Single-Shot Secret Export](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-6.2)
687
+ * @see [Auxiliary Authenticated Application Information](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-8.1)
652
688
  */
653
689
  ReceiveExport(privateKey: K | KeyPair<K>, encapsulatedSecret: Uint8Array, exporterContext: Uint8Array, length: number, options?: {
654
690
  info?: Uint8Array;
@@ -696,7 +732,7 @@ export declare class CipherSuite<K extends Key = Key> {
696
732
  *
697
733
  * @returns A Promise that resolves to an object containing the encapsulated secret and the sender
698
734
  * context (`ctx`). The encapsulated secret is {@link CipherSuite.KEM Nenc} bytes.
699
- * @see [SetupBaseS / SetupPSKS](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5.1.1)
735
+ * @see [SetupBaseS / SetupPSKS](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-5.1.1)
700
736
  */
701
737
  SetupSender(publicKey: K, options?: {
702
738
  info?: Uint8Array;
@@ -752,7 +788,7 @@ export declare class CipherSuite<K extends Key = Key> {
752
788
  * @param options.pskId - Pre-shared key identifier (for PSK mode)
753
789
  *
754
790
  * @returns A Promise that resolves to the recipient context.
755
- * @see [SetupBaseR / SetupPSKR](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5.1.1)
791
+ * @see [SetupBaseR / SetupPSKR](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-5.1.1)
756
792
  */
757
793
  SetupRecipient(privateKey: K | KeyPair<K>, encapsulatedSecret: Uint8Array, options?: {
758
794
  info?: Uint8Array;
@@ -860,7 +896,7 @@ interface Triple<K extends Key = Key> {
860
896
  * Base mode provides encryption to a public key without sender authentication. The recipient cannot
861
897
  * verify who encrypted the message, only that someone with access to their public key did.
862
898
  *
863
- * @see [HPKE Modes](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5)
899
+ * @see [HPKE Modes](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-5)
864
900
  */
865
901
  export declare const MODE_BASE = 0;
866
902
  /**
@@ -870,7 +906,7 @@ export declare const MODE_BASE = 0;
870
906
  * sender and recipient must possess the same PSK and PSK ID. This provides implicit sender
871
907
  * authentication.
872
908
  *
873
- * @see [HPKE Modes](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-5)
909
+ * @see [HPKE Modes](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-5)
874
910
  */
875
911
  export declare const MODE_PSK = 1;
876
912
  /** Mode supported by this implementation. */
@@ -1048,25 +1084,18 @@ export declare function concat(...buffers: Uint8Array[]): Uint8Array;
1048
1084
  */
1049
1085
  export declare function encode(string: string): Uint8Array;
1050
1086
  /**
1051
- * Performs labeled key derivation for one-stage KDFs.
1052
- *
1053
- * This function implements the LabeledDerive operation as specified in the HPKE specification for
1054
- * use with one-stage KDFs. It constructs a labeled input by concatenating:
1055
- *
1056
- * - The input keying material (`ikm`)
1057
- * - The version string "HPKE-v1"
1058
- * - The suite identifier (`suite_id`)
1059
- * - A length-prefixed label
1060
- * - The desired output length as a 2-byte encoding
1061
- * - Additional context
1087
+ * Integer to Octet String Primitive (I2OSP) as defined in RFC 8017. Converts a non-negative integer
1088
+ * into a byte string of specified length. It's exported for use in custom KEM, KDF, or AEAD
1089
+ * implementations.
1062
1090
  *
1063
- * The labeled input is then passed to the KDF's Derive function to produce L bytes of output. This
1064
- * ensures domain separation between different uses of the KDF in HPKE.
1091
+ * @param n - Non-negative safe integer to convert
1092
+ * @param w - Desired length of output in bytes
1065
1093
  *
1094
+ * @returns A Uint8Array of length w containing the big-endian representation of n
1066
1095
  * @group Utilities
1067
- * @see [LabeledDerive](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-5)
1096
+ * @see [I2OSP](https://www.rfc-editor.org/rfc/rfc8017#section-4.1)
1068
1097
  */
1069
- export declare function LabeledDerive(KDF: Pick<KDF, 'Derive'>, suite_id: Uint8Array, ikm: Uint8Array, label: Uint8Array, context: Uint8Array, L: number): Promise<Uint8Array>;
1098
+ export declare function I2OSP(n: number, w: number): Uint8Array;
1070
1099
  /**
1071
1100
  * Key Derivation Function (KDF) implementation interface.
1072
1101
  *
@@ -1086,6 +1115,9 @@ export declare function LabeledDerive(KDF: Pick<KDF, 'Derive'>, suite_id: Uint8A
1086
1115
  * - Two-stage KDFs only implement {@link Extract} and {@link Expand}. The {@link Derive} method will not
1087
1116
  * be called and may be a no-op implementation.
1088
1117
  *
1118
+ * Custom KDF implementations must also meet the [KDF security
1119
+ * requirements](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-9.3).
1120
+ *
1089
1121
 
1090
1122
 
1091
1123
 
@@ -1132,7 +1164,7 @@ export declare function LabeledDerive(KDF: Pick<KDF, 'Derive'>, suite_id: Uint8A
1132
1164
 
1133
1165
 
1134
1166
 
1135
- * @see [HPKE Key Derivation Functions](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-4.2)
1167
+ * @see [HPKE Key Derivation Functions](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-4.2)
1136
1168
  */
1137
1169
  export interface KDF {
1138
1170
  /** KDF algorithm identifier */
@@ -1178,6 +1210,26 @@ export interface KDF {
1178
1210
  */
1179
1211
  Derive(labeled_ikm: Uint8Array, L: number): Promise<Uint8Array>;
1180
1212
  }
1213
+ /**
1214
+ * Performs labeled key derivation for one-stage KDFs.
1215
+ *
1216
+ * This function implements the LabeledDerive operation as specified in the HPKE specification for
1217
+ * use with one-stage KDFs. It constructs a labeled input by concatenating:
1218
+ *
1219
+ * - The input keying material (`ikm`)
1220
+ * - The version string "HPKE-v1"
1221
+ * - The suite identifier (`suite_id`)
1222
+ * - A length-prefixed label
1223
+ * - The desired output length as a 2-byte encoding
1224
+ * - Additional context
1225
+ *
1226
+ * The labeled input is then passed to the KDF's Derive function to produce L bytes of output. This
1227
+ * ensures domain separation between different uses of the KDF in HPKE.
1228
+ *
1229
+ * @group Utilities
1230
+ * @see [LabeledDerive](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-4.4)
1231
+ */
1232
+ export declare function LabeledDerive(KDF: Pick<KDF, 'Derive'>, suite_id: Uint8Array, ikm: Uint8Array, label: Uint8Array, context: Uint8Array, L: number): Promise<Uint8Array>;
1181
1233
  /**
1182
1234
  * Performs labeled extraction for two-stage KDFs.
1183
1235
  *
@@ -1193,7 +1245,7 @@ export interface KDF {
1193
1245
  * pseudorandom key. This ensures domain separation between different uses of the KDF in HPKE.
1194
1246
  *
1195
1247
  * @group Utilities
1196
- * @see [LabeledExtract](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-4.4)
1248
+ * @see [LabeledExtract](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-4.4)
1197
1249
  */
1198
1250
  export declare function LabeledExtract(KDF: Pick<KDF, 'Extract'>, suite_id: Uint8Array, salt: Uint8Array, label: Uint8Array, ikm: Uint8Array): Promise<Uint8Array>;
1199
1251
  /**
@@ -1213,7 +1265,7 @@ export declare function LabeledExtract(KDF: Pick<KDF, 'Extract'>, suite_id: Uint
1213
1265
  * of the KDF in HPKE.
1214
1266
  *
1215
1267
  * @group Utilities
1216
- * @see [LabeledExpand](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-4.4)
1268
+ * @see [LabeledExpand](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-4.4)
1217
1269
  */
1218
1270
  export declare function LabeledExpand(KDF: Pick<KDF, 'Expand'>, suite_id: Uint8Array, prk: Uint8Array, label: Uint8Array, info: Uint8Array, L: number): Promise<Uint8Array>;
1219
1271
  /**
@@ -1308,7 +1360,7 @@ export declare function LabeledExpand(KDF: Pick<KDF, 'Expand'>, suite_id: Uint8A
1308
1360
 
1309
1361
 
1310
1362
  * @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)
1363
+ * @see [HPKE Key Encapsulation Mechanisms](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-4.1)
1312
1364
  */
1313
1365
  export interface KEM<K extends Key = Key> {
1314
1366
  /** KEM algorithm identifier */
@@ -1458,7 +1510,7 @@ export interface KEM<K extends Key = Key> {
1458
1510
 
1459
1511
 
1460
1512
 
1461
- * @see [HPKE AEAD Encryption Algorithm](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-4.3)
1513
+ * @see [HPKE AEAD Encryption Algorithm](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-4.3)
1462
1514
  */
1463
1515
  export interface AEAD {
1464
1516
  /** AEAD algorithm identifier */
@@ -1487,7 +1539,7 @@ export interface AEAD {
1487
1539
  * @param pt - Plaintext to encrypt
1488
1540
  *
1489
1541
  * @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)
1542
+ * @see [Context.Seal P_MAX handling](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-5.2)
1491
1543
  */
1492
1544
  Seal(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, pt: Uint8Array): Promise<Uint8Array>;
1493
1545
  /**
@@ -1502,19 +1554,6 @@ export interface AEAD {
1502
1554
  */
1503
1555
  Open(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, ct: Uint8Array): Promise<Uint8Array>;
1504
1556
  }
1505
- /**
1506
- * Integer to Octet String Primitive (I2OSP) as defined in RFC 8017. Converts a non-negative integer
1507
- * into a byte string of specified length. It's exported for use in custom KEM, KDF, or AEAD
1508
- * implementations.
1509
- *
1510
- * @param n - Non-negative safe integer to convert
1511
- * @param w - Desired length of output in bytes
1512
- *
1513
- * @returns A Uint8Array of length w containing the big-endian representation of n
1514
- * @group Utilities
1515
- * @see [I2OSP](https://www.rfc-editor.org/rfc/rfc8017#section-4.1)
1516
- */
1517
- export declare function I2OSP(n: number, w: number): Uint8Array;
1518
1557
  /**
1519
1558
  * Export-only AEAD mode.
1520
1559
  *
@@ -1525,7 +1564,7 @@ export declare function I2OSP(n: number, w: number): Uint8Array;
1525
1564
  * This is a factory function that must be passed to the {@link CipherSuite} constructor.
1526
1565
  *
1527
1566
  * @group AEAD Algorithms
1528
- * @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.3)
1567
+ * @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-7.3)
1529
1568
  */
1530
1569
  export declare const AEAD_EXPORT_ONLY: AEADFactory;
1531
1570
  /**
@@ -1545,7 +1584,7 @@ export declare const AEAD_EXPORT_ONLY: AEADFactory;
1545
1584
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1546
1585
  *
1547
1586
  * @group KDF Algorithms
1548
- * @see [HPKE KDF Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.2)
1587
+ * @see [HPKE KDF Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-7.2)
1549
1588
  */
1550
1589
  export declare const KDF_HKDF_SHA256: KDFFactory;
1551
1590
  /**
@@ -1565,7 +1604,7 @@ export declare const KDF_HKDF_SHA256: KDFFactory;
1565
1604
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1566
1605
  *
1567
1606
  * @group KDF Algorithms
1568
- * @see [HPKE KDF Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.2)
1607
+ * @see [HPKE KDF Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-7.2)
1569
1608
  */
1570
1609
  export declare const KDF_HKDF_SHA384: KDFFactory;
1571
1610
  /**
@@ -1585,7 +1624,7 @@ export declare const KDF_HKDF_SHA384: KDFFactory;
1585
1624
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1586
1625
  *
1587
1626
  * @group KDF Algorithms
1588
- * @see [HPKE KDF Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.2)
1627
+ * @see [HPKE KDF Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-7.2)
1589
1628
  */
1590
1629
  export declare const KDF_HKDF_SHA512: KDFFactory;
1591
1630
  /**
@@ -1605,7 +1644,7 @@ export declare const KDF_HKDF_SHA512: KDFFactory;
1605
1644
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1606
1645
  *
1607
1646
  * @group KDF Algorithms
1608
- * @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-5)
1647
+ * @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05#section-5)
1609
1648
  */
1610
1649
  export declare const KDF_SHAKE128: KDFFactory;
1611
1650
  /**
@@ -1625,7 +1664,7 @@ export declare const KDF_SHAKE128: KDFFactory;
1625
1664
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1626
1665
  *
1627
1666
  * @group KDF Algorithms
1628
- * @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-5)
1667
+ * @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05#section-5)
1629
1668
  */
1630
1669
  export declare const KDF_SHAKE256: KDFFactory;
1631
1670
  /**
@@ -1645,7 +1684,7 @@ export declare const KDF_SHAKE256: KDFFactory;
1645
1684
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1646
1685
  *
1647
1686
  * @group KDF Algorithms
1648
- * @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-5)
1687
+ * @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05#section-5)
1649
1688
  */
1650
1689
  export declare const KDF_TurboSHAKE128: KDFFactory;
1651
1690
  /**
@@ -1665,7 +1704,7 @@ export declare const KDF_TurboSHAKE128: KDFFactory;
1665
1704
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1666
1705
  *
1667
1706
  * @group KDF Algorithms
1668
- * @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-5)
1707
+ * @see [HPKE-PQ One-Stage KDFs](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05#section-5)
1669
1708
  */
1670
1709
  export declare const KDF_TurboSHAKE256: KDFFactory;
1671
1710
  /**
@@ -1686,7 +1725,7 @@ export declare const KDF_TurboSHAKE256: KDFFactory;
1686
1725
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1687
1726
  *
1688
1727
  * @group KEM Algorithms
1689
- * @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.1)
1728
+ * @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-7.1)
1690
1729
  */
1691
1730
  export declare const KEM_DHKEM_P256_HKDF_SHA256: KEMFactory<CryptoKey>;
1692
1731
  /**
@@ -1707,7 +1746,7 @@ export declare const KEM_DHKEM_P256_HKDF_SHA256: KEMFactory<CryptoKey>;
1707
1746
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1708
1747
  *
1709
1748
  * @group KEM Algorithms
1710
- * @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.1)
1749
+ * @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-7.1)
1711
1750
  */
1712
1751
  export declare const KEM_DHKEM_P384_HKDF_SHA384: KEMFactory<CryptoKey>;
1713
1752
  /**
@@ -1728,7 +1767,7 @@ export declare const KEM_DHKEM_P384_HKDF_SHA384: KEMFactory<CryptoKey>;
1728
1767
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1729
1768
  *
1730
1769
  * @group KEM Algorithms
1731
- * @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.1)
1770
+ * @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-7.1)
1732
1771
  */
1733
1772
  export declare const KEM_DHKEM_P521_HKDF_SHA512: KEMFactory<CryptoKey>;
1734
1773
  /**
@@ -1749,7 +1788,7 @@ export declare const KEM_DHKEM_P521_HKDF_SHA512: KEMFactory<CryptoKey>;
1749
1788
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1750
1789
  *
1751
1790
  * @group KEM Algorithms
1752
- * @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.1)
1791
+ * @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-7.1)
1753
1792
  */
1754
1793
  export declare const KEM_DHKEM_X25519_HKDF_SHA256: KEMFactory<CryptoKey>;
1755
1794
  /**
@@ -1770,7 +1809,7 @@ export declare const KEM_DHKEM_X25519_HKDF_SHA256: KEMFactory<CryptoKey>;
1770
1809
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1771
1810
  *
1772
1811
  * @group KEM Algorithms
1773
- * @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.1)
1812
+ * @see [HPKE KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-7.1)
1774
1813
  */
1775
1814
  export declare const KEM_DHKEM_X448_HKDF_SHA512: KEMFactory<CryptoKey>;
1776
1815
  /**
@@ -1794,7 +1833,7 @@ export declare const KEM_DHKEM_X448_HKDF_SHA512: KEMFactory<CryptoKey>;
1794
1833
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1795
1834
  *
1796
1835
  * @group KEM Algorithms
1797
- * @see [HPKE-PQ KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-3)
1836
+ * @see [HPKE-PQ KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05#section-3)
1798
1837
  */
1799
1838
  export declare const KEM_ML_KEM_512: KEMFactory<CryptoKey>;
1800
1839
  /**
@@ -1814,7 +1853,7 @@ export declare const KEM_ML_KEM_512: KEMFactory<CryptoKey>;
1814
1853
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1815
1854
  *
1816
1855
  * @group KEM Algorithms
1817
- * @see [HPKE-PQ KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-3)
1856
+ * @see [HPKE-PQ KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05#section-3)
1818
1857
  */
1819
1858
  export declare const KEM_ML_KEM_768: KEMFactory<CryptoKey>;
1820
1859
  /**
@@ -1834,7 +1873,7 @@ export declare const KEM_ML_KEM_768: KEMFactory<CryptoKey>;
1834
1873
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1835
1874
  *
1836
1875
  * @group KEM Algorithms
1837
- * @see [HPKE-PQ KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-3)
1876
+ * @see [HPKE-PQ KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05#section-3)
1838
1877
  */
1839
1878
  export declare const KEM_ML_KEM_1024: KEMFactory<CryptoKey>;
1840
1879
  /**
@@ -1853,7 +1892,7 @@ export declare const KEM_ML_KEM_1024: KEMFactory<CryptoKey>;
1853
1892
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1854
1893
  *
1855
1894
  * @group AEAD Algorithms
1856
- * @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.3)
1895
+ * @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-7.3)
1857
1896
  */
1858
1897
  export declare const AEAD_AES_128_GCM: AEADFactory;
1859
1898
  /**
@@ -1872,7 +1911,7 @@ export declare const AEAD_AES_128_GCM: AEADFactory;
1872
1911
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1873
1912
  *
1874
1913
  * @group AEAD Algorithms
1875
- * @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.3)
1914
+ * @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-7.3)
1876
1915
  */
1877
1916
  export declare const AEAD_AES_256_GCM: AEADFactory;
1878
1917
  /**
@@ -1891,7 +1930,7 @@ export declare const AEAD_AES_256_GCM: AEADFactory;
1891
1930
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1892
1931
  *
1893
1932
  * @group AEAD Algorithms
1894
- * @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04.html#section-7.3)
1933
+ * @see [HPKE AEAD Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-06#section-7.3)
1895
1934
  */
1896
1935
  export declare const AEAD_ChaCha20Poly1305: AEADFactory;
1897
1936
  /**
@@ -1917,7 +1956,7 @@ export declare const AEAD_ChaCha20Poly1305: AEADFactory;
1917
1956
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1918
1957
  *
1919
1958
  * @group KEM Algorithms
1920
- * @see [HPKE-PQ Hybrid KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-4)
1959
+ * @see [HPKE-PQ Hybrid KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05#section-4)
1921
1960
  */
1922
1961
  export declare const KEM_MLKEM768_X25519: KEMFactory;
1923
1962
  /**
@@ -1943,7 +1982,7 @@ export declare const KEM_MLKEM768_X25519: KEMFactory;
1943
1982
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1944
1983
  *
1945
1984
  * @group KEM Algorithms
1946
- * @see [HPKE-PQ Hybrid KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-4)
1985
+ * @see [HPKE-PQ Hybrid KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05#section-4)
1947
1986
  */
1948
1987
  export declare const KEM_MLKEM768_P256: KEMFactory;
1949
1988
  /**
@@ -1969,6 +2008,6 @@ export declare const KEM_MLKEM768_P256: KEMFactory;
1969
2008
  * > [`@panva/hpke-noble`](https://www.npmjs.com/package/@panva/hpke-noble)
1970
2009
  *
1971
2010
  * @group KEM Algorithms
1972
- * @see [HPKE-PQ Hybrid KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05.html#section-4)
2011
+ * @see [HPKE-PQ Hybrid KEM Identifiers](https://datatracker.ietf.org/doc/html/draft-ietf-hpke-pq-05#section-4)
1973
2012
  */
1974
2013
  export declare const KEM_MLKEM1024_P384: KEMFactory;