summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Crypto
AgeCommit message (Collapse)Author
2023-04-03AK+Everywhere: Change AK::fill_with_random to accept a Bytes objectTimothy Flynn
Rather than the very C-like API we currently have, accepting a void* and a length, let's take a Bytes object instead. In almost all existing cases, the compiler figures out the length.
2023-03-16LibWeb: Move code that generates uuid into separate functionAliaksandr Kalenik
Make possible to generate uuid without having crypto class instance.
2023-03-10Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_caseAndreas Kling
Let's make it clear that these functions deal with ASCII case only.
2023-02-24LibWeb: Mark JS::Promise* return value for digest() with JS::NNGCPtrKenneth Myhra
2023-02-24LibWeb: Port SubtleCrypto to new StringKenneth Myhra
The algorithm comparison in digest() is done using a StringView to avoid complex error handling and promise rejection.
2023-02-24LibWeb: Port Crypto to new StringKenneth Myhra
2023-02-18LibWeb: Make factory method of Crypto::SubtleCrypto fallibleKenneth Myhra
2023-02-18LibWeb: Make factory method of Crypto::Crypto fallibleKenneth Myhra
2023-01-29LibJS+Everywhere: Propagate Cell::initialize errors from Heap::allocateTimothy Flynn
Callers that are already in a fallible context will now TRY to allocate cells. Callers in infallible contexts get a FIXME.
2023-01-29LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errorsTimothy Flynn
Note that as of this commit, there aren't any such throwers, and the call site in Heap::allocate will drop exceptions on the floor. This commit only serves to change the declaration of the overrides, make sure they return an empty value, and to propagate OOM errors frm their base initialize invocations.
2023-01-10LibWeb: Move setting of Web object prototypes to initialize()Timothy Flynn
This needs to happen before prototype/constructor intitialization can be made lazy. Otherwise, GC could run during the C++ constructor and try to collect the object currently being created.
2022-12-15LibJS: Convert Heap::allocate{,_without_realm}() to NonnullGCPtrLinus Groh
2022-12-14LibJS: Convert Promise::create() to NonnullGCPtrLinus Groh
2022-12-14LibJS: Convert ArrayBuffer::create() to NonnullGCPtrLinus Groh
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-10-01LibWeb: Remove unecessary dependence on Window from assorted classesAndrew Kaster
These classes only needed Window to get at its realm. Pass a realm directly to construct Crypto, Encoding, HRT, IntersectionObserver, NavigationTiming, Page, RequestIdleCallback, Selection, Streams, URL, and XML classes.
2022-09-25LibWeb: Move DOMException from DOM/ to WebIDL/Linus Groh
2022-09-25LibWeb: Move ExceptionOr from DOM/ to WebIDL/Linus Groh
This is a concept fully defined in the Web IDL spec and doesn't belong in the DOM directory/namespace - not even DOMException, despite the name :^)
2022-09-24LibWeb: Move IDLAbstractOperations from Bindings/ to WebIDL/Linus Groh
2022-09-21LibWeb: Remove WRAPPER_HACK() macroLinus Groh
We no longer access Bindings::FooWrapper anywhere for a Foo platform object, so these can be removed :^)
2022-09-12LibWeb: Visit internal fields of Crypto in visit_edgesdavidot
Not visiting the field holding SubtleCrypto in Crypto caused subtle crashes all over the Value functions, due to accessing SubtleCrypto after it was garbage collected (and potentially replaced by a new cell). This meant that the crashes were only appearing in Value::to_boolean, Value::typeof, etc. Which then held pointer to things that looked like Shapes, Environments and other non-Object Cells. To find the actual cause, all pointer used to construct Values were checked and if a pointer was none of the allowed types, the backtrace is logged. Co-authored-by: Luke Wilde <lukew@serenityos.org>
2022-09-06LibWeb: Stop using Bindings::wrap() in a bunch of placesAndreas Kling
wrap() is now basically a no-op so we should stop using it everywhere and eventually remove it. This patch removes uses of wrap() in non-generated code.
2022-09-06LibWeb: Make DOMException GC-allocatedAndreas Kling
2022-09-06LibWeb: Make Crypto GC-allocatedAndreas Kling
2022-09-06LibWeb: Make SubtleCrypto GC-allocatedAndreas Kling
2022-08-23LibWeb: Replace GlobalObject with Realm in wrapper functionsLinus Groh
Similar to create() in LibJS, wrap() et al. are on a low enough level to warrant passing a Realm directly instead of relying on the current realm from the VM, as a wrapper may need to be allocated while no JS is being executed.
2022-08-23LibJS+LibWeb: Replace GlobalObject with Realm in create() functionsLinus Groh
This is a continuation of the previous two commits. As allocating a JS cell already primarily involves a realm instead of a global object, and we'll need to pass one to the allocate() function itself eventually (it's bridged via the global object right now), the create() functions need to receive a realm as well. The plan is for this to be the highest-level function that actually receives a realm and passes it around, AOs on an even higher level will use the "current realm" concept via VM::current_realm() as that's what the spec assumes; passing around realms (or global objects, for that matter) on higher AO levels is pointless and unlike for allocating individual objects, which may happen outside of regular JS execution, we don't need control over the specific realm that is being used there.
2022-07-22LibWeb: Let get_buffer_source_copy() return ErrorOr instead of OptionalKenneth Myhra
This is a minor refactor of IDL::get_buffer_source_copy() letting it return ErrorOr<ByteBuffer> instead of Optional<ByteBuffer>. This also updates all places that use IDL::get_buffer_source_copy().
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-30LibWeb: Add Crypto.randomUUID()stelar7
2022-02-16LibWeb: Add imports to all IDL files that depend on othersAli Mohammad Pur
2022-01-24Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOrSam Atkins
Apologies for the enormous commit, but I don't see a way to split this up nicely. In the vast majority of cases it's a simple change. A few extra places can use TRY instead of manual error checking though. :^)
2021-12-15LibWeb: Use ByteBuffer::copy() instead of a manual copy in SubtleCryptoAli Mohammad Pur
Also use the HashManager(HashKind) constructor instead of the default constructor + manual initialize() call.
2021-12-14LibWeb: Implement SubtleCrypto.digest()Linus Groh
This is a simple implementation of SubtleCrypto.digest() using LibCrypto under the hood, so it supports all the required hash functions: SHA-1, SHA-256, SHA-384, SHA-512. Two FIXMEs remain: doing the hashing "in parallel", and supporting an object argument instead of a plain string.
2021-12-14LibWeb: Add the SubtleCrypto interfaceLinus Groh
Just some boilerplate code to get started :^) This adds both the SubtleCrypto constructor to the window object, as well as the crypto.subtle instance attribute.
2021-09-30LibWeb: Add the Web::Crypto namespace, built-in, and getRandomValuesIdan Horowitz
Since we don't support IDL typedefs or unions yet, the responsibility of verifying the type of the argument is temporarily moved from the generated Wrapper to the implementation.