micro509 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/CHANGELOG.md +2064 -0
  2. package/README.md +105 -225
  3. package/dist/crypto/crypto.d.ts +42 -11
  4. package/dist/crypto/crypto.js +53 -22
  5. package/dist/crypto/crypto.js.map +1 -1
  6. package/dist/crypto.d.ts +2 -2
  7. package/dist/crypto.js +1 -2
  8. package/dist/der/der.d.ts +41 -33
  9. package/dist/der/der.js +26 -24
  10. package/dist/der/der.js.map +1 -1
  11. package/dist/index.d.ts +10 -10
  12. package/dist/index.js +19 -19
  13. package/dist/internal/asn1/asn1.d.ts +3 -6
  14. package/dist/internal/asn1/asn1.js +343 -43
  15. package/dist/internal/asn1/asn1.js.map +1 -1
  16. package/dist/internal/asn1/ber.js +146 -0
  17. package/dist/internal/asn1/ber.js.map +1 -0
  18. package/dist/internal/asn1/decode-refusal.js +29 -0
  19. package/dist/internal/asn1/decode-refusal.js.map +1 -0
  20. package/dist/internal/asn1/der.d.ts +38 -41
  21. package/dist/internal/asn1/der.js +131 -52
  22. package/dist/internal/asn1/der.js.map +1 -1
  23. package/dist/internal/asn1/oids.js +83 -53
  24. package/dist/internal/asn1/oids.js.map +1 -1
  25. package/dist/internal/asn1/oids2.js +1 -2
  26. package/dist/internal/asn1/oids2.js.map +1 -1
  27. package/dist/internal/crypto/algorithm-names.js +1 -2
  28. package/dist/internal/crypto/algorithm-names.js.map +1 -1
  29. package/dist/internal/crypto/ecdsa.js +13 -8
  30. package/dist/internal/crypto/ecdsa.js.map +1 -1
  31. package/dist/internal/crypto/hash.js +1 -2
  32. package/dist/internal/crypto/hash.js.map +1 -1
  33. package/dist/internal/crypto/pbes2.d.ts +24 -11
  34. package/dist/internal/crypto/pbes2.js +79 -26
  35. package/dist/internal/crypto/pbes2.js.map +1 -1
  36. package/dist/internal/crypto/rsa-pss.js +46 -44
  37. package/dist/internal/crypto/rsa-pss.js.map +1 -1
  38. package/dist/internal/crypto/sig-verify.d.ts +4 -7
  39. package/dist/internal/crypto/sig-verify.js +107 -60
  40. package/dist/internal/crypto/sig-verify.js.map +1 -1
  41. package/dist/internal/crypto/signing.d.ts +1 -4
  42. package/dist/internal/crypto/signing.js +28 -29
  43. package/dist/internal/crypto/signing.js.map +1 -1
  44. package/dist/internal/crypto/webcrypto.js +1 -2
  45. package/dist/internal/crypto/webcrypto.js.map +1 -1
  46. package/dist/internal/shared/base64.js +1 -2
  47. package/dist/internal/shared/base64.js.map +1 -1
  48. package/dist/internal/shared/dn.d.ts +3 -6
  49. package/dist/internal/shared/dn.js +99 -53
  50. package/dist/internal/shared/dn.js.map +1 -1
  51. package/dist/internal/shared/idna-tables.js +7217 -0
  52. package/dist/internal/shared/idna-tables.js.map +1 -0
  53. package/dist/internal/shared/idna.js +296 -0
  54. package/dist/internal/shared/idna.js.map +1 -0
  55. package/dist/internal/shared/ip.d.ts +4 -7
  56. package/dist/internal/shared/ip.js +1 -2
  57. package/dist/internal/shared/ip.js.map +1 -1
  58. package/dist/internal/shared/mailbox.js +26 -0
  59. package/dist/internal/shared/mailbox.js.map +1 -0
  60. package/dist/internal/shared/punycode.js +101 -0
  61. package/dist/internal/shared/punycode.js.map +1 -0
  62. package/dist/internal/shared/rfc3454-tables.js +1 -2
  63. package/dist/internal/shared/rfc3454-tables.js.map +1 -1
  64. package/dist/internal/shared/rfc4518-tables.js +119 -0
  65. package/dist/internal/shared/rfc4518-tables.js.map +1 -0
  66. package/dist/internal/shared/uri-host.js +102 -0
  67. package/dist/internal/shared/uri-host.js.map +1 -0
  68. package/dist/internal/verify/name-constraints-engine.js +246 -131
  69. package/dist/internal/verify/name-constraints-engine.js.map +1 -1
  70. package/dist/internal/verify/policy-engine.js +6 -21
  71. package/dist/internal/verify/policy-engine.js.map +1 -1
  72. package/dist/internal/verify/verify-path.d.ts +1 -4
  73. package/dist/internal/verify/verify-path.js +267 -131
  74. package/dist/internal/verify/verify-path.js.map +1 -1
  75. package/dist/internal/x509/directory-name.js +1 -2
  76. package/dist/internal/x509/directory-name.js.map +1 -1
  77. package/dist/internal/x509/extension-bits.js +2 -3
  78. package/dist/internal/x509/extension-bits.js.map +1 -1
  79. package/dist/internal/x509/extension-errors.d.ts +1 -4
  80. package/dist/internal/x509/extension-errors.js +1 -2
  81. package/dist/internal/x509/extension-errors.js.map +1 -1
  82. package/dist/internal/x509/extension-registry.js +107 -89
  83. package/dist/internal/x509/extension-registry.js.map +1 -1
  84. package/dist/internal/x509/general-name-profile.js +129 -0
  85. package/dist/internal/x509/general-name-profile.js.map +1 -0
  86. package/dist/internal/x509/general-name-tags.js +1 -2
  87. package/dist/internal/x509/general-name-tags.js.map +1 -1
  88. package/dist/internal/x509/general-name.js +128 -42
  89. package/dist/internal/x509/general-name.js.map +1 -1
  90. package/dist/internal/x509/name-fields.js +1 -2
  91. package/dist/internal/x509/name-fields.js.map +1 -1
  92. package/dist/internal/x509/or-address.js +217 -0
  93. package/dist/internal/x509/or-address.js.map +1 -0
  94. package/dist/keys/keys.d.ts +112 -97
  95. package/dist/keys/keys.js +211 -204
  96. package/dist/keys/keys.js.map +1 -1
  97. package/dist/keys.d.ts +3 -3
  98. package/dist/pem/pem.d.ts +14 -17
  99. package/dist/pem/pem.js +16 -17
  100. package/dist/pem/pem.js.map +1 -1
  101. package/dist/pem.js +1 -2
  102. package/dist/pkcs/pfx.d.ts +57 -32
  103. package/dist/pkcs/pfx.js +209 -173
  104. package/dist/pkcs/pfx.js.map +1 -1
  105. package/dist/pkcs/pkcs12-mac.d.ts +104 -27
  106. package/dist/pkcs/pkcs12-mac.js +266 -79
  107. package/dist/pkcs/pkcs12-mac.js.map +1 -1
  108. package/dist/pkcs/pkcs7.d.ts +43 -37
  109. package/dist/pkcs/pkcs7.js +218 -217
  110. package/dist/pkcs/pkcs7.js.map +1 -1
  111. package/dist/pkcs.d.ts +4 -3
  112. package/dist/result/result.d.ts +27 -20
  113. package/dist/result/result.js +8 -3
  114. package/dist/result/result.js.map +1 -1
  115. package/dist/result.d.ts +2 -2
  116. package/dist/result.js +1 -2
  117. package/dist/revocation/chain.d.ts +101 -23
  118. package/dist/revocation/chain.js +436 -182
  119. package/dist/revocation/chain.js.map +1 -1
  120. package/dist/revocation/crl.d.ts +131 -67
  121. package/dist/revocation/crl.js +444 -323
  122. package/dist/revocation/crl.js.map +1 -1
  123. package/dist/revocation/ocsp.d.ts +94 -59
  124. package/dist/revocation/ocsp.js +331 -293
  125. package/dist/revocation/ocsp.js.map +1 -1
  126. package/dist/revocation/revocation.d.ts +47 -35
  127. package/dist/revocation/revocation.js +88 -57
  128. package/dist/revocation/revocation.js.map +1 -1
  129. package/dist/revocation.d.ts +3 -3
  130. package/dist/verify/identity.d.ts +16 -19
  131. package/dist/verify/identity.js +118 -89
  132. package/dist/verify/identity.js.map +1 -1
  133. package/dist/verify/name-constraints.d.ts +1 -4
  134. package/dist/verify/policy.d.ts +9 -7
  135. package/dist/verify/verify.d.ts +84 -46
  136. package/dist/verify/verify.js +300 -152
  137. package/dist/verify/verify.js.map +1 -1
  138. package/dist/verify.d.ts +2 -2
  139. package/dist/x509/certificate.d.ts +20 -21
  140. package/dist/x509/certificate.js +62 -46
  141. package/dist/x509/certificate.js.map +1 -1
  142. package/dist/x509/csr.d.ts +5 -7
  143. package/dist/x509/csr.js +10 -11
  144. package/dist/x509/csr.js.map +1 -1
  145. package/dist/x509/extensions.d.ts +154 -66
  146. package/dist/x509/extensions.js +317 -151
  147. package/dist/x509/extensions.js.map +1 -1
  148. package/dist/x509/fingerprint.d.ts +4 -7
  149. package/dist/x509/fingerprint.js +1 -2
  150. package/dist/x509/fingerprint.js.map +1 -1
  151. package/dist/x509/name-text.d.ts +7 -9
  152. package/dist/x509/name-text.js +18 -4
  153. package/dist/x509/name-text.js.map +1 -1
  154. package/dist/x509/name.d.ts +9 -11
  155. package/dist/x509/name.js +18 -19
  156. package/dist/x509/name.js.map +1 -1
  157. package/dist/x509/parse.d.ts +84 -69
  158. package/dist/x509/parse.js +421 -400
  159. package/dist/x509/parse.js.map +1 -1
  160. package/dist/x509.d.ts +2 -2
  161. package/package.json +76 -59
@@ -1,19 +1,18 @@
1
- import { Pbes2EncryptionOptions, Pbes2EncryptionScheme, Pbes2Parameters, Pbes2Prf, parsePbes2AlgorithmIdentifier } from "../internal/crypto/pbes2.js";
2
- import { ErrorResult, Micro509Error } from "../result/result.js";
3
- //#region src/keys/keys.d.ts
1
+ import { KdfLimitOptions, Pbes2EncryptionOptions, Pbes2EncryptionScheme, Pbes2Parameters, Pbes2Prf, parsePbes2AlgorithmIdentifier } from "../internal/crypto/pbes2.js";
2
+ import { DecodeFailureCode, ErrorResult, Micro509Error } from "../result/result.js";
4
3
  /** Hash algorithm paired with an RSA key. */
5
- type RsaHash = "SHA-256" | "SHA-384" | "SHA-512";
4
+ export type RsaHash = "SHA-256" | "SHA-384" | "SHA-512";
6
5
  /** RSA signature padding scheme. */
7
- type RsaSignatureScheme = "pkcs1-v1_5" | "pss";
6
+ export type RsaSignatureScheme = "pkcs1-v1_5" | "pss";
8
7
  /**
9
8
  * RSA padding scheme: a signature scheme, or `'oaep'` for RSA-OAEP encryption
10
9
  * keys (usable with {@linkcode encryptRsaOaep} / {@linkcode decryptRsaOaep}).
11
10
  */
12
- type RsaScheme = RsaSignatureScheme | "oaep";
11
+ export type RsaScheme = RsaSignatureScheme | "oaep";
13
12
  /** NIST elliptic curve for ECDSA keys. */
14
- type EcNamedCurve = "P-256" | "P-384" | "P-521";
13
+ export type EcNamedCurve = "P-256" | "P-384" | "P-521";
15
14
  /** RSA variant of {@linkcode KeyAlgorithmInput}. */
16
- interface RsaKeyAlgorithmInput {
15
+ export interface RsaKeyAlgorithmInput {
17
16
  /** Discriminant selecting RSA key generation. */
18
17
  readonly kind: "rsa";
19
18
  /** RSA modulus size in bits. Defaults to `2048`. */
@@ -27,21 +26,21 @@ interface RsaKeyAlgorithmInput {
27
26
  readonly scheme?: RsaScheme;
28
27
  }
29
28
  /** ECDSA variant of {@linkcode KeyAlgorithmInput}. */
30
- interface EcKeyAlgorithmInput {
29
+ export interface EcKeyAlgorithmInput {
31
30
  /** Discriminant selecting ECDSA key generation. */
32
31
  readonly kind: "ecdsa";
33
32
  /** NIST curve. Defaults to `'P-256'`. */
34
33
  readonly curve?: EcNamedCurve;
35
34
  }
36
35
  /** Ed25519 variant of {@linkcode KeyAlgorithmInput}. */
37
- interface Ed25519KeyAlgorithmInput {
36
+ export interface Ed25519KeyAlgorithmInput {
38
37
  /** Discriminant selecting Ed25519 key generation. */
39
38
  readonly kind: "ed25519";
40
39
  }
41
40
  /** Input for {@linkcode generateKeyPair}. Selects algorithm family and parameters. */
42
- type KeyAlgorithmInput = RsaKeyAlgorithmInput | EcKeyAlgorithmInput | Ed25519KeyAlgorithmInput;
41
+ export type KeyAlgorithmInput = RsaKeyAlgorithmInput | EcKeyAlgorithmInput | Ed25519KeyAlgorithmInput;
43
42
  /** Key pair with convenience export helpers. Returned by {@linkcode generateKeyPair}. */
44
- interface KeyPairMaterial {
43
+ export interface KeyPairMaterial {
45
44
  /** The WebCrypto public key (extractable, `verify` usage; `encrypt` for RSA-OAEP). */
46
45
  readonly publicKey: CryptoKey;
47
46
  /** The WebCrypto private key (extractable, `sign` usage; `decrypt` for RSA-OAEP). */
@@ -60,7 +59,7 @@ interface KeyPairMaterial {
60
59
  exportPrivateJwk(): Promise<JsonWebKey>;
61
60
  }
62
61
  /** RSA variant of {@linkcode PublicKeyImportInput} / {@linkcode PrivateKeyImportInput}. */
63
- interface ImportRsaKeyInput {
62
+ export interface ImportRsaKeyInput {
64
63
  /** Discriminant selecting RSA import. */
65
64
  readonly kind: "rsa";
66
65
  /** Hash algorithm. Defaults to `'SHA-256'`. */
@@ -72,26 +71,26 @@ interface ImportRsaKeyInput {
72
71
  readonly scheme?: RsaScheme;
73
72
  }
74
73
  /** ECDSA variant of {@linkcode PublicKeyImportInput} / {@linkcode PrivateKeyImportInput}. */
75
- interface ImportEcKeyInput {
74
+ export interface ImportEcKeyInput {
76
75
  /** Discriminant selecting ECDSA import. */
77
76
  readonly kind: "ecdsa";
78
77
  /** NIST curve the key belongs to. Required for EC import. */
79
78
  readonly curve: EcNamedCurve;
80
79
  }
81
80
  /** Ed25519 variant of {@linkcode PublicKeyImportInput} / {@linkcode PrivateKeyImportInput}. */
82
- interface ImportEd25519KeyInput {
81
+ export interface ImportEd25519KeyInput {
83
82
  /** Discriminant selecting Ed25519 import. */
84
83
  readonly kind: "ed25519";
85
84
  }
86
85
  /** Algorithm descriptor for public key import functions. */
87
- type PublicKeyImportInput = ImportRsaKeyInput | ImportEcKeyInput | ImportEd25519KeyInput;
86
+ export type PublicKeyImportInput = ImportRsaKeyInput | ImportEcKeyInput | ImportEd25519KeyInput;
88
87
  /** Algorithm descriptor for private key import functions. Same shape as {@linkcode PublicKeyImportInput}. */
89
- type PrivateKeyImportInput = PublicKeyImportInput;
88
+ export type PrivateKeyImportInput = PublicKeyImportInput;
90
89
  /** PBES2 encryption options for the encrypted PKCS#8 export/import functions. */
91
- interface EncryptedPkcs8Options {
90
+ export interface EncryptedPkcs8Options {
92
91
  /** Password fed to PBKDF2 for key derivation. */
93
92
  readonly password: string;
94
- /** PBKDF2 iteration count. Default: `100_000`. */
93
+ /** PBKDF2 iteration count, an integer from 1 to 4294967295. Default: `100_000`. */
95
94
  readonly iterations?: number;
96
95
  /** PBKDF2 salt. Default: 16 cryptographically random bytes. */
97
96
  readonly salt?: Uint8Array;
@@ -103,7 +102,7 @@ interface EncryptedPkcs8Options {
103
102
  readonly prf?: "HMAC-SHA-1" | "HMAC-SHA-256";
104
103
  }
105
104
  /** Options for OpenSSL-style `Proc-Type: 4,ENCRYPTED` PEM encryption (PKCS#1/SEC1). */
106
- interface LegacyPemEncryptionOptions {
105
+ export interface LegacyPemEncryptionOptions {
107
106
  /** Passphrase used to derive the encryption key. */
108
107
  readonly password: string;
109
108
  /** 16-byte initialization vector. Random when omitted. */
@@ -111,21 +110,28 @@ interface LegacyPemEncryptionOptions {
111
110
  /** AES-CBC cipher. Defaults to `'AES-256-CBC'`. */
112
111
  readonly cipher?: "AES-128-CBC" | "AES-192-CBC" | "AES-256-CBC";
113
112
  }
114
- /** Machine-readable failure reason for the `import*` key functions. */
115
- type ImportKeyErrorCode = "malformed";
113
+ /**
114
+ * Machine-readable failure reason for the `import*` key functions.
115
+ *
116
+ * `limit_exceeded` is an implementation limit: an OBJECT IDENTIFIER
117
+ * sub-identifier encoded in more than 64 octets, a tag number of 2^53 or more,
118
+ * or DER nested deeper than 64 levels.
119
+ */
120
+ export type ImportKeyErrorCode = Exclude<DecodeFailureCode, "unsupported">;
116
121
  /** Structured failure payload for key import. */
117
- interface ImportKeyFailure extends Micro509Error<ImportKeyErrorCode> {
122
+ export interface ImportKeyFailure extends Micro509Error<ImportKeyErrorCode> {
118
123
  /** Always `false` for failures. */
119
124
  readonly ok: false;
120
125
  }
121
126
  /**
122
127
  * Success-or-failure result returned by the public `import*` key functions.
123
128
  *
124
- * On failure, `code` is always `'malformed'`: structurally invalid input,
125
- * algorithm mismatches, and wrong-password decryption failures all surface
126
- * the same way (see the throwing `*OrThrow` variants for raw error messages).
129
+ * On failure, `code` is `'malformed'` for structurally invalid input,
130
+ * algorithm mismatches, and wrong-password decryption failures alike (see the
131
+ * throwing `*OrThrow` variants for raw error messages), and `'limit_exceeded'`
132
+ * for an implementation limit.
127
133
  */
128
- type ImportKeyResult<T> = {
134
+ export type ImportKeyResult<T> = {
129
135
  readonly ok: true;
130
136
  readonly value: T;
131
137
  } | ErrorResult<ImportKeyErrorCode, Record<never, never>, ImportKeyFailure>;
@@ -133,11 +139,16 @@ type ImportKeyResult<T> = {
133
139
  * Machine-readable failure reason for the `importEncrypted*` key functions.
134
140
  *
135
141
  * Distinguishes a wrong decryption password (`'invalid_password'`) from
136
- * structurally invalid input or algorithm mismatches (`'malformed'`).
137
- */
138
- type ImportEncryptedKeyErrorCode = "malformed" | "invalid_password";
142
+ * structurally invalid input or algorithm mismatches (`'malformed'`), from an
143
+ * encoded KDF iteration count above the caller's limit
144
+ * (`'kdf_iterations_exceeded'`), and from a decoding limit of micro509's own
145
+ * (`'limit_exceeded'`, see {@linkcode ImportKeyErrorCode}).
146
+ */
147
+ export type ImportEncryptedKeyErrorCode = ImportKeyErrorCode | "invalid_password" | "kdf_iterations_exceeded";
148
+ /** Options for the encrypted PKCS#8 import functions. */
149
+ export type ImportEncryptedKeyOptions = KdfLimitOptions;
139
150
  /** Structured failure payload for encrypted key import. */
140
- interface ImportEncryptedKeyFailure extends Micro509Error<ImportEncryptedKeyErrorCode> {
151
+ export interface ImportEncryptedKeyFailure extends Micro509Error<ImportEncryptedKeyErrorCode> {
141
152
  /** Always `false` for failures. */
142
153
  readonly ok: false;
143
154
  }
@@ -147,12 +158,12 @@ interface ImportEncryptedKeyFailure extends Micro509Error<ImportEncryptedKeyErro
147
158
  * On failure, `code` is `'invalid_password'` when decryption failed (wrong
148
159
  * password or corrupted ciphertext) and `'malformed'` for everything else.
149
160
  */
150
- type ImportEncryptedKeyResult<T> = {
161
+ export type ImportEncryptedKeyResult<T> = {
151
162
  readonly ok: true;
152
163
  readonly value: T;
153
164
  } | ErrorResult<ImportEncryptedKeyErrorCode, Record<never, never>, ImportEncryptedKeyFailure>;
154
165
  /** Options shared by {@linkcode encryptRsaOaep} and {@linkcode decryptRsaOaep}. */
155
- interface RsaOaepOptions {
166
+ export interface RsaOaepOptions {
156
167
  /**
157
168
  * Optional OAEP label bound to the ciphertext. Not encrypted, but decryption
158
169
  * fails unless the exact same label is presented. Default: empty.
@@ -166,14 +177,14 @@ interface RsaOaepOptions {
166
177
  * usage; `'message_too_long'` when the plaintext exceeds the OAEP capacity of
167
178
  * the key (modulus bytes − 2 × hash bytes − 2).
168
179
  */
169
- type EncryptRsaOaepErrorCode = "invalid_key" | "message_too_long";
180
+ export type EncryptRsaOaepErrorCode = "invalid_key" | "message_too_long";
170
181
  /** Structured failure payload for {@linkcode encryptRsaOaep}. */
171
- interface EncryptRsaOaepFailure extends Micro509Error<EncryptRsaOaepErrorCode> {
182
+ export interface EncryptRsaOaepFailure extends Micro509Error<EncryptRsaOaepErrorCode> {
172
183
  /** Always `false` for failures. */
173
184
  readonly ok: false;
174
185
  }
175
186
  /** Success-or-failure result returned by {@linkcode encryptRsaOaep}. */
176
- type EncryptRsaOaepResult = {
187
+ export type EncryptRsaOaepResult = {
177
188
  readonly ok: true;
178
189
  readonly value: Uint8Array;
179
190
  } | ErrorResult<EncryptRsaOaepErrorCode, Record<never, never>, EncryptRsaOaepFailure>;
@@ -185,14 +196,14 @@ type EncryptRsaOaepResult = {
185
196
  * wrong label, tampered or truncated ciphertext) — OAEP deliberately does not
186
197
  * reveal which.
187
198
  */
188
- type DecryptRsaOaepErrorCode = "invalid_key" | "decryption_failed";
199
+ export type DecryptRsaOaepErrorCode = "invalid_key" | "decryption_failed";
189
200
  /** Structured failure payload for {@linkcode decryptRsaOaep}. */
190
- interface DecryptRsaOaepFailure extends Micro509Error<DecryptRsaOaepErrorCode> {
201
+ export interface DecryptRsaOaepFailure extends Micro509Error<DecryptRsaOaepErrorCode> {
191
202
  /** Always `false` for failures. */
192
203
  readonly ok: false;
193
204
  }
194
205
  /** Success-or-failure result returned by {@linkcode decryptRsaOaep}. */
195
- type DecryptRsaOaepResult = {
206
+ export type DecryptRsaOaepResult = {
196
207
  readonly ok: true;
197
208
  readonly value: Uint8Array;
198
209
  } | ErrorResult<DecryptRsaOaepErrorCode, Record<never, never>, DecryptRsaOaepFailure>;
@@ -212,14 +223,14 @@ type DecryptRsaOaepResult = {
212
223
  * const pem = await keys.exportPkcs8Pem();
213
224
  * ```
214
225
  */
215
- declare function generateKeyPair(algorithm?: KeyAlgorithmInput): Promise<KeyPairMaterial>;
226
+ export declare function generateKeyPair(algorithm?: KeyAlgorithmInput): Promise<KeyPairMaterial>;
216
227
  /**
217
228
  * Export a public key as DER-encoded SubjectPublicKeyInfo.
218
229
  *
219
230
  * @see {@linkcode importSpkiDer} for the inverse operation
220
231
  * @see {@linkcode exportSpkiPem} for PEM output
221
232
  */
222
- declare function exportSpkiDer(publicKey: CryptoKey): Promise<Uint8Array>;
233
+ export declare function exportSpkiDer(publicKey: CryptoKey): Promise<Uint8Array>;
223
234
  /**
224
235
  * Export a private key as DER-encoded PKCS#8 PrivateKeyInfo.
225
236
  *
@@ -227,7 +238,7 @@ declare function exportSpkiDer(publicKey: CryptoKey): Promise<Uint8Array>;
227
238
  * @see {@linkcode exportPkcs8Pem} for PEM output
228
239
  * @see {@linkcode exportEncryptedPkcs8Der} for password-protected export
229
240
  */
230
- declare function exportPkcs8Der(privateKey: CryptoKey): Promise<Uint8Array>;
241
+ export declare function exportPkcs8Der(privateKey: CryptoKey): Promise<Uint8Array>;
231
242
  /**
232
243
  * Export a public key as a JSON Web Key.
233
244
  *
@@ -237,14 +248,14 @@ declare function exportPkcs8Der(privateKey: CryptoKey): Promise<Uint8Array>;
237
248
  * const jwk = await exportPublicJwk(keys.publicKey);
238
249
  * ```
239
250
  */
240
- declare function exportPublicJwk(publicKey: CryptoKey): Promise<JsonWebKey>;
251
+ export declare function exportPublicJwk(publicKey: CryptoKey): Promise<JsonWebKey>;
241
252
  /**
242
253
  * Export a private key as a JSON Web Key.
243
254
  *
244
255
  * @see {@linkcode importPrivateJwk} for the inverse operation
245
256
  * @see {@linkcode exportPublicJwk} for public key export
246
257
  */
247
- declare function exportPrivateJwk(privateKey: CryptoKey): Promise<JsonWebKey>;
258
+ export declare function exportPrivateJwk(privateKey: CryptoKey): Promise<JsonWebKey>;
248
259
  /**
249
260
  * Export a private key as PEM-encoded PKCS#8 PrivateKeyInfo.
250
261
  *
@@ -260,7 +271,7 @@ declare function exportPrivateJwk(privateKey: CryptoKey): Promise<JsonWebKey>;
260
271
  * @see {@linkcode importPkcs8Pem} for the inverse operation
261
272
  * @see {@linkcode exportEncryptedPkcs8Pem} for password-protected export
262
273
  */
263
- declare function exportPkcs8Pem(privateKey: CryptoKey): Promise<string>;
274
+ export declare function exportPkcs8Pem(privateKey: CryptoKey): Promise<string>;
264
275
  /**
265
276
  * Export a private key as DER-encoded PBES2-encrypted PKCS#8 EncryptedPrivateKeyInfo.
266
277
  *
@@ -269,10 +280,12 @@ declare function exportPkcs8Pem(privateKey: CryptoKey): Promise<string>;
269
280
  * @param privateKey - The private key to export
270
281
  * @param options - Encryption options including password and optional algorithm settings
271
282
  *
283
+ * @throws {RangeError} If `options.iterations` is not an integer from 1 to 4294967295
284
+ *
272
285
  * @see {@linkcode importEncryptedPkcs8Der} for the inverse operation
273
286
  * @see {@linkcode exportEncryptedPkcs8Pem} for PEM output
274
287
  */
275
- declare function exportEncryptedPkcs8Der(privateKey: CryptoKey, options: EncryptedPkcs8Options): Promise<Uint8Array>;
288
+ export declare function exportEncryptedPkcs8Der(privateKey: CryptoKey, options: EncryptedPkcs8Options): Promise<Uint8Array>;
276
289
  /**
277
290
  * Export a private key as PEM-encoded PBES2-encrypted PKCS#8 EncryptedPrivateKeyInfo.
278
291
  *
@@ -287,7 +300,7 @@ declare function exportEncryptedPkcs8Der(privateKey: CryptoKey, options: Encrypt
287
300
  *
288
301
  * @see {@linkcode importEncryptedPkcs8Pem} for the inverse operation
289
302
  */
290
- declare function exportEncryptedPkcs8Pem(privateKey: CryptoKey, options: EncryptedPkcs8Options): Promise<string>;
303
+ export declare function exportEncryptedPkcs8Pem(privateKey: CryptoKey, options: EncryptedPkcs8Options): Promise<string>;
291
304
  /**
292
305
  * Export an RSA private key as DER-encoded PKCS#1 RSAPrivateKey.
293
306
  *
@@ -299,7 +312,7 @@ declare function exportEncryptedPkcs8Pem(privateKey: CryptoKey, options: Encrypt
299
312
  * @see {@linkcode importPkcs1Der} for the inverse operation
300
313
  * @see {@linkcode exportPkcs1Pem} for PEM output
301
314
  */
302
- declare function exportPkcs1Der(privateKey: CryptoKey): Promise<Uint8Array>;
315
+ export declare function exportPkcs1Der(privateKey: CryptoKey): Promise<Uint8Array>;
303
316
  /**
304
317
  * Export an RSA private key as PEM-encoded PKCS#1 RSAPrivateKey.
305
318
  *
@@ -308,7 +321,7 @@ declare function exportPkcs1Der(privateKey: CryptoKey): Promise<Uint8Array>;
308
321
  * @see {@linkcode importPkcs1Pem} for the inverse operation
309
322
  * @see {@linkcode exportEncryptedPkcs1Pem} for password-protected export
310
323
  */
311
- declare function exportPkcs1Pem(privateKey: CryptoKey): Promise<string>;
324
+ export declare function exportPkcs1Pem(privateKey: CryptoKey): Promise<string>;
312
325
  /**
313
326
  * Export an RSA private key as legacy `Proc-Type: 4,ENCRYPTED` PEM (PKCS#1).
314
327
  *
@@ -319,7 +332,7 @@ declare function exportPkcs1Pem(privateKey: CryptoKey): Promise<string>;
319
332
  *
320
333
  * @see {@linkcode importEncryptedPkcs1Pem} for the inverse operation
321
334
  */
322
- declare function exportEncryptedPkcs1Pem(privateKey: CryptoKey, options: LegacyPemEncryptionOptions): Promise<string>;
335
+ export declare function exportEncryptedPkcs1Pem(privateKey: CryptoKey, options: LegacyPemEncryptionOptions): Promise<string>;
323
336
  /**
324
337
  * Export an EC private key as DER-encoded SEC 1 ECPrivateKey.
325
338
  *
@@ -335,7 +348,7 @@ declare function exportEncryptedPkcs1Pem(privateKey: CryptoKey, options: LegacyP
335
348
  * @see {@linkcode importSec1Der} for the inverse operation
336
349
  * @see {@linkcode exportSec1Pem} for PEM output
337
350
  */
338
- declare function exportSec1Der(privateKey: CryptoKey): Promise<Uint8Array>;
351
+ export declare function exportSec1Der(privateKey: CryptoKey): Promise<Uint8Array>;
339
352
  /**
340
353
  * Export an EC private key as PEM-encoded SEC 1 ECPrivateKey.
341
354
  *
@@ -344,7 +357,7 @@ declare function exportSec1Der(privateKey: CryptoKey): Promise<Uint8Array>;
344
357
  * @see {@linkcode importSec1Pem} for the inverse operation
345
358
  * @see {@linkcode exportEncryptedSec1Pem} for password-protected export
346
359
  */
347
- declare function exportSec1Pem(privateKey: CryptoKey): Promise<string>;
360
+ export declare function exportSec1Pem(privateKey: CryptoKey): Promise<string>;
348
361
  /**
349
362
  * Export an EC private key as legacy `Proc-Type: 4,ENCRYPTED` PEM (SEC 1).
350
363
  *
@@ -355,7 +368,7 @@ declare function exportSec1Pem(privateKey: CryptoKey): Promise<string>;
355
368
  *
356
369
  * @see {@linkcode importEncryptedSec1Pem} for the inverse operation
357
370
  */
358
- declare function exportEncryptedSec1Pem(privateKey: CryptoKey, options: LegacyPemEncryptionOptions): Promise<string>;
371
+ export declare function exportEncryptedSec1Pem(privateKey: CryptoKey, options: LegacyPemEncryptionOptions): Promise<string>;
359
372
  /**
360
373
  * Export a public key as PEM-encoded SubjectPublicKeyInfo.
361
374
  *
@@ -365,7 +378,7 @@ declare function exportEncryptedSec1Pem(privateKey: CryptoKey, options: LegacyPe
365
378
  * const pem = await exportSpkiPem(keys.publicKey);
366
379
  * ```
367
380
  */
368
- declare function exportSpkiPem(publicKey: CryptoKey): Promise<string>;
381
+ export declare function exportSpkiPem(publicKey: CryptoKey): Promise<string>;
369
382
  /**
370
383
  * Derive the matching public key from an imported (or generated) private key.
371
384
  *
@@ -396,7 +409,7 @@ declare function exportSpkiPem(publicKey: CryptoKey): Promise<string>;
396
409
  *
397
410
  * @see {@linkcode exportSpkiDer} for exporting the derived key
398
411
  */
399
- declare function derivePublicKey(privateKey: CryptoKey): Promise<CryptoKey>;
412
+ export declare function derivePublicKey(privateKey: CryptoKey): Promise<CryptoKey>;
400
413
  /**
401
414
  * Export a key as raw base64 (no PEM headers).
402
415
  *
@@ -408,7 +421,7 @@ declare function derivePublicKey(privateKey: CryptoKey): Promise<CryptoKey>;
408
421
  * @see {@linkcode importSpkiBase64} for public key import
409
422
  * @see {@linkcode importPkcs8Base64} for private key import
410
423
  */
411
- declare function exportBinaryBase64(key: CryptoKey): Promise<string>;
424
+ export declare function exportBinaryBase64(key: CryptoKey): Promise<string>;
412
425
  /**
413
426
  * Import a public key from DER-encoded SubjectPublicKeyInfo.
414
427
  *
@@ -426,13 +439,13 @@ declare function exportBinaryBase64(key: CryptoKey): Promise<string>;
426
439
  * @see {@linkcode exportSpkiDer} for the inverse operation
427
440
  * @see {@linkcode importSpkiPem} for PEM input
428
441
  */
429
- declare function importSpkiDerOrThrow(der: Uint8Array, algorithm?: PublicKeyImportInput): Promise<CryptoKey>;
442
+ export declare function importSpkiDerOrThrow(der: Uint8Array, algorithm?: PublicKeyImportInput): Promise<CryptoKey>;
430
443
  /**
431
444
  * Import a public key from DER-encoded SubjectPublicKeyInfo.
432
445
  *
433
446
  * @see `importSpkiDerOrThrow` for the throwing variant
434
447
  */
435
- declare function importSpkiDer(der: Uint8Array, algorithm?: PublicKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
448
+ export declare function importSpkiDer(der: Uint8Array, algorithm?: PublicKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
436
449
  /**
437
450
  * Import a public key from PEM-encoded SubjectPublicKeyInfo.
438
451
  *
@@ -446,26 +459,26 @@ declare function importSpkiDer(der: Uint8Array, algorithm?: PublicKeyImportInput
446
459
  *
447
460
  * @see {@linkcode exportSpkiPem} for the inverse operation
448
461
  */
449
- declare function importSpkiPemOrThrow(pem: string, algorithm?: PublicKeyImportInput): Promise<CryptoKey>;
462
+ export declare function importSpkiPemOrThrow(pem: string, algorithm?: PublicKeyImportInput): Promise<CryptoKey>;
450
463
  /**
451
464
  * Import a public key from PEM-encoded SubjectPublicKeyInfo.
452
465
  *
453
466
  * @see `importSpkiPemOrThrow` for the throwing variant
454
467
  */
455
- declare function importSpkiPem(pem: string, algorithm?: PublicKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
468
+ export declare function importSpkiPem(pem: string, algorithm?: PublicKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
456
469
  /**
457
470
  * Import a public key from base64-encoded SubjectPublicKeyInfo (no PEM headers).
458
471
  *
459
472
  * @see {@linkcode exportBinaryBase64} for the inverse operation
460
473
  * @see {@linkcode importSpkiPem} for PEM input with headers
461
474
  */
462
- declare function importSpkiBase64OrThrow(base64: string, algorithm?: PublicKeyImportInput): Promise<CryptoKey>;
475
+ export declare function importSpkiBase64OrThrow(base64: string, algorithm?: PublicKeyImportInput): Promise<CryptoKey>;
463
476
  /**
464
477
  * Import a public key from base64-encoded SubjectPublicKeyInfo (no PEM headers).
465
478
  *
466
479
  * @see `importSpkiBase64OrThrow` for the throwing variant
467
480
  */
468
- declare function importSpkiBase64(base64: string, algorithm?: PublicKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
481
+ export declare function importSpkiBase64(base64: string, algorithm?: PublicKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
469
482
  /**
470
483
  * Import a private key from DER-encoded PKCS#8 PrivateKeyInfo.
471
484
  *
@@ -490,13 +503,13 @@ declare function importSpkiBase64(base64: string, algorithm?: PublicKeyImportInp
490
503
  * @see {@linkcode importPkcs8Pem} for PEM input
491
504
  * @see {@linkcode importEncryptedPkcs8Der} for encrypted PKCS#8
492
505
  */
493
- declare function importPkcs8DerOrThrow(der: Uint8Array, algorithm?: PrivateKeyImportInput): Promise<CryptoKey>;
506
+ export declare function importPkcs8DerOrThrow(der: Uint8Array, algorithm?: PrivateKeyImportInput): Promise<CryptoKey>;
494
507
  /**
495
508
  * Import a private key from DER-encoded PKCS#8 PrivateKeyInfo.
496
509
  *
497
510
  * @see `importPkcs8DerOrThrow` for the throwing variant
498
511
  */
499
- declare function importPkcs8Der(der: Uint8Array, algorithm?: PrivateKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
512
+ export declare function importPkcs8Der(der: Uint8Array, algorithm?: PrivateKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
500
513
  /**
501
514
  * Import a private key from PEM-encoded PKCS#8 PrivateKeyInfo.
502
515
  *
@@ -509,13 +522,13 @@ declare function importPkcs8Der(der: Uint8Array, algorithm?: PrivateKeyImportInp
509
522
  * const inferred = await importPkcs8PemOrThrow(pemString);
510
523
  * ```
511
524
  */
512
- declare function importPkcs8PemOrThrow(pem: string, algorithm?: PrivateKeyImportInput): Promise<CryptoKey>;
525
+ export declare function importPkcs8PemOrThrow(pem: string, algorithm?: PrivateKeyImportInput): Promise<CryptoKey>;
513
526
  /**
514
527
  * Import a private key from PEM-encoded PKCS#8 PrivateKeyInfo.
515
528
  *
516
529
  * @see `importPkcs8PemOrThrow` for the throwing variant
517
530
  */
518
- declare function importPkcs8Pem(pem: string, algorithm?: PrivateKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
531
+ export declare function importPkcs8Pem(pem: string, algorithm?: PrivateKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
519
532
  /**
520
533
  * Import a private key from DER-encoded PBES2-encrypted PKCS#8 EncryptedPrivateKeyInfo.
521
534
  *
@@ -527,25 +540,28 @@ declare function importPkcs8Pem(pem: string, algorithm?: PrivateKeyImportInput):
527
540
  * @param der - DER-encoded EncryptedPrivateKeyInfo bytes
528
541
  * @param password - Decryption password
529
542
  * @param algorithm - Optional expected algorithm; must match decrypted key when given
543
+ * @param options - KDF work-factor limit
530
544
  *
531
- * @throws {Error} If DER is malformed, password is wrong, or algorithm doesn't match
545
+ * @throws {Error} If DER is malformed, password is wrong, the PBKDF2 iteration
546
+ * count exceeds `options.maxKdfIterations`, or algorithm doesn't match
532
547
  *
533
548
  * @see {@linkcode exportEncryptedPkcs8Der} for the inverse operation
534
549
  */
535
- declare function importEncryptedPkcs8DerOrThrow(der: Uint8Array, password: string, algorithm?: PrivateKeyImportInput): Promise<CryptoKey>;
550
+ export declare function importEncryptedPkcs8DerOrThrow(der: Uint8Array, password: string, algorithm?: PrivateKeyImportInput, options?: ImportEncryptedKeyOptions): Promise<CryptoKey>;
536
551
  /**
537
552
  * Reads the PBES2 encryption parameters of a DER PKCS#8
538
553
  * `EncryptedPrivateKeyInfo` (RFC 5958 §3) without the password: PBKDF2
539
554
  * iteration count, salt, and PRF, plus the AES-CBC variant and IV.
540
- * Throws on malformed DER or a non-PBES2 encryption algorithm.
555
+ * Throws on malformed DER, a non-PBES2 encryption algorithm, or a PBKDF2
556
+ * iteration count outside 1 to 4294967295.
541
557
  */
542
- declare function inspectEncryptedPkcs8Der(der: Uint8Array): Pbes2Parameters;
558
+ export declare function inspectEncryptedPkcs8Der(der: Uint8Array): Pbes2Parameters;
543
559
  /**
544
560
  * Import a private key from DER-encoded PBES2-encrypted PKCS#8 EncryptedPrivateKeyInfo.
545
561
  *
546
562
  * @see `importEncryptedPkcs8DerOrThrow` for the throwing variant
547
563
  */
548
- declare function importEncryptedPkcs8Der(der: Uint8Array, password: string, algorithm?: PrivateKeyImportInput): Promise<ImportEncryptedKeyResult<CryptoKey>>;
564
+ export declare function importEncryptedPkcs8Der(der: Uint8Array, password: string, algorithm?: PrivateKeyImportInput, options?: ImportEncryptedKeyOptions): Promise<ImportEncryptedKeyResult<CryptoKey>>;
549
565
  /**
550
566
  * Import a private key from PEM-encoded PBES2-encrypted PKCS#8 EncryptedPrivateKeyInfo.
551
567
  *
@@ -558,13 +574,13 @@ declare function importEncryptedPkcs8Der(der: Uint8Array, password: string, algo
558
574
  * const inferred = await importEncryptedPkcs8PemOrThrow(pem, 'secret');
559
575
  * ```
560
576
  */
561
- declare function importEncryptedPkcs8PemOrThrow(pem: string, password: string, algorithm?: PrivateKeyImportInput): Promise<CryptoKey>;
577
+ export declare function importEncryptedPkcs8PemOrThrow(pem: string, password: string, algorithm?: PrivateKeyImportInput, options?: ImportEncryptedKeyOptions): Promise<CryptoKey>;
562
578
  /**
563
579
  * Import a private key from PEM-encoded PBES2-encrypted PKCS#8 EncryptedPrivateKeyInfo.
564
580
  *
565
581
  * @see `importEncryptedPkcs8PemOrThrow` for the throwing variant
566
582
  */
567
- declare function importEncryptedPkcs8Pem(pem: string, password: string, algorithm?: PrivateKeyImportInput): Promise<ImportEncryptedKeyResult<CryptoKey>>;
583
+ export declare function importEncryptedPkcs8Pem(pem: string, password: string, algorithm?: PrivateKeyImportInput, options?: ImportEncryptedKeyOptions): Promise<ImportEncryptedKeyResult<CryptoKey>>;
568
584
  /**
569
585
  * Import an RSA private key from DER-encoded PKCS#1 RSAPrivateKey.
570
586
  *
@@ -573,13 +589,13 @@ declare function importEncryptedPkcs8Pem(pem: string, password: string, algorith
573
589
  * @see {@linkcode exportPkcs1Der} for the inverse operation
574
590
  * @see {@linkcode importPkcs1Pem} for PEM input
575
591
  */
576
- declare function importPkcs1DerOrThrow(der: Uint8Array, algorithm?: ImportRsaKeyInput): Promise<CryptoKey>;
592
+ export declare function importPkcs1DerOrThrow(der: Uint8Array, algorithm?: ImportRsaKeyInput): Promise<CryptoKey>;
577
593
  /**
578
594
  * Import an RSA private key from DER-encoded PKCS#1 RSAPrivateKey.
579
595
  *
580
596
  * @see `importPkcs1DerOrThrow` for the throwing variant
581
597
  */
582
- declare function importPkcs1Der(der: Uint8Array, algorithm?: ImportRsaKeyInput): Promise<ImportKeyResult<CryptoKey>>;
598
+ export declare function importPkcs1Der(der: Uint8Array, algorithm?: ImportRsaKeyInput): Promise<ImportKeyResult<CryptoKey>>;
583
599
  /**
584
600
  * Import an RSA private key from PEM-encoded PKCS#1 RSAPrivateKey.
585
601
  *
@@ -588,13 +604,13 @@ declare function importPkcs1Der(der: Uint8Array, algorithm?: ImportRsaKeyInput):
588
604
  * @see {@linkcode exportPkcs1Pem} for the inverse operation
589
605
  * @see {@linkcode importEncryptedPkcs1Pem} for encrypted PEM
590
606
  */
591
- declare function importPkcs1PemOrThrow(pem: string, algorithm?: ImportRsaKeyInput): Promise<CryptoKey>;
607
+ export declare function importPkcs1PemOrThrow(pem: string, algorithm?: ImportRsaKeyInput): Promise<CryptoKey>;
592
608
  /**
593
609
  * Import an RSA private key from PEM-encoded PKCS#1 RSAPrivateKey.
594
610
  *
595
611
  * @see `importPkcs1PemOrThrow` for the throwing variant
596
612
  */
597
- declare function importPkcs1Pem(pem: string, algorithm?: ImportRsaKeyInput): Promise<ImportKeyResult<CryptoKey>>;
613
+ export declare function importPkcs1Pem(pem: string, algorithm?: ImportRsaKeyInput): Promise<ImportKeyResult<CryptoKey>>;
598
614
  /**
599
615
  * Import an RSA private key from legacy `Proc-Type: 4,ENCRYPTED` PEM (PKCS#1).
600
616
  *
@@ -603,26 +619,26 @@ declare function importPkcs1Pem(pem: string, algorithm?: ImportRsaKeyInput): Pro
603
619
  * @see {@linkcode exportEncryptedPkcs1Pem} for the inverse operation
604
620
  * @see {@linkcode importEncryptedPkcs8Pem} for modern PBES2 encryption
605
621
  */
606
- declare function importEncryptedPkcs1PemOrThrow(pem: string, password: string, algorithm?: ImportRsaKeyInput): Promise<CryptoKey>;
622
+ export declare function importEncryptedPkcs1PemOrThrow(pem: string, password: string, algorithm?: ImportRsaKeyInput): Promise<CryptoKey>;
607
623
  /**
608
624
  * Import an RSA private key from legacy `Proc-Type: 4,ENCRYPTED` PEM (PKCS#1).
609
625
  *
610
626
  * @see `importEncryptedPkcs1PemOrThrow` for the throwing variant
611
627
  */
612
- declare function importEncryptedPkcs1Pem(pem: string, password: string, algorithm?: ImportRsaKeyInput): Promise<ImportEncryptedKeyResult<CryptoKey>>;
628
+ export declare function importEncryptedPkcs1Pem(pem: string, password: string, algorithm?: ImportRsaKeyInput): Promise<ImportEncryptedKeyResult<CryptoKey>>;
613
629
  /**
614
630
  * Import a private key from base64-encoded PKCS#8 PrivateKeyInfo (no PEM headers).
615
631
  *
616
632
  * @see {@linkcode exportBinaryBase64} for the inverse operation
617
633
  * @see {@linkcode importPkcs8Pem} for PEM input with headers
618
634
  */
619
- declare function importPkcs8Base64OrThrow(base64: string, algorithm?: PrivateKeyImportInput): Promise<CryptoKey>;
635
+ export declare function importPkcs8Base64OrThrow(base64: string, algorithm?: PrivateKeyImportInput): Promise<CryptoKey>;
620
636
  /**
621
637
  * Import a private key from base64-encoded PKCS#8 PrivateKeyInfo (no PEM headers).
622
638
  *
623
639
  * @see `importPkcs8Base64OrThrow` for the throwing variant
624
640
  */
625
- declare function importPkcs8Base64(base64: string, algorithm?: PrivateKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
641
+ export declare function importPkcs8Base64(base64: string, algorithm?: PrivateKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
626
642
  /**
627
643
  * Import an EC private key from DER-encoded SEC 1 ECPrivateKey.
628
644
  *
@@ -640,13 +656,13 @@ declare function importPkcs8Base64(base64: string, algorithm?: PrivateKeyImportI
640
656
  * @see {@linkcode exportSec1Der} for the inverse operation
641
657
  * @see {@linkcode importSec1Pem} for PEM input
642
658
  */
643
- declare function importSec1DerOrThrow(der: Uint8Array, algorithm?: ImportEcKeyInput): Promise<CryptoKey>;
659
+ export declare function importSec1DerOrThrow(der: Uint8Array, algorithm?: ImportEcKeyInput): Promise<CryptoKey>;
644
660
  /**
645
661
  * Import an EC private key from DER-encoded SEC 1 ECPrivateKey.
646
662
  *
647
663
  * @see `importSec1DerOrThrow` for the throwing variant
648
664
  */
649
- declare function importSec1Der(der: Uint8Array, algorithm?: ImportEcKeyInput): Promise<ImportKeyResult<CryptoKey>>;
665
+ export declare function importSec1Der(der: Uint8Array, algorithm?: ImportEcKeyInput): Promise<ImportKeyResult<CryptoKey>>;
650
666
  /**
651
667
  * Import an EC private key from PEM-encoded SEC 1 ECPrivateKey.
652
668
  *
@@ -657,13 +673,13 @@ declare function importSec1Der(der: Uint8Array, algorithm?: ImportEcKeyInput): P
657
673
  * @see {@linkcode exportSec1Pem} for the inverse operation
658
674
  * @see {@linkcode importEncryptedSec1Pem} for encrypted PEM
659
675
  */
660
- declare function importSec1PemOrThrow(pem: string, algorithm?: ImportEcKeyInput): Promise<CryptoKey>;
676
+ export declare function importSec1PemOrThrow(pem: string, algorithm?: ImportEcKeyInput): Promise<CryptoKey>;
661
677
  /**
662
678
  * Import an EC private key from PEM-encoded SEC 1 ECPrivateKey.
663
679
  *
664
680
  * @see `importSec1PemOrThrow` for the throwing variant
665
681
  */
666
- declare function importSec1Pem(pem: string, algorithm?: ImportEcKeyInput): Promise<ImportKeyResult<CryptoKey>>;
682
+ export declare function importSec1Pem(pem: string, algorithm?: ImportEcKeyInput): Promise<ImportKeyResult<CryptoKey>>;
667
683
  /**
668
684
  * Import an EC private key from legacy `Proc-Type: 4,ENCRYPTED` PEM (SEC 1).
669
685
  *
@@ -672,13 +688,13 @@ declare function importSec1Pem(pem: string, algorithm?: ImportEcKeyInput): Promi
672
688
  * @see {@linkcode exportEncryptedSec1Pem} for the inverse operation
673
689
  * @see {@linkcode importEncryptedPkcs8Pem} for modern PBES2 encryption
674
690
  */
675
- declare function importEncryptedSec1PemOrThrow(pem: string, password: string, algorithm?: ImportEcKeyInput): Promise<CryptoKey>;
691
+ export declare function importEncryptedSec1PemOrThrow(pem: string, password: string, algorithm?: ImportEcKeyInput): Promise<CryptoKey>;
676
692
  /**
677
693
  * Import an EC private key from legacy `Proc-Type: 4,ENCRYPTED` PEM (SEC 1).
678
694
  *
679
695
  * @see `importEncryptedSec1PemOrThrow` for the throwing variant
680
696
  */
681
- declare function importEncryptedSec1Pem(pem: string, password: string, algorithm?: ImportEcKeyInput): Promise<ImportEncryptedKeyResult<CryptoKey>>;
697
+ export declare function importEncryptedSec1Pem(pem: string, password: string, algorithm?: ImportEcKeyInput): Promise<ImportEncryptedKeyResult<CryptoKey>>;
682
698
  /**
683
699
  * Import a public verification key from a JSON Web Key.
684
700
  *
@@ -695,13 +711,13 @@ declare function importEncryptedSec1Pem(pem: string, password: string, algorithm
695
711
  *
696
712
  * @see {@linkcode exportPublicJwk} for the inverse operation
697
713
  */
698
- declare function importPublicJwkOrThrow(jwk: JsonWebKey, algorithm?: PublicKeyImportInput): Promise<CryptoKey>;
714
+ export declare function importPublicJwkOrThrow(jwk: JsonWebKey, algorithm?: PublicKeyImportInput): Promise<CryptoKey>;
699
715
  /**
700
716
  * Import a public verification key from a JSON Web Key.
701
717
  *
702
718
  * @see `importPublicJwkOrThrow` for the throwing variant
703
719
  */
704
- declare function importPublicJwk(jwk: JsonWebKey, algorithm?: PublicKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
720
+ export declare function importPublicJwk(jwk: JsonWebKey, algorithm?: PublicKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
705
721
  /**
706
722
  * Import a private signing key from a JSON Web Key.
707
723
  *
@@ -724,13 +740,13 @@ declare function importPublicJwk(jwk: JsonWebKey, algorithm?: PublicKeyImportInp
724
740
  *
725
741
  * @see {@linkcode exportPrivateJwk} for the inverse operation
726
742
  */
727
- declare function importPrivateJwkOrThrow(jwk: JsonWebKey, algorithm?: PrivateKeyImportInput): Promise<CryptoKey>;
743
+ export declare function importPrivateJwkOrThrow(jwk: JsonWebKey, algorithm?: PrivateKeyImportInput): Promise<CryptoKey>;
728
744
  /**
729
745
  * Import a private signing key from a JSON Web Key.
730
746
  *
731
747
  * @see `importPrivateJwkOrThrow` for the throwing variant
732
748
  */
733
- declare function importPrivateJwk(jwk: JsonWebKey, algorithm?: PrivateKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
749
+ export declare function importPrivateJwk(jwk: JsonWebKey, algorithm?: PrivateKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
734
750
  /**
735
751
  * Encrypt a small message with an RSA-OAEP public key.
736
752
  *
@@ -758,7 +774,7 @@ declare function importPrivateJwk(jwk: JsonWebKey, algorithm?: PrivateKeyImportI
758
774
  * @see {@linkcode decryptRsaOaepOrThrow} for the inverse operation
759
775
  * @see `encryptRsaOaep` for the Result-returning variant
760
776
  */
761
- declare function encryptRsaOaepOrThrow(publicKey: CryptoKey, plaintext: Uint8Array, options?: RsaOaepOptions): Promise<Uint8Array>;
777
+ export declare function encryptRsaOaepOrThrow(publicKey: CryptoKey, plaintext: Uint8Array, options?: RsaOaepOptions): Promise<Uint8Array>;
762
778
  /**
763
779
  * Encrypt a small message with an RSA-OAEP public key.
764
780
  *
@@ -775,7 +791,7 @@ declare function encryptRsaOaepOrThrow(publicKey: CryptoKey, plaintext: Uint8Arr
775
791
  *
776
792
  * @see `encryptRsaOaepOrThrow` for the throwing variant
777
793
  */
778
- declare function encryptRsaOaep(publicKey: CryptoKey, plaintext: Uint8Array, options?: RsaOaepOptions): Promise<EncryptRsaOaepResult>;
794
+ export declare function encryptRsaOaep(publicKey: CryptoKey, plaintext: Uint8Array, options?: RsaOaepOptions): Promise<EncryptRsaOaepResult>;
779
795
  /**
780
796
  * Decrypt an RSA-OAEP ciphertext with the matching private key.
781
797
  *
@@ -798,7 +814,7 @@ declare function encryptRsaOaep(publicKey: CryptoKey, plaintext: Uint8Array, opt
798
814
  * @see {@linkcode encryptRsaOaepOrThrow} for the inverse operation
799
815
  * @see `decryptRsaOaep` for the Result-returning variant
800
816
  */
801
- declare function decryptRsaOaepOrThrow(privateKey: CryptoKey, ciphertext: Uint8Array, options?: RsaOaepOptions): Promise<Uint8Array>;
817
+ export declare function decryptRsaOaepOrThrow(privateKey: CryptoKey, ciphertext: Uint8Array, options?: RsaOaepOptions): Promise<Uint8Array>;
802
818
  /**
803
819
  * Decrypt an RSA-OAEP ciphertext with the matching private key.
804
820
  *
@@ -814,7 +830,6 @@ declare function decryptRsaOaepOrThrow(privateKey: CryptoKey, ciphertext: Uint8A
814
830
  *
815
831
  * @see `decryptRsaOaepOrThrow` for the throwing variant
816
832
  */
817
- declare function decryptRsaOaep(privateKey: CryptoKey, ciphertext: Uint8Array, options?: RsaOaepOptions): Promise<DecryptRsaOaepResult>;
818
- //#endregion
819
- export { DecryptRsaOaepErrorCode, DecryptRsaOaepFailure, DecryptRsaOaepResult, EcKeyAlgorithmInput, EcNamedCurve, Ed25519KeyAlgorithmInput, EncryptRsaOaepErrorCode, EncryptRsaOaepFailure, EncryptRsaOaepResult, EncryptedPkcs8Options, ImportEcKeyInput, ImportEd25519KeyInput, ImportEncryptedKeyErrorCode, ImportEncryptedKeyFailure, ImportEncryptedKeyResult, ImportKeyErrorCode, ImportKeyFailure, ImportKeyResult, ImportRsaKeyInput, KeyAlgorithmInput, KeyPairMaterial, LegacyPemEncryptionOptions, type Pbes2EncryptionOptions, type Pbes2EncryptionScheme, type Pbes2Parameters, type Pbes2Prf, PrivateKeyImportInput, PublicKeyImportInput, RsaHash, RsaKeyAlgorithmInput, RsaOaepOptions, RsaScheme, RsaSignatureScheme, decryptRsaOaep, decryptRsaOaepOrThrow, derivePublicKey, encryptRsaOaep, encryptRsaOaepOrThrow, exportBinaryBase64, exportEncryptedPkcs1Pem, exportEncryptedPkcs8Der, exportEncryptedPkcs8Pem, exportEncryptedSec1Pem, exportPkcs1Der, exportPkcs1Pem, exportPkcs8Der, exportPkcs8Pem, exportPrivateJwk, exportPublicJwk, exportSec1Der, exportSec1Pem, exportSpkiDer, exportSpkiPem, generateKeyPair, importEncryptedPkcs1Pem, importEncryptedPkcs1PemOrThrow, importEncryptedPkcs8Der, importEncryptedPkcs8DerOrThrow, importEncryptedPkcs8Pem, importEncryptedPkcs8PemOrThrow, importEncryptedSec1Pem, importEncryptedSec1PemOrThrow, importPkcs1Der, importPkcs1DerOrThrow, importPkcs1Pem, importPkcs1PemOrThrow, importPkcs8Base64, importPkcs8Base64OrThrow, importPkcs8Der, importPkcs8DerOrThrow, importPkcs8Pem, importPkcs8PemOrThrow, importPrivateJwk, importPrivateJwkOrThrow, importPublicJwk, importPublicJwkOrThrow, importSec1Der, importSec1DerOrThrow, importSec1Pem, importSec1PemOrThrow, importSpkiBase64, importSpkiBase64OrThrow, importSpkiDer, importSpkiDerOrThrow, importSpkiPem, importSpkiPemOrThrow, inspectEncryptedPkcs8Der, parsePbes2AlgorithmIdentifier };
833
+ export declare function decryptRsaOaep(privateKey: CryptoKey, ciphertext: Uint8Array, options?: RsaOaepOptions): Promise<DecryptRsaOaepResult>;
834
+ export { type KdfLimitOptions, type Pbes2EncryptionOptions, type Pbes2EncryptionScheme, type Pbes2Parameters, type Pbes2Prf, parsePbes2AlgorithmIdentifier };
820
835
  //# sourceMappingURL=keys.d.ts.map