Skip to content

feat(stdlib): 100% verified parity for node:crypto and node:net - #30

Merged
phamtanminhtien merged 2 commits into
mainfrom
feat/crypto-net-100-percent-parity
Sep 25, 2026
Merged

phamtanminhtien merged 2 commits into
mainfrom
feat/crypto-net-100-percent-parity

Conversation

@phamtanminhtien

Copy link
Copy Markdown
Contributor

Summary

This PR achieves 100% core subset parity for both node:crypto (129/129 APIs) and node:net (67/67 APIs) against the official Node.js v22 specification, with zero no-ops, zero placeholders, and zero workarounds.

Changes

  1. node:crypto (129/129 APIs, 100% verified):

    • Genuine C/OpenSSL EVP intrinsics in internal/runtime/native/crypto/evp.c supporting:
      • 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 & Verify
      • KeyObject (export, equals, toCryptoKey, asymmetricKeyType, asymmetricKeyDetails, symmetricKeySize, type)
      • Certificate (exportChallenge, exportPublicKey, verifySpkac)
      • X509Certificate (checkPrivateKey, verify)
      • publicEncrypt, publicDecrypt, privateEncrypt, privateDecrypt
      • generateKeyPair, generateKeyPairSync, generateKey, generateKeySync, generatePrime, generatePrimeSync, checkPrime, checkPrimeSync, hkdf, hkdfSync, pbkdf2, pbkdf2Sync, scrypt, scryptSync
      • fips, getFips, setFips, secureHeapUsed, setEngine, getCipherInfo, getCiphers, getCurves, getHashes, getDiffieHellman
    • Modularized intrinsic emission into internal/backend/llvm/crypto.go (under 700 lines).
  2. node:net (67/67 APIs, 100% verified):

    • Native POSIX/BSD socket implementation across all 67 APIs in internal/runtime/native/net/runtime.c and internal/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)
      • Auto-select family helpers (getDefaultAutoSelectFamily, setDefaultAutoSelectFamily, getDefaultAutoSelectFamilyAttemptTimeout, setDefaultAutoSelectFamilyAttemptTimeout)
  3. Parity & Regression Verification:

    • cmd/parity -audit -filter crypto: 129 / 129 (100.0%) verified
    • cmd/parity -audit -filter net: 67 / 67 (100.0%) verified
    • cmd/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)
    • Full regression passed: go test -count=1 ./..., go test -count=1 ./internal/typescriptgo/..., go build ./cmd/scriptgo
    • Updated docs/typescript-parity-report.md

- 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.
@phamtanminhtien
phamtanminhtien merged commit 32309ac into main Sep 25, 2026
7 checks passed
@phamtanminhtien
phamtanminhtien deleted the feat/crypto-net-100-percent-parity branch September 25, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant