Commit 02c2456
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 27230ec commit 02c2456
15 files changed
Lines changed: 368 additions & 443 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | | - | |
14 | | - | |
15 | 12 | | |
16 | 13 | | |
17 | 14 | | |
| |||
27 | 24 | | |
28 | 25 | | |
29 | 26 | | |
| 27 | + | |
30 | 28 | | |
31 | 29 | | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
36 | | - | |
37 | 34 | | |
38 | 35 | | |
39 | 36 | | |
40 | 37 | | |
41 | | - | |
42 | 38 | | |
43 | 39 | | |
44 | 40 | | |
45 | 41 | | |
46 | | - | |
47 | | - | |
48 | | - | |
| 42 | + | |
| 43 | + | |
49 | 44 | | |
50 | 45 | | |
51 | 46 | | |
| 47 | + | |
| 48 | + | |
52 | 49 | | |
53 | 50 | | |
54 | 51 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | 52 | | |
62 | 53 | | |
63 | 54 | | |
| |||
117 | 108 | | |
118 | 109 | | |
119 | 110 | | |
120 | | - | |
| 111 | + | |
121 | 112 | | |
122 | | - | |
| 113 | + | |
123 | 114 | | |
124 | 115 | | |
125 | 116 | | |
| |||
128 | 119 | | |
129 | 120 | | |
130 | 121 | | |
131 | | - | |
| 122 | + | |
132 | 123 | | |
133 | | - | |
| 124 | + | |
134 | 125 | | |
135 | 126 | | |
136 | 127 | | |
137 | 128 | | |
138 | 129 | | |
139 | 130 | | |
140 | 131 | | |
141 | | - | |
| 132 | + | |
142 | 133 | | |
143 | | - | |
| 134 | + | |
144 | 135 | | |
145 | 136 | | |
146 | 137 | | |
| |||
150 | 141 | | |
151 | 142 | | |
152 | 143 | | |
153 | | - | |
| 144 | + | |
154 | 145 | | |
155 | | - | |
| 146 | + | |
156 | 147 | | |
157 | 148 | | |
158 | 149 | | |
| |||
165 | 156 | | |
166 | 157 | | |
167 | 158 | | |
168 | | - | |
| 159 | + | |
169 | 160 | | |
170 | | - | |
| 161 | + | |
171 | 162 | | |
172 | 163 | | |
173 | 164 | | |
| |||
197 | 188 | | |
198 | 189 | | |
199 | 190 | | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
| 191 | + | |
209 | 192 | | |
210 | 193 | | |
211 | | - | |
| 194 | + | |
212 | 195 | | |
213 | 196 | | |
214 | 197 | | |
| |||
232 | 215 | | |
233 | 216 | | |
234 | 217 | | |
235 | | - | |
| 218 | + | |
236 | 219 | | |
237 | 220 | | |
238 | 221 | | |
239 | | - | |
240 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
241 | 225 | | |
242 | 226 | | |
243 | 227 | | |
244 | 228 | | |
245 | 229 | | |
246 | 230 | | |
247 | 231 | | |
248 | | - | |
249 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
250 | 235 | | |
251 | 236 | | |
252 | 237 | | |
253 | 238 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
| 239 | + | |
| 240 | + | |
264 | 241 | | |
265 | | - | |
266 | 242 | | |
267 | 243 | | |
268 | 244 | | |
269 | 245 | | |
270 | 246 | | |
271 | 247 | | |
272 | | - | |
273 | | - | |
274 | 248 | | |
275 | 249 | | |
276 | 250 | | |
277 | 251 | | |
278 | 252 | | |
279 | 253 | | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | 254 | | |
286 | | - | |
| 255 | + | |
287 | 256 | | |
288 | 257 | | |
289 | 258 | | |
| |||
| 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