Skip to content

feat: quick-win API additions, OKP JWK support, and native optimizations#912

Merged
boorad merged 2 commits intomainfrom
feat/quick-wins-cleanup
Feb 10, 2026
Merged

feat: quick-win API additions, OKP JWK support, and native optimizations#912
boorad merged 2 commits intomainfrom
feat/quick-wins-cleanup

Conversation

@boorad
Copy link
Collaborator

@boorad boorad commented Feb 10, 2026

Summary

Implements several quick-win API additions identified during the implementation-coverage audit, plus follow-up improvements from code review that move key operations to native C++.

Changes

New APIs

  • crypto.hash() — oneshot convenience wrapper around createHash/update/digest
  • subtle.deriveKey with ECDH — adds missing ECDH case (delegates to existing ecDeriveBits)
  • crypto.createDiffieHellmanGroup — alias for getDiffieHellman
  • diffieHellman.verifyError — proper implementation via native DH_check()
  • KeyObject.equals() — native comparison using EVP_PKEY_eq (asymmetric) and CRYPTO_memcmp (symmetric)
  • KeyObject.symmetricKeySize — native accessor via KeyObjectData::GetSymmetricKeySize()

OKP JWK Support (RFC 8037)

  • JWK export/import for Ed25519, Ed448, X25519, X448
  • Added OKP to JWKkty enum (Nitro + TypeScript)
  • Full roundtrip tests with sign/verify validation

Code Quality

  • Moved equals() and symmetricKeySize to native — no longer exports key material into JS
  • verifyError uses actual DH_check() instead of hardcoded stub
  • Removed as unknown as JWK double cast by widening edImportKey parameter type
  • Added default: break; to OKP export switch
  • Regenerated nitrogen specs (includes std::variant order update)

Coverage Docs

  • Updated implementation-coverage.md and coverage.ts data

Testing

All features have test coverage in the example app:

  • DH: createDiffieHellmanGroup alias, verifyError for valid params
  • Hash: hash() oneshot with various algorithms and encodings
  • Keys: equals() for secret/public/cross-type, symmetricKeySize for 16/32/64 byte keys
  • Subtle: ECDH P-256 deriveKey with encrypt/decrypt roundtrip
  • JWK: Ed25519 and Ed448 export/import roundtrip with sign/verify

Closes #653

Add several missing Node.js crypto API methods identified in the
implementation coverage audit:

- crypto.hash() oneshot function
- subtle.deriveKey with ECDH
- Ed25519/Ed448/X25519/X448 JWK export/import (C++ OKP support)
- KeyObject.equals()
- KeyObject.symmetricKeySize
- createDiffieHellmanGroup alias
- diffieHellman.verifyError property

Add tests for all new features and update coverage docs.
…itrogen

Move KeyObject.equals() to native C++ using EVP_PKEY_eq for asymmetric
keys and CRYPTO_memcmp for symmetric keys, avoiding export of private
key material into JS. Move symmetricKeySize to native via existing
KeyObjectData::GetSymmetricKeySize(). Replace verifyError stub with
actual DH_check() call. Add default case to OKP JWK export switch.
Fix edImportKey parameter type to accept JWK, removing as-unknown cast.
Regenerate nitrogen specs (includes std::variant order update).
@boorad boorad self-assigned this Feb 10, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

🤖 End-to-End Test Results - Android

Status: ✅ Passed
Platform: Android
Run: 21880719701

📸 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: 21880719764

📸 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 7bf6e53 into main Feb 10, 2026
5 of 6 checks passed
@boorad boorad deleted the feat/quick-wins-cleanup branch February 10, 2026 20:37
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 subtle.importKey() with Ed25519

1 participant