Skip to content

feat: implement X509Certificate class with all 25 methods/properties#940

Merged
boorad merged 2 commits intomainfrom
feat/x509-certificate
Feb 16, 2026
Merged

feat: implement X509Certificate class with all 25 methods/properties#940
boorad merged 2 commits intomainfrom
feat/x509-certificate

Conversation

@boorad
Copy link
Collaborator

@boorad boorad commented Feb 16, 2026

Summary

Implements the full X509Certificate class from Node.js crypto module, enabling X.509 certificate parsing, inspection, and validation in React Native.

Changes

Native (C++)

  • HybridX509Certificate wrapping ncrypto::X509Pointer/X509View for all certificate operations
  • All property accessors: subject, issuer, SAN, fingerprints (SHA-1/256/512), validity dates, serial number, signature algorithm, key usage, CA flag, raw DER, public key extraction
  • Verification methods: checkHost, checkEmail, checkIP, checkIssued, checkPrivateKey, verify
  • Added #pragma once to KeyObjectData.hpp (was missing, causing iOS build failure)
  • Added setKeyObjectData() setter to HybridKeyObjectHandle replacing mutable ref accessor

TypeScript

  • X509Certificate class with lazy-cached properties and full Node.js API compatibility
  • CheckOptions for hostname verification flags (wildcards, subject handling)
  • X509LegacyObject typed return for toLegacyObject()
  • Exported CheckOptions and X509LegacyObject types from public API

Tests

  • 30 test cases covering construction, all properties, fingerprints, date handling, name checks (host/email/IP), key verification, serialization

Docs

  • Full API documentation page (x509.mdx) with theory, property reference, method docs, and real-world examples (cert pinning, hostname verification, chain validation)
  • Updated implementation coverage tracking

Testing

Run the x509 test suite in the example app (Tests tab → x509 suite). All 37 tests pass.

Closes #893

…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
@boorad boorad self-assigned this Feb 16, 2026
@github-actions
Copy link
Contributor

🤖 End-to-End Test Results - Android

Status: ✅ Passed
Platform: Android
Run: 22080311566

📸 Final Test Screenshot

Maestro Test Results - android

Screenshot automatically captured from End-to-End tests and will expire in 30 days


This comment is automatically updated on each test run.

@github-actions
Copy link
Contributor

🤖 End-to-End Test Results - iOS

Status: ✅ Passed
Platform: iOS
Run: 22080311569

📸 Final Test Screenshot

Maestro Test Results - ios

Screenshot automatically captured from End-to-End tests and will expire in 30 days


This comment is automatically updated on each test run.

@boorad boorad merged commit 674a146 into main Feb 16, 2026
7 checks passed
@boorad boorad deleted the feat/x509-certificate branch February 16, 2026 23:32
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.

✨ Add support for x509.verify

1 participant

Comments