mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 16:49:54 +00:00
LibWeb: Sset the key_usages on X25519 export in a better way
This commit is contained in:
parent
19ee8ddec2
commit
5b67f17551
Notes:
github-actions[bot]
2024-11-14 18:49:07 +00:00
Author: https://github.com/stelar7
Commit: 5b67f17551
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2339
Reviewed-by: https://github.com/gmta
1 changed files with 4 additions and 14 deletions
|
@ -3248,19 +3248,10 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Object>> X25519::export_key(Bindings::K
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6. Set the key_ops attribute of jwk to the usages attribute of key.
|
// 6. Set the key_ops attribute of jwk to the usages attribute of key.
|
||||||
auto key_ops = Vector<String> {};
|
jwk.key_ops = Vector<String> {};
|
||||||
auto key_usages = verify_cast<JS::Array>(key->usages());
|
jwk.key_ops->ensure_capacity(key->internal_usages().size());
|
||||||
auto key_usages_length = MUST(MUST(key_usages->get(vm.names.length)).to_length(vm));
|
for (auto const& usage : key->internal_usages())
|
||||||
for (auto i = 0u; i < key_usages_length; ++i) {
|
jwk.key_ops->append(Bindings::idl_enum_to_string(usage));
|
||||||
auto usage = key_usages->get(i);
|
|
||||||
if (!usage.has_value())
|
|
||||||
break;
|
|
||||||
|
|
||||||
auto usage_string = TRY(usage.value().to_string(vm));
|
|
||||||
key_ops.append(usage_string);
|
|
||||||
}
|
|
||||||
|
|
||||||
jwk.key_ops = key_ops;
|
|
||||||
|
|
||||||
// 7. Set the ext attribute of jwk to the [[extractable]] internal slot of key.
|
// 7. Set the ext attribute of jwk to the [[extractable]] internal slot of key.
|
||||||
jwk.ext = key->extractable();
|
jwk.ext = key->extractable();
|
||||||
|
@ -3706,5 +3697,4 @@ WebIDL::ExceptionOr<JS::Value> HMAC::get_key_length(AlgorithmParams const& param
|
||||||
// 2. Return length.
|
// 2. Return length.
|
||||||
return JS::Value(length);
|
return JS::Value(length);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue