summaryrefslogtreecommitdiff
path: root/ext/crypto/00_crypto.js
AgeCommit message (Collapse)Author
2024-10-07feat(ext/crypto): X448 support (#26043)Divy Srivastava
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-09-20fix(ext/crypto): reject empty usages in SubtleCrypto#importKey (#25759)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/19051
2024-09-05refactor(ext/crypto): align error messages (#25440)Ian Bull
Aligns the error messages in the ext/crypto folder to be in-line with the Deno style guide. https://github.com/denoland/deno/issues/25269
2024-07-04feat(ext/crypto): make deriveBits length parameter optional and nullable ↵Filip Skokan
(#24426) Updates SubtleCrypto.prototype.deriveBits as per https://github.com/w3c/webcrypto/pull/345 (WPT update in https://github.com/web-platform-tests/wpt/pull/43400)
2024-01-26refactor: migrate extensions to virtual ops module (#22135)Bartek Iwańczuk
First pass of migrating away from `Deno.core.ensureFastOps()`. A few "tricky" ones have been left for a follow up.
2024-01-10refactor: use `core.ensureFastOps()` (#21888)Kenta Moriuchi
2024-01-06feat(ext/crypto): initial support for p521 in `generateKey` and `importKey` ↵Divy Srivastava
(#21815) Part 1 of a potential 3 part series. Ref #13449 The current implementation passes key material back and forth RustCrypto group of crates and ring. ring does not implement p521 yet. This PR adds support for P521 named curve in `generateKey` and `importKey` where we use RustCrypto. Other parts should be moved over to the RustGroup group of crates for consistency.
2024-01-04fix: strict type check for cross realms (#21669)Kenta Moriuchi
Deno v1.39 introduces `vm.runInNewContext`. This may cause problems when using `Object.prototype.isPrototypeOf` to check built-in types. ```js import vm from "node:vm"; const err = new Error(); const crossErr = vm.runInNewContext(`new Error()`); console.assert( !(crossErr instanceof Error) ); console.assert( Object.getPrototypeOf(err) !== Object.getPrototypeOf(crossErr) ); ``` This PR changes to check using internal slots solves them. --- current: ``` > import vm from "node:vm"; undefined > vm.runInNewContext(`new Error("message")`) Error {} > vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`) Date {} ``` this PR: ``` > import vm from "node:vm"; undefined > vm.runInNewContext(`new Error("message")`) Error: message at <anonymous>:1:1 > vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`) 2018-12-10T02:26:59.002Z ``` --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-27perf: remove opAsync (#21690)Matt Mastracci
`opAsync` requires a lookup by name on each async call. This is a mechanical translation of all opAsync calls to ensureFastOps. The `opAsync` API on Deno.core will be removed at a later time.
2023-12-07refactor: pull 'core', 'internals', 'primordials' from ES module (#21462)Bartek Iwańczuk
This commit refactors how we access "core", "internals" and "primordials" objects coming from `deno_core`, in our internal JavaScript code. Instead of capturing them from "globalThis.__bootstrap" namespace, we import them from recently added "ext:core/mod.js" file.
2023-11-19fix(ext,runtime): add missing custom inspections (#21219)Kenta Moriuchi
2023-10-30chore: upgrade rsa to 0.9 (#21016)Divy Srivastava
2023-10-10fix(ext/web): writability of `ReadableStream.from` (#20836)Luca Casonato
Fixes a WPT in `URL` and `ReadableStream`. Some unrelated WPT expectation changes due to WPT update.
2023-08-31fix(ext/crypto): remove EdDSA alg key checks and export (#20331)Filip Skokan
As per https://github.com/WICG/webcrypto-secure-curves/pull/24 this removes the check for Ed25519 JWK `alg` during importKey and removes the `alg` for Ed25519 keys during JWK exportKey.
2023-06-26chore: fix typos (#19572)Martin Fischer
2023-06-23fix(serde_v8): Do not coerce values in serde_v8 (#19569)Divy Srivastava
Fixes #19568 Values are not coerced to the desired type during deserialisation. This makes serde_v8 stricter. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-19fix(deno/ext): Fix WebCrypto API's deriveKey (#19545)Santhanam
Fixes a bug I noticed when deriving a key based from `ECDH`. Similar issue is also mentioned in #14693, where they derive a key using `PBKDF2` - In the WebCrypto API, `deriveKey()` is equivalent to `deriveBits()` followed by `importKey()` - But, `deriveKey()` requires just `deriveKey` in the `usages` of the `baseKey` parameter. The `deriveBits` usage is not required to be allowed. This is the uniform behaviour in Node, Chrome and Firefox. - The impl currently has userland-accessible `SubtleCrypto.deriveKey()` and `SubtleCrypto.deriveBits()`, as well as an internal `deriveBits()` (this is the one that accesses the ffi). - Also, `SubtleCrypto.deriveKey()` checks if `deriveKey` is an allowed usage and `SubtleCrypto.deriveBits()` checks if `deriveBits` is an allowed usage, as required. - However, the impl currently calls the userland accessible `SubtleCrypto.deriveBits()` in `SubtleCrypto.deriveKey()`, leading to an error being thrown if the `deriveBits` usage isn't present. - Fixed this by making it call the internal `deriveBits()` instead.
2023-06-05fix(ext/crypto): fix JWK import of Ed25519 (#19279)Levente Kurusa
Fixes: #18049 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-09fix(core): let V8 drive extension ESM loads (#18997)Luca Casonato
This now allows circular imports across extensions. Instead of load + eval of all ESM files in declaration order, all files are only loaded. Eval is done recursively by V8, only evaluating files that are listed in `Extension::esm_entry_point` fields. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-08refactor: prefix ops w/ crate they are defined in (#19044)Luca Casonato
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-02refactor(core): Use `ObjectHasOwn` instead of ↵Kenta Moriuchi
`ObjectPrototypeHasOwnProperty` (#18952) ES2022 `Object.hasOwn` can be used in snapshot, so I migrate to use it.
2023-05-01fix(core): Use primordials for methods (#18839)Kenta Moriuchi
I would like to get this change into Deno before merging https://github.com/denoland/deno_lint/pull/1152
2023-05-01refactor(webidl): move prefix & context out of converters options bag (#18931)Leo Kettmeir
2023-04-14fix(core): Use safe primordials wrappers (#18687)Kenta Moriuchi
2023-04-12refactor(ext/webidl): remove object from 'requiredArguments' (#18674)Bartek Iwańczuk
This should produce a little less garbage and using an object here wasn't really required. --------- Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com> Co-authored-by: Leo Kettmeir <crowlkats@toaxl.com>
2023-04-02chore: Turn back on dlintPreferPrimordials (#17715)Kenta Moriuchi
Closes #17709
2023-03-08refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme ↵Bartek Iwańczuk
for snapshotted modules (#18041) This commit renames "deno_core::InternalModuleLoader" to "ExtModuleLoader" and changes the specifiers used by the modules loaded from this loader to "ext:". "internal:" scheme was really ambiguous and it's more characters than "ext:", which should result in slightly smaller snapshot size. Closes https://github.com/denoland/deno/issues/18020
2023-03-05fix(ext/crypto): correctly limit ECDSA and hash algorithms (#18030)Filip Skokan
Closes #18029
2023-02-07 refactor: remove prefix from include_js_files & use extension name (#17683)Leo Kettmeir
2023-02-07refactor: Use ES modules for internal runtime code (#17648)Leo Kettmeir
This PR refactors all internal js files (except core) to be written as ES modules. `__bootstrap`has been mostly replaced with static imports in form in `internal:[path to file from repo root]`. To specify if files are ESM, an `esm` method has been added to `Extension`, similar to the `js` method. A new ModuleLoader called `InternalModuleLoader` has been added to enable the loading of internal specifiers, which is used in all situations except when a snapshot is only loaded, and not a new one is created from it. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-18chore(ext/crypto): Update rsa to 0.7.0 (#16327)Kyle Willmon
Bump the rsa crate to 0.7.0 The API for the `rsa` crate has changed significantly, but I have verified that tests continue to pass throughout this update.
2023-01-02chore: update copyright year to 2023 (#17247)David Sherret
Yearly tradition of creating extra noise in git.
2022-12-22fix(ext): Add checks for owning properties in for-in loops (#17139)Kenta Moriuchi
In the for-in loops, there were a few places where we forgot to check if objects owned some properties, so I added them.
2022-12-20chore: Update dlint (#17031)Kenta Moriuchi
Introduces `SafeSetIterator` and `SafeMapIterator` to primordials
2022-10-28fix(ext/crypto): fix HMAC jwk import "use" check (#16465)Filip Skokan
2022-10-15fix(ext/crypto): correct HMAC get key length op (#16201)Filip Skokan
fixes #16180 `HMAC`'s `get key length` `op` uses the hash function's block size, not output size. refs https://github.com/cloudflare/workerd/issues/68#issuecomment-1271189657
2022-10-09perf(ext/crypto): optimize `getRandomValues` (#16212)Divy Srivastava
2022-10-04fix(ext/crypto): ECDH and X25519 non byte length and 0 length fixes (#16146)Filip Skokan
2022-10-03fix(ext/crypto): deriveBits for ECDH not taking length into account (#16128)Aurélien Bertron
Fixes #16047
2022-10-03fix(ext/crypto): curve25519 import export (#16140)Filip Skokan
2022-09-30fix(ext/crypto): use correct handle for public keys (#16099)Colin Ihrig
When storing public and private keys in the key store, use a different handle for each key so that they can be looked up in the future. Refs: https://github.com/denoland/deno/pull/14119 Refs: https://github.com/denoland/deno_std/issues/2631
2022-09-27feat(ext/crypto): add x25519 and Ed25519 CFRG curves (#14119)Divy Srivastava
2022-08-11perf(ops): Monomorphic sync op calls (#15337)Aapo Alasuutari
Welcome to better optimised op calls! Currently opSync is called with parameters of every type and count. This most definitely makes the call megamorphic. Additionally, it seems that spread params leads to V8 not being able to optimise the calls quite as well (apparently Fast Calls cannot be used with spread params). Monomorphising op calls should lead to some improved performance. Now that unwrapping of sync ops results is done on Rust side, this is pretty simple: ``` opSync("op_foo", param1, param2); // -> turns to ops.op_foo(param1, param2); ``` This means sync op calls are now just directly calling the native binding function. When V8 Fast API Calls are enabled, this will enable those to be called on the optimised path. Monomorphising async ops likely requires using callbacks and is left as an exercise to the reader.
2022-06-08feat(ext/crypto): export elliptic keys as "raw" (#14764)diachedelic
This commit adds support for the "raw" format when exporting public ECDH/ECDSA keys via the SubtleCrypto.exportKey method.
2022-04-07fix(ext/crypto): check extractable in exportKey (#14222)EduM22
2022-03-11fix(ext/crypto): handle JWK import with "use" (#13912)Filip Skokan
2022-03-09chore(ext/crypto): remove old todos (#13887)Divy Srivastava
2022-03-02feat(ext/crypto): AES-GCM support for 128bit IVs (#13805)Divy Srivastava
2022-02-16fix(ext/crypto): optional additionalData in encrypt/decrypt (#13669)Divy Srivastava