Files
ladybird/Libraries/LibWeb/Crypto/CryptoBindings.h
Shannon Booth 0cf991e205 LibWeb/Crypto: Move WebCrypto dictionaries into Crypto namespace
Keep the JsonWebKey dictionary types in line with other dictionary
types in the codebase by putting them in the Crypto namespace
rather than under Web::Bindings.
2026-04-23 22:12:13 +02:00

57 lines
1.4 KiB
C++

/*
* Copyright (c) 2023, stelar7 <dudedbz@gmail.com>
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Optional.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibCrypto/BigInt/UnsignedBigInteger.h>
// FIXME: Generate these from IDL
namespace Web::Crypto {
// https://w3c.github.io/webcrypto/#JsonWebKey-dictionary
struct RsaOtherPrimesInfo {
Optional<String> r;
Optional<String> d;
Optional<String> t;
};
// https://w3c.github.io/webcrypto/#JsonWebKey-dictionary
struct JsonWebKey {
Optional<String> kty;
Optional<String> use;
Optional<Vector<String>> key_ops;
Optional<String> alg;
Optional<bool> ext;
Optional<String> crv;
Optional<String> x;
Optional<String> y;
Optional<String> d;
Optional<String> n;
Optional<String> e;
Optional<String> p;
Optional<String> q;
Optional<String> dp;
Optional<String> dq;
Optional<String> qi;
Optional<Vector<RsaOtherPrimesInfo>> oth;
Optional<String> k;
// https://wicg.github.io/webcrypto-modern-algos/#partial-JsonWebKey-dictionary
// The following fields are defined in draft-ietf-cose-dilithium-07
Optional<String> pub;
Optional<String> priv;
JS::ThrowCompletionOr<GC::Ref<JS::Object>> to_object(JS::Realm&);
static JS::ThrowCompletionOr<JsonWebKey> parse(JS::Realm& realm, ReadonlyBytes data);
};
}