TS WebCrypto implementation #8720
All Vouch review confidence checks passed
Residual risk 0.34 = Change Risk (0.63) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.63 · 302 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.342
Sensitive Paths
sensitive_paths
0.063
Real PR Conversation Timeline
1 comments
"Review active on #8720"
general
weight: 0.35
littledivy
Port SubtleCrypto and the
cryptoglobal (Crypto) to TS behind the TS_WEBCRYPTO autogate. Supersedes #8468.Only the native crypto stays in C++: SubtleCrypto's resource type exposes the backend ops under the gate, created once at bootstrap as the
cryptoBackendpseudo-global, and the entropy comes fromutils.fillRandomValues/utils.newRandomUUID. The TS modules load on first use (lazySubtleCrypto/Cryptoglobals, as JSG's nested types are), so a Worker that never touches WebCrypto loads none of it. Parity tests pin the C++ behaviour first, then the TS classes pass them unchanged at old and new compat dates.Medians of 5 runs, C++ and TS alternated on the same machine.
| subtle bench, 64 calls | C++ µs | TypeScript µs | Speedup |
| ---------------------- | ------ | ------------- | ------- |
| digest SHA-256 string | 107.7 | 63.7 | 1.69x |
| digest SHA-256 dict | 112.5 | 66.7 | 1.69x |
| encrypt AES-GCM | 160.8 | 134.9 | 1.19x |
| sign HMAC | 121.4 | 106.5 | 1.14x |
| verify HMAC | 115.0 | 107.1 | 1.07x |
| exportKey raw | 109.8 | 43.9 | 2.50x |
| generateKey AES-GCM | 133.4 | 124.9 | 1.07x |
| global bench, 64 calls | C++ µs | TypeScript µs | Speedup |
| ---------------------- | ------ | ------------- | ------- |
| getRandomValues 16 B | 3.7 | 3.3 | 1.10x |
| crypto.subtle | 3.9 | 0.3 | 11.89x |
Cold start, as the benches report it (Change is the TypeScript time against C++; + is slower). The global bench uses
cryptoonly in its handlers; the subtle bench readscrypto.subtleat the top level, so itsstartup:workerincludes loading the TS SubtleCrypto.| global bench | C++ µs | TypeScript µs | Change |
| --------------- | ------ | ------------- | ------ |
| startup:isolate | 493.6 | 470.3 | -4.7% |
| startup:script | 1890.6 | 1823.5 | -3.5% |
| startup:worker | 2202.0 | 2107.6 | -4.3% |
| startup:total | 4714.4 | 4542.4 | -3.6% |
| subtle bench | C++ µs | TypeScript µs | Change |
| --------------- | ------ | ------------- | ------ |
| startup:isolate | 495.7 | 514.1 | +3.7% |
| startup:script | 1878.0 | 2025.8 | +7.9% |
| startup:worker | 2208.3 | 2868.9 | +29.9% |
| startup:total | 4794.1 | 5616.2 | +17.1% |