You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .agent/contracts/node-bridge.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,6 +94,19 @@ Bridge-provided randomness for global `crypto` APIs MUST delegate to host `node:
94
94
-**WHEN** host `node:crypto` randomness primitives are unavailable or fail
95
95
-**THEN** the bridge MUST throw a deterministic error matching the unsupported API format (`"<module>.<api> is not supported in sandbox"`) for the invoked randomness API and MUST NOT fall back to non-cryptographic randomness
96
96
97
+
### Requirement: Global WebCrypto Surface Matches The `crypto.webcrypto` Bridge
98
+
The bridge SHALL expose a single WebCrypto surface so global `crypto` APIs and `require('crypto').webcrypto` share the same object graph and constructor semantics.
99
+
100
+
#### Scenario: Sandboxed code compares global and module WebCrypto objects
101
+
-**WHEN** sandboxed code reads both `globalThis.crypto` and `require('crypto').webcrypto`
102
+
-**THEN** those references MUST point at the same WebCrypto object
103
+
-**AND**`crypto.subtle` MUST expose the same `SubtleCrypto` instance through both paths
Bridge-provided `crypto` Diffie-Hellman and ECDH APIs SHALL delegate to host `node:crypto` objects so constructor validation, session state, encodings, and shared-secret derivation match Node.js semantics.
0 commit comments