2023-12-15 23:40:52 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2023, stelar7 <dudedbz@gmail.com>
|
2024-03-13 21:19:57 -06:00
|
|
|
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
|
2023-12-15 23:40:52 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-03-06 16:53:50 -07:00
|
|
|
#include <AK/Optional.h>
|
|
|
|
#include <AK/String.h>
|
|
|
|
#include <AK/Vector.h>
|
2024-03-13 21:19:57 -06:00
|
|
|
#include <LibCrypto/BigInt/UnsignedBigInteger.h>
|
2023-12-15 23:40:52 +01:00
|
|
|
|
|
|
|
// FIXME: Generate these from IDL
|
|
|
|
namespace Web::Bindings {
|
|
|
|
|
|
|
|
// 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;
|
2024-03-13 21:19:57 -06:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
JS::ThrowCompletionOr<GC::Ref<JS::Object>> to_object(JS::Realm&);
|
2024-12-14 12:22:23 +01:00
|
|
|
|
|
|
|
static JS::ThrowCompletionOr<JsonWebKey> parse(JS::Realm& realm, ReadonlyBytes data);
|
2023-12-15 23:40:52 +01:00
|
|
|
};
|
|
|
|
|
2024-03-08 16:30:17 -07:00
|
|
|
}
|