Skip to content

Commit

Permalink
fix: move from imports to deps.ts
Browse files Browse the repository at this point in the history
fixes #13
  • Loading branch information
oplik0 committed Dec 26, 2023
1 parent 88b0558 commit 304192e
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 12 deletions.
14 changes: 14 additions & 0 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export {
assert,
assertEquals,
} from "https://deno.land/std@0.210.0/assert/mod.ts";
export { timingSafeEqual } from "https://deno.land/std@0.210.0/crypto/timing_safe_equal.ts";
export { crypto } from "https://deno.land/std@0.210.0/crypto/mod.ts";
export {
decodeBase64,
encodeBase64,
} from "https://deno.land/std@0.210.0/encoding/base64.ts";
export {
decodeHex,
encodeHex,
} from "https://deno.land/std@0.210.0/encoding/hex.ts";
4 changes: 2 additions & 2 deletions lib/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* @todo document this module
*/
import { crypto } from "std/crypto/mod.ts";
import { decodeBase64, encodeBase64 } from "std/encoding/base64.ts";
import { crypto } from "../deps.ts";
import { decodeBase64, encodeBase64 } from "../deps.ts";
import { hmacSHA256 } from "./hmac.ts";
// dprint-ignore-next-line
// deno-fmt-ignore
Expand Down
2 changes: 1 addition & 1 deletion lib/helpers_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from "std/assert/mod.ts";
import { assertEquals } from "../deps.ts";

import { decomposeFormat, ScryptParameters } from "./helpers.ts";

Expand Down
2 changes: 1 addition & 1 deletion lib/hmac.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* A very primitive crypto.subtle.digestSync-based HMAC-SHA256 synchronous implementation.
*/
import { crypto } from "std/crypto/mod.ts";
import { crypto } from "../deps.ts";

function mergeArrays(a: Uint8Array, b: Uint8Array): Uint8Array {
const result = new Uint8Array(a.length + b.length);
Expand Down
2 changes: 1 addition & 1 deletion lib/hmac_bench.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { decodeHex } from "std/encoding/hex.ts";
import { decodeHex } from "../deps.ts";
import { hmacSHA256 } from "./hmac.ts";
import { HmacSha256 } from "https://deno.land/std@0.160.0/hash/sha256.ts";

Expand Down
4 changes: 2 additions & 2 deletions lib/hmac_test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { hmacSHA256 } from "./hmac.ts";
import { decodeHex } from "std/encoding/hex.ts";
import { assertEquals } from "std/assert/assert_equals.ts";
import { decodeHex } from "../deps.ts";
import { assertEquals } from "../deps.ts";

const encoder = new TextEncoder();

Expand Down
4 changes: 2 additions & 2 deletions lib/scrypt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { encodeBase64 } from "std/encoding/base64.ts";
import { encodeHex } from "std/encoding/hex.ts";
import { encodeBase64 } from "../deps.ts";
import { encodeHex } from "../deps.ts";
import { instantiate, scrypt_hash } from "./_wasm/scrypt_wasm.generated.js";
const encoder: TextEncoder = new TextEncoder();
const decoder: TextDecoder = new TextDecoder("utf-8");
Expand Down
2 changes: 1 addition & 1 deletion lib/scrypt_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from "std/assert/mod.ts";
import { assertEquals } from "../deps.ts";
import { scrypt } from "./scrypt.ts";

Deno.test("scrypt #1", (): void => {
Expand Down
2 changes: 1 addition & 1 deletion mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
to32bytes,
} from "./lib/helpers.ts";
import { scrypt } from "./lib/scrypt.ts";
import { timingSafeEqual } from "std/crypto/timing_safe_equal.ts";
import { timingSafeEqual } from "./deps.ts";

const encoder = new TextEncoder();

Expand Down
2 changes: 1 addition & 1 deletion mod_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert, assertEquals } from "std/assert/mod.ts";
import { assert, assertEquals } from "./deps.ts";
import { hash, verify } from "./mod.ts";

Deno.test("basic hashing - scrypt format", (): void => {
Expand Down

0 comments on commit 304192e

Please sign in to comment.