feat(stdlib): 100% verified parity for node:crypto and node:net - #30
Merged
Merged
Conversation
- Implement 100% core subset parity for node:crypto (129/129 APIs) and node:net (67/67 APIs). - Provide genuine OpenSSL EVP intrinsics in internal/runtime/native/crypto/evp.c (Cipher, Decipher, DiffieHellman, DiffieHellmanGroup, ECDH, Sign, Verify, KeyObject, Certificate, X509 key checks, FIPS, and secureHeap). - Implement full BlockList, Socket, Server, SocketAddress, and network helper methods in internal/runtime/native/net/runtime.c and internal/typescriptgo/stdlib/net.ts. - Modularize LLVM intrinsic emission in internal/backend/llvm/crypto.go. - Synchronize docs/typescript-parity-report.md and record byte-for-byte corpus tests against official Node.js v22 specifications. - Verified with go test -count=1 ./... and cmd/parity audit & benchmark.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR achieves 100% core subset parity for both
node:crypto(129/129 APIs) andnode:net(67/67 APIs) against the official Node.js v22 specification, with zero no-ops, zero placeholders, and zero workarounds.Changes
node:crypto(129/129 APIs, 100% verified):internal/runtime/native/crypto/evp.csupporting:Cipher&Decipher(update,final,setAAD,getAuthTag,setAutoPadding)DiffieHellman&DiffieHellmanGroup(generateKeys,computeSecret,getPrime,getGenerator,getPublicKey,getPrivateKey,setPublicKey,setPrivateKey,verifyError)ECDH(generateKeys,computeSecret,getPublicKey,getPrivateKey,setPublicKey,setPrivateKey)Sign&VerifyKeyObject(export,equals,toCryptoKey,asymmetricKeyType,asymmetricKeyDetails,symmetricKeySize,type)Certificate(exportChallenge,exportPublicKey,verifySpkac)X509Certificate(checkPrivateKey,verify)publicEncrypt,publicDecrypt,privateEncrypt,privateDecryptgenerateKeyPair,generateKeyPairSync,generateKey,generateKeySync,generatePrime,generatePrimeSync,checkPrime,checkPrimeSync,hkdf,hkdfSync,pbkdf2,pbkdf2Sync,scrypt,scryptSyncfips,getFips,setFips,secureHeapUsed,setEngine,getCipherInfo,getCiphers,getCurves,getHashes,getDiffieHellmaninternal/backend/llvm/crypto.go(under 700 lines).node:net(67/67 APIs, 100% verified):internal/runtime/native/net/runtime.candinternal/typescriptgo/stdlib/net.ts:Server(listen,close,address,getConnections,ref,unref,maxConnections,listening)Socket(connect,write,end,destroy,pause,resume,setTimeout,setNoDelay,setKeepAlive,setEncoding,ref,unref,resetAndDestroy,address,remoteAddress,remotePort,localAddress,localPort,bytesRead,bytesWritten,bufferSize,readyState)SocketAddress(address,port,family,flowlabel)BlockList(addAddress,addRange,addSubnet,check,rules,toJSON,fromJSON,isBlockList)getDefaultAutoSelectFamily,setDefaultAutoSelectFamily,getDefaultAutoSelectFamilyAttemptTimeout,setDefaultAutoSelectFamilyAttemptTimeout)Parity & Regression Verification:
cmd/parity -audit -filter crypto: 129 / 129 (100.0%) verifiedcmd/parity -audit -filter net: 67 / 67 (100.0%) verifiedcmd/parity -filter api/crypto.ts: PASS (100% parity with Node.js v22)cmd/parity -filter api/net.ts: PASS (100% parity with Node.js v22)go test -count=1 ./...,go test -count=1 ./internal/typescriptgo/...,go build ./cmd/scriptgodocs/typescript-parity-report.md