LibWeb: Implement Encapsulate(Key|Bits) dictionaries

These are needed structure for the encapsulate(Key|Bits) operations.
This commit is contained in:
Tete17 2025-11-27 19:14:41 +01:00 committed by Jelle Raaijmakers
parent 1d6a64b26c
commit 42f55c7c97
Notes: github-actions[bot] 2025-11-27 20:51:24 +00:00
3 changed files with 54 additions and 0 deletions

View file

@ -26,6 +26,22 @@ using AlgorithmIdentifier = Variant<GC::Root<JS::Object>, String>;
using NamedCurve = String;
using KeyDataType = Variant<GC::Root<WebIDL::BufferSource>, Bindings::JsonWebKey>;
// https://wicg.github.io/webcrypto-modern-algos/#encapsulation
struct EncapsulatedKey {
Optional<GC::Root<CryptoKey>> shared_key;
Optional<ByteBuffer> ciphertext;
JS::ThrowCompletionOr<GC::Ref<JS::Object>> to_object(JS::Realm&);
};
// https://wicg.github.io/webcrypto-modern-algos/#encapsulation
struct EncapsulatedBits {
Optional<ByteBuffer> shared_key;
Optional<ByteBuffer> ciphertext;
JS::ThrowCompletionOr<GC::Ref<JS::Object>> to_object(JS::Realm&);
};
struct HashAlgorithmIdentifier : public AlgorithmIdentifier {
using AlgorithmIdentifier::AlgorithmIdentifier;