feat(DEP0203): migrate extractable `CryptoKey` arguments to `KeyObject`
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
- Ambito
- tooling
Direzione di ricerca
Start by reading the codemod implementations and tests in the repository that handle import resolution, aliases, and collision-free bindings; the issue does not name specific files. Then locate how migrations analyze call arguments and write tests for extractable keys used with the listed node:crypto APIs and { key: ... } overloads. Done means only safely established extractable keys are wrapped, while existing KeyObject and Web Crypto uses remain unchanged and uncertain cases are skipped with guidance.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
Node.js 27.0.0-alpha.0.0.0 moves DEP0203 and DEP0204 to End-of-Life. Legacy node:crypto APIs reject CryptoKey arguments, and KeyObject.from() rejects non-extractable CryptoKey objects.
Add a conservative codemod that wraps a CryptoKey argument with KeyObject.from() when its identity and extractability can be established from the source code.
Cover affected key arguments in APIs such as createHmac(), createCipheriv(), createDecipheriv(), sign(), and verify(), including supported { key: ... } overloads. Resolve imports and aliases and add a collision-free KeyObject binding.
Additional Information
- Start with local key creation/import patterns whose
extractableargument is staticallytrueand whose resulting binding is not reassigned or passed through unknown code. - Preserve the key position and any surrounding options, such as signature padding or encoding.
- Leave existing
KeyObjectarguments and Web Crypto operations unchanged. - Skip non-extractable keys and keys with unknown extractability, and explain that they need manual migration.
- Never change
extractable: falsetotrueautomatically. Migrating operations to Web Crypto can require API and asynchronous control-flow changes and is outside the initial scope.
Examples
-import { createHmac, webcrypto } from 'node:crypto';
+import { createHmac, KeyObject, webcrypto } from 'node:crypto';
const key = await webcrypto.subtle.importKey(
'raw',
new Uint8Array(32),
{ name: 'HMAC', hash: 'SHA-256' },
true,
['sign'],
);
-const digest = createHmac('sha256', key).update('hello').digest('hex');
+const digest = createHmac('sha256', KeyObject.from(key)).update('hello').digest('hex');
Refs
- Lingua principale
- TypeScript
- Stelle
- 85
- Fork
- 58
- Merge medio
- 1g 21h
- PR unite (30g)
- 8
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nodejs/userland-migrations
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
nodejs/userland-migrations#562 · 3 reazioni ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
nodejs/userland-migrations#561 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 2 giorni
-
good first issue human help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
nodejs/userland-migrations#560 · 1 reazione ·
I maintainer di solito rispondono entro 2 giorni
-
good first issue human help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
nodejs/userland-migrations#559 ·
I maintainer di solito rispondono entro 2 giorni
-
good first issue human help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
nodejs/userland-migrations#558 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di nodejs/userland-migrations
Issue simili
-
docker infra P1 security size:S
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
josephfung/curia#2408 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
ehmpathy/rhachet-roles-ehmpathy#1231 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue help wanted
Difficoltà 2/5 Mezza giornata Idoneità per principianti 70/100
danielw-sudo/agentuto#32 ·
I maintainer di solito rispondono entro 1 giorno
-
type:docs
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
nightgauge/nightgauge#2836 ·
I maintainer di solito rispondono entro 1 giorno