Skip to content

feat: E2E qualification for Nitro Modules v1 plus a bare-host smoke test - #1111

Open
boorad wants to merge 10 commits into
nextfrom
feat/1104-e2e-bare-host-qualification
Open

boorad wants to merge 10 commits into
nextfrom
feat/1104-e2e-bare-host-qualification

Conversation

@boorad

@boorad boorad commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

This qualifies the Nitro Modules v1 port (RNQC 2.0) on next. The full example-app suite passes on iOS and Android with no fixes needed. The PR also adds a bare-host smoke test: Hermes with no React Native, run in Nitro's own standalone test runner. It passes on an iOS simulator and an Android emulator, and it is the first time the bare Android library has been loaded at runtime.

Changes

  • Shared entry (src/index.ts)
    • No longer mixes ESM exports with module.exports, so a plain bundler can load it.
    • install and NativeKeyObjectHandle now live on the default QuickCrypto object.
    • Uses globalThis.
    • process.nextTick falls back to a microtask when the host has no setImmediate.
  • Smoke test (example/test/bare/quick-crypto.test.ts), 15 cases:
    • Hash: unmodified multiformats@13.4.2 SHA-256 and SHA-512 on a subarray (the feat(hash): expose incremental hashing to standalone Nitro v1 #1099 scenario); createHash incremental vs one-shot, empty input, and reuse after digest.
    • AES-256-GCM: NIST test case 16, with a tampered tag rejected.
    • Ed25519: RFC 8032 test 1.
    • P-256 with SHA-256: sign, then verify.
    • Random: randomBytes sync and callback, randomFillSync, getRandomValues.
    • The harness adds only a small prelude of globals and the bundle aliases (aliases.mjs).
  • scripts/bare-host.sh ios|android
    • Fetches margelo/nitro at the commit matching the pinned nightly, and refuses to run if that commit and package.json disagree.
    • Applies a small overlay (example/test/bare/host/), then builds and runs the runner.
    • iOS uses XCTest on a simulator.
    • Android runs connectedDebugAndroidTest on an emulator the script boots and shuts down itself. It uses an attached device only when ANDROID_SERIAL is set.
    • Writes a PASS/FAIL result file and checks that libQuickCrypto.so exports no EVP_, ERR_ or SSL_ symbols.
  • docs/content/docs/guides/bare-host.mdx: the verified recipe replaces the "tracked in E2E qualification for Nitro Modules v1: React Native app plus a bare-host smoke test #1104" callout.
  • plans/done/1104-e2e-bare-host-qualification.md: tracker, decisions and evidence.

Testing

All runs were on macOS arm64 with Xcode 27.2.

  • RN example app, at 0485102:
    • bun run e2e:ios passed: 42 suites, 2211 tests, 0 failures.
    • Then bun run e2e:android passed: 42 suites, 2211 tests, 0 failures.
    • Later commits touch neither packages/ nor the app's runtime code.
  • Bare host, at b1ea942 (the final driver):
    • scripts/bare-host.sh ios passed on an iPhone simulator running iOS 27.2 (arm64): 26 Swift tests, including all 15 quick-crypto cases.
    • scripts/bare-host.sh android passed on a Nexus_7 AVD (API 35, arm64-v8a): 24 JUnit tests with 0 failures, and 0 exported OpenSSL symbols.
    • Negative check: a corrupted test vector makes both platforms report FAIL with a non-zero exit.
  • Static checks: bun tsc, bun lint, bun format, shellcheck scripts/bare-host.sh and the pre-commit hooks all pass.
  • Jest: cd packages/react-native-quick-crypto && bun run test passed 19 tests at fcf8c29, the last src/ change.
  • Independent local review found 8 items, all fixed; 3 informational items were skipped and recorded in the plan.
  • Attestation: agentscm/local-validation attestation and screenshot posting don't apply, because the verifier only covers PRs into main.

Delivery

  • The src/index.ts change reaches consumers in the RNQC 2.0 npm release.
  • Under CommonJS, require() now returns the module namespace with read-only getters. Reads and install() behave as before, but assigning properties on it no longer works.
  • The bare-host script and test are development tooling only.

Not verified

  • Bare host coverage:
    • Debug builds only: arm64 iOS simulator and one API 35 arm64-v8a emulator.
    • Android was built with NDK 29, Nitro's version, not RNQC's 28.2.
    • Not covered: x86_64, Release builds, physical devices, SODIUM_ENABLED.
  • Nitro dependency: the overlay patches Nitro's private test files, so the pinned commit has to move with each Nitro nightly bump.

Closes #1104

🤖 Generated with Claude Code

…e smoke test

Drop the module.exports mix from src/index.ts (QuickCrypto now carries install
and NativeKeyObjectHandle itself), use globalThis, and fall back from
setImmediate to a microtask for process.nextTick. Add example/test/bare with a
hash/cipher/sign/random smoke test (incl. multiformats@13.4.2 SHA-2) and a
Bun.build bundle script.
…andalone iOS runner

scripts/bare-host.sh ios clones margelo/nitro at the pinned nightly SHA into build/bare-host, applies a small overlay (RNQC Swift package, hybrid class registration, bundle aliases), bundles the shared smoke test for Hermes and runs it on an iOS simulator.
…umented runner

Adds scripts/bare-host.sh android: overlays RNQC as a Gradle module into Nitro's standalone test runner, loads libQuickCrypto after Nitro core, and runs connectedDebugAndroidTest on an arm64-v8a emulator, failing on any JUnit failure or exported OpenSSL symbol.
Seed only the Hermes XCFramework, always write the Android result file, never adopt an unrelated attached device, guard the Nitro SHA against the peer pin, drop the unused chai-6 bundle path, and replace the bare-host callout with the proven recipe.
@vercel

vercel Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
react-native-quick-crypto Ready Ready Preview Nov 29, 2026 5:19am UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — a49802d0 Deployed Nov 29, 2026 by vercel[bot]
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