Commit 24d37bd
committed
lib,crypto: migrate algorithm modules to native CryptoKey
Every Web Crypto algorithm module drops `key[kKeyObject][kHandle]`
symbol access in favor of `getCryptoKey*` accessors and stores the raw
`KeyObjectHandle` directly (no more `SecretKeyObject`/`PublicKeyObject`/
`PrivateKeyObject` wrappers on the CryptoKey slot). Key generation
moves off the promisified `generateKey`/`generateKeyPair` paths onto
ones that return `KeyObjectHandle` (i.e. not wrapped in KeyObject):
- `SecretKeyGenJob` for AES, ChaCha20-Poly1305, HMAC/CMAC (aes.js,
chacha20_poly1305.js, mac.js).
- `EcKeyPairGenJob` for ECDSA, ECDH (ec.js).
- `NidKeyPairGenJob` for Ed25519/Ed448/X25519/X448, ML-DSA-{44,65,87},
ML-KEM-{512,768,1024} (cfrg.js, ml_dsa.js, ml_kem.js).
- `RsaKeyPairGenJob` for RSASSA-PKCS1-v1_5, RSA-PSS, RSA-OAEP (rsa.js).
`webcrypto_util.js` switches its import helpers (`importDerKey`,
`importJwkKey`, `importRawKey`) to return raw `KeyObjectHandle`s and
adds `importSecretKey` / `importJwkSecretKey` helpers for symmetric
imports. `webcrypto.js` follows the same pattern; its `getPublicKey`
builds a temporary wrapper and carries a TODO for future refactor.
`hkdf.js` switches from `promisify(hkdf)` to
`jobPromise(() => new HKDFJob(...))` directly. `diffiehellman.js`,
`argon2.js`, and `pbkdf2.js` are accessor-only migrations (the
`TODO(panva)` notes on argon2/pbkdf2 are orthogonal and left for a later
cleanup).
Signed-off-by: Filip Skokan <[email protected]>1 parent 1007575 commit 24d37bd
15 files changed
Lines changed: 400 additions & 465 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | | - | |
13 | | - | |
14 | 11 | | |
15 | 12 | | |
16 | 13 | | |
| |||
26 | 23 | | |
27 | 24 | | |
28 | 25 | | |
| 26 | + | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
| 30 | + | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
35 | | - | |
36 | 34 | | |
37 | 35 | | |
38 | 36 | | |
39 | 37 | | |
40 | | - | |
41 | 38 | | |
42 | 39 | | |
43 | 40 | | |
44 | 41 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 42 | + | |
| 43 | + | |
48 | 44 | | |
49 | 45 | | |
50 | 46 | | |
| 47 | + | |
| 48 | + | |
51 | 49 | | |
52 | 50 | | |
53 | 51 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | 52 | | |
61 | 53 | | |
62 | 54 | | |
| |||
116 | 108 | | |
117 | 109 | | |
118 | 110 | | |
119 | | - | |
| 111 | + | |
120 | 112 | | |
121 | | - | |
| 113 | + | |
122 | 114 | | |
123 | 115 | | |
124 | 116 | | |
| |||
127 | 119 | | |
128 | 120 | | |
129 | 121 | | |
130 | | - | |
| 122 | + | |
131 | 123 | | |
132 | | - | |
| 124 | + | |
133 | 125 | | |
134 | 126 | | |
135 | 127 | | |
136 | 128 | | |
137 | 129 | | |
138 | 130 | | |
139 | 131 | | |
140 | | - | |
| 132 | + | |
141 | 133 | | |
142 | | - | |
| 134 | + | |
143 | 135 | | |
144 | 136 | | |
145 | 137 | | |
| |||
149 | 141 | | |
150 | 142 | | |
151 | 143 | | |
152 | | - | |
| 144 | + | |
153 | 145 | | |
154 | | - | |
| 146 | + | |
155 | 147 | | |
156 | 148 | | |
157 | 149 | | |
| |||
164 | 156 | | |
165 | 157 | | |
166 | 158 | | |
167 | | - | |
| 159 | + | |
168 | 160 | | |
169 | | - | |
| 161 | + | |
170 | 162 | | |
171 | 163 | | |
172 | 164 | | |
| |||
196 | 188 | | |
197 | 189 | | |
198 | 190 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 191 | + | |
208 | 192 | | |
209 | 193 | | |
210 | | - | |
| 194 | + | |
211 | 195 | | |
212 | | - | |
| 196 | + | |
213 | 197 | | |
214 | 198 | | |
215 | 199 | | |
| |||
231 | 215 | | |
232 | 216 | | |
233 | 217 | | |
234 | | - | |
| 218 | + | |
235 | 219 | | |
236 | 220 | | |
237 | 221 | | |
238 | | - | |
239 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
240 | 225 | | |
241 | 226 | | |
242 | 227 | | |
243 | 228 | | |
244 | 229 | | |
245 | 230 | | |
246 | 231 | | |
247 | | - | |
248 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
249 | 235 | | |
250 | 236 | | |
251 | 237 | | |
252 | 238 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
| 239 | + | |
| 240 | + | |
263 | 241 | | |
264 | | - | |
265 | 242 | | |
266 | 243 | | |
267 | 244 | | |
268 | 245 | | |
269 | 246 | | |
270 | 247 | | |
271 | | - | |
272 | | - | |
273 | 248 | | |
274 | 249 | | |
275 | 250 | | |
276 | 251 | | |
277 | 252 | | |
278 | 253 | | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | 254 | | |
285 | | - | |
| 255 | + | |
286 | 256 | | |
287 | | - | |
| 257 | + | |
288 | 258 | | |
289 | 259 | | |
290 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | | - | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
216 | 219 | | |
217 | 220 | | |
218 | 221 | | |
219 | | - | |
| 222 | + | |
| 223 | + | |
220 | 224 | | |
221 | 225 | | |
222 | 226 | | |
| |||
0 commit comments