mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
refactor(node/crypto): scrypt polyfill to rust (#18746)
This commit is contained in:
parent
74aee8b305
commit
530963c34c
6 changed files with 167 additions and 179 deletions
|
@ -2,8 +2,11 @@
|
|||
import { scrypt, scryptSync } from "node:crypto";
|
||||
import { Buffer } from "node:buffer";
|
||||
import { assertEquals } from "../../../../test_util/std/testing/asserts.ts";
|
||||
import { deferred } from "../../../../test_util/std/async/deferred.ts";
|
||||
|
||||
Deno.test("scrypt works correctly", async () => {
|
||||
const promise = deferred();
|
||||
|
||||
Deno.test("scrypt works correctly", () => {
|
||||
scrypt("password", "salt", 32, (err, key) => {
|
||||
if (err) throw err;
|
||||
assertEquals(
|
||||
|
@ -43,10 +46,15 @@ Deno.test("scrypt works correctly", () => {
|
|||
115,
|
||||
]),
|
||||
);
|
||||
promise.resolve(true);
|
||||
});
|
||||
|
||||
await promise;
|
||||
});
|
||||
|
||||
Deno.test("scrypt works with options", () => {
|
||||
Deno.test("scrypt works with options", async () => {
|
||||
const promise = deferred();
|
||||
|
||||
scrypt(
|
||||
"password",
|
||||
"salt",
|
||||
|
@ -93,8 +101,11 @@ Deno.test("scrypt works with options", () => {
|
|||
71,
|
||||
]),
|
||||
);
|
||||
promise.resolve(true);
|
||||
},
|
||||
);
|
||||
|
||||
await promise;
|
||||
});
|
||||
|
||||
Deno.test("scryptSync works correctly", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue