feat: implement X509Certificate class with all 25 methods/properties#940
Merged
feat: implement X509Certificate class with all 25 methods/properties#940
Conversation
…ties Add complete Node.js-compatible X509Certificate API using ncrypto X509View/X509Pointer for all underlying OpenSSL operations. Nitro spec, C++ implementation, TypeScript wrapper with lazy caching, 37-test suite, API docs page, and coverage updates (all 25 entries now marked as implemented).
- Add missing #pragma once to KeyObjectData.hpp fixing duplicate definition error when included from x509/ directory - Export CheckOptions and X509LegacyObject types from public API - Make extKeyUsage the primary property, keyUsage the alias - Replace mutable getKeyObjectData() ref with setKeyObjectData() setter - Remove unused getCert() accessor from HybridX509Certificate - Add signatureAlgorithm/signatureAlgorithmOid to coverage docs - Improve verify() error message to include actual key type - Use typed X509LegacyObject return for toLegacyObject() - Fix checkHost test: wrong.example.com matches *.example.com wildcard - Strengthen validFrom/validTo test assertions
Contributor
🤖 End-to-End Test Results - AndroidStatus: ✅ Passed 📸 Final Test ScreenshotScreenshot automatically captured from End-to-End tests and will expire in 30 days This comment is automatically updated on each test run. |
Contributor
🤖 End-to-End Test Results - iOSStatus: ✅ Passed 📸 Final Test ScreenshotScreenshot automatically captured from End-to-End tests and will expire in 30 days This comment is automatically updated on each test run. |
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
Implements the full
X509Certificateclass from Node.jscryptomodule, enabling X.509 certificate parsing, inspection, and validation in React Native.Changes
Native (C++)
HybridX509Certificatewrappingncrypto::X509Pointer/X509Viewfor all certificate operationscheckHost,checkEmail,checkIP,checkIssued,checkPrivateKey,verify#pragma oncetoKeyObjectData.hpp(was missing, causing iOS build failure)setKeyObjectData()setter toHybridKeyObjectHandlereplacing mutable ref accessorTypeScript
X509Certificateclass with lazy-cached properties and full Node.js API compatibilityCheckOptionsfor hostname verification flags (wildcards, subject handling)X509LegacyObjecttyped return fortoLegacyObject()CheckOptionsandX509LegacyObjecttypes from public APITests
Docs
x509.mdx) with theory, property reference, method docs, and real-world examples (cert pinning, hostname verification, chain validation)Testing
Run the x509 test suite in the example app (Tests tab → x509 suite). All 37 tests pass.
Closes #893