1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:28:11 +00:00

LibWeb: Implement usages property for CryptoKey

And set it from the only place we currently create a CryptoKey, in
importKey.
This commit is contained in:
Andrew Kaster 2024-03-06 19:11:08 -07:00 committed by Andrew Kaster
parent 2d59d6c98c
commit 0a6f195a71
5 changed files with 27 additions and 6 deletions

View file

@ -28,13 +28,15 @@ public:
bool extractable() const { return m_extractable; }
Bindings::KeyType type() const { return m_type; }
Object const* algorithm() const { return m_algorithm.ptr(); }
Object const* usages() const { return m_usages.ptr(); }
JS::Object const* algorithm() const { return m_algorithm; }
JS::Object const* usages() const { return m_usages; }
Vector<Bindings::KeyUsage> internal_usages() const { return m_key_usages; }
void set_extractable(bool extractable) { m_extractable = extractable; }
void set_type(Bindings::KeyType type) { m_type = type; }
void set_algorithm(JS::NonnullGCPtr<Object> algorithm) { m_algorithm = move(algorithm); }
void set_usages(JS::NonnullGCPtr<Object> usages) { m_usages = move(usages); }
void set_usages(Vector<Bindings::KeyUsage>);
private:
CryptoKey(JS::Realm&, InternalKeyData);
@ -46,6 +48,7 @@ private:
JS::NonnullGCPtr<Object> m_algorithm;
JS::NonnullGCPtr<Object> m_usages;
Vector<Bindings::KeyUsage> m_key_usages;
InternalKeyData m_key_data;
};