mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibWeb: Support the exporting of ml-kem keys in raw-seed format
This commit is contained in:
Notes:
github-actions[bot]
2026-01-06 00:07:44 +00:00
Author: https://github.com/tete17 Commit: https://github.com/LadybirdBrowser/ladybird/commit/df0796bdf26 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7320 Reviewed-by: https://github.com/shannonbooth ✅
@@ -9286,7 +9286,20 @@ WebIDL::ExceptionOr<GC::Ref<JS::Object>> MLKEM::export_key(Bindings::KeyFormat f
|
||||
// 3. Let result be data.
|
||||
result = JS::ArrayBuffer::create(m_realm, data);
|
||||
}
|
||||
// FIXME: -> If format is "raw-seed":
|
||||
// -> If format is "raw-seed":
|
||||
else if (format == Bindings::KeyFormat::RawSeed) {
|
||||
// 1. If the [[type]] internal slot of key is not "private", then throw an InvalidAccessError.
|
||||
if (key->type() != Bindings::KeyType::Private)
|
||||
return WebIDL::InvalidAccessError::create(m_realm, "Key is not a private key"_utf16);
|
||||
|
||||
// 2. Let data be a byte sequence containing the concatenation of the d and z seed variables of the
|
||||
// key represented by the [[handle]] internal slot of key.
|
||||
VERIFY(key->handle().has<::Crypto::PK::MLKEMPrivateKey>());
|
||||
auto const data = key->handle().get<::Crypto::PK::MLKEMPrivateKey>().seed();
|
||||
|
||||
// 3. Let result be data.
|
||||
result = JS::ArrayBuffer::create(m_realm, data);
|
||||
}
|
||||
// FIXME: -> If format is "jwk":
|
||||
// -> Otherwise:
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user