Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/crypto): adjust getRandomValues types #14714

Merged
merged 7 commits into from
Jun 2, 2022
12 changes: 12 additions & 0 deletions cli/tests/unit/get_random_values_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,24 @@ Deno.test(function getRandomValuesInt32Array() {
assertNotEquals(arr, new Int32Array(8));
});

Deno.test(function getRandomValuesBigInt64Array() {
const arr = new BigInt64Array(8);
crypto.getRandomValues(arr);
assertNotEquals(arr, new BigInt64Array(8));
});

Deno.test(function getRandomValuesUint32Array() {
const arr = new Uint32Array(8);
crypto.getRandomValues(arr);
assertNotEquals(arr, new Uint32Array(8));
});

Deno.test(function getRandomValuesBigUint64Array() {
const arr = new BigUint64Array(8);
crypto.getRandomValues(arr);
assertNotEquals(arr, new BigUint64Array(8));
});

Deno.test(function getRandomValuesReturnValue() {
const arr = new Uint32Array(8);
const rtn = crypto.getRandomValues(arr);
Expand Down
4 changes: 2 additions & 2 deletions ext/crypto/lib.deno_crypto.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ declare interface Crypto {
| Uint16Array
| Uint32Array
| Uint8ClampedArray
| Float32Array
| Float64Array
| BigInt64Array
| BigUint64Array
mrkldshv marked this conversation as resolved.
Show resolved Hide resolved
| DataView
| null,
>(
Expand Down