Skip to content

Commit

Permalink
format + lint
Browse files Browse the repository at this point in the history
Signed-off-by: Levente Kurusa <lkurusa@kernelstuff.org>
  • Loading branch information
levex committed Apr 11, 2023
1 parent 94d41c5 commit 7423a1d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion ext/node/crypto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use deno_core::StringOrBuffer;
use deno_core::ZeroCopyBuf;
use hkdf::Hkdf;
use num_bigint::BigInt;
use rand::distributions::{Distribution, Uniform};
use rand::distributions::Distribution;
use rand::distributions::Uniform;
use rand::Rng;
use std::future::Future;
use std::rc::Rc;
Expand Down
15 changes: 8 additions & 7 deletions ext/node/polyfills/internal/crypto/_randomFill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ export default function randomFill(
assertOffset(offset as number, buf.length);
assertSize(size as number, offset as number, buf.length);

core.opAsync("op_node_generate_secret_async", Math.floor(size as number)).then(
(randomData: Uint8Array) => {
const randomBuf = Buffer.from(randomData.buffer);
randomBuf.copy(buf, offset as number, 0, size as number);
cb!(null, buf);
},
);
core.opAsync("op_node_generate_secret_async", Math.floor(size as number))
.then(
(randomData: Uint8Array) => {
const randomBuf = Buffer.from(randomData.buffer);
randomBuf.copy(buf, offset as number, 0, size as number);
cb!(null, buf);
},
);
}

export function randomFillSync(buf: Buffer, offset = 0, size?: number) {
Expand Down

0 comments on commit 7423a1d

Please sign in to comment.