aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ScriptExecutionContext.h
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-07-14 19:37:22 -0700
committerGravatar GitHub <noreply@github.com> 2023-07-14 19:37:22 -0700
commitc39c11e1011b682c2c4e48594c7d6110cfc3343c (patch)
tree8808ca4cd6684949423f28f3cd4d90aedb605cb7 /src/bun.js/bindings/ScriptExecutionContext.h
parent25512104265aa568ca98e5bd89a977203ee261a6 (diff)
downloadbun-c39c11e1011b682c2c4e48594c7d6110cfc3343c.tar.gz
bun-c39c11e1011b682c2c4e48594c7d6110cfc3343c.tar.zst
bun-c39c11e1011b682c2c4e48594c7d6110cfc3343c.zip
structured clone (#3637)
* copy `SerializedScriptValue` * format * make `SerializedScriptValue` compile * add `transfer` option * tests * serialize/deserialize blobs * tests for blobs * serialize/deserialize file blobs * more tests * small cleanup * format * small changes + serialize offset * slice helper * map and set test
Diffstat (limited to 'src/bun.js/bindings/ScriptExecutionContext.h')
-rw-r--r--src/bun.js/bindings/ScriptExecutionContext.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/bun.js/bindings/ScriptExecutionContext.h b/src/bun.js/bindings/ScriptExecutionContext.h
index aed7977a5..fcf65f477 100644
--- a/src/bun.js/bindings/ScriptExecutionContext.h
+++ b/src/bun.js/bindings/ScriptExecutionContext.h
@@ -115,6 +115,18 @@ public:
// {
// }
+#if ENABLE(WEB_CRYPTO)
+ // These two methods are used when CryptoKeys are serialized into IndexedDB. As a side effect, it is also
+ // used for things that utilize the same structure clone algorithm, for example, message passing between
+ // worker and document.
+
+ // For now these will return false. In the future, we will want to implement these similar to how WorkerGlobalScope.cpp does.
+ // virtual bool wrapCryptoKey(const Vector<uint8_t>& key, Vector<uint8_t>& wrappedKey) = 0;
+ // virtual bool unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, Vector<uint8_t>& key) = 0;
+ bool wrapCryptoKey(const Vector<uint8_t>& key, Vector<uint8_t>& wrappedKey) { return false; }
+ bool unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, Vector<uint8_t>& key) { return false; }
+#endif
+
static bool postTaskTo(ScriptExecutionContextIdentifier identifier, Function<void(ScriptExecutionContext&)>&& task);
void regenerateIdentifier();
@@ -194,4 +206,7 @@ public:
}
}
};
+
+ScriptExecutionContext* executionContext(JSC::JSGlobalObject*);
+
} \ No newline at end of file