Skip to content

Fix WebCrypto DOMException rejections - #1806

Merged
TheHypnoo merged 2 commits into
mainfrom
feat/webcrypto-domexception-errors
May 25, 2026
Merged

Fix WebCrypto DOMException rejections#1806
TheHypnoo merged 2 commits into
mainfrom
feat/webcrypto-domexception-errors

Conversation

@TheHypnoo

Copy link
Copy Markdown
Member

Summary

  • replace the remaining WebCrypto resolve_undefined rejection/error paths with DOMException-shaped rejected promises
  • remove the resolve_undefined helper from webcrypto.rs
  • add parity coverage for inner WebCrypto failure paths in sign, encrypt, decrypt, wrapKey, and unwrapKey

Why

Perry previously diverged from Node by resolving undefined for many crypto.subtle.* error paths. Consumers that rely on rejected promises and e.name checks would run the success branch instead of catching OperationError, InvalidAccessError, or related DOMException names.

Fixes #1431.

Validation

  • cargo fmt --check
  • cargo check -p perry-stdlib
  • git diff --check
  • rg -n "resolve_undefined" crates/perry-stdlib/src/webcrypto.rs
  • ./run_parity_tests.sh --suite node-suite --module crypto/webcrypto/errors

@TheHypnoo
TheHypnoo marked this pull request as ready for review May 25, 2026 16:00
@TheHypnoo
TheHypnoo merged commit 206d2bd into main May 25, 2026
10 checks passed
@TheHypnoo
TheHypnoo deleted the feat/webcrypto-domexception-errors branch May 25, 2026 16:06
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.

crypto: WebCrypto error paths should reject with DOMException instead of resolving undefined

1 participant