Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cryptoRandomString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const generateForCustomCharacters: GenerateForCustomCharacters = (

const generateRandomBytes: GenerateRandomBytes = (byteLength, type, length) => {
const bytes = randomBytes(byteLength);
const str = type === "base64" ? encodeToBase64(bytes) : encodeToHex(bytes);
const str = type === "base64" ? encodeToBase64(bytes) : new TextDecoder().decode(encodeToHex(bytes));
return str.slice(0, length);
};

Expand Down
4 changes: 2 additions & 2 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { encodeToString as encodeToHex } from "https://deno.land/std@0.99.0/encoding/hex.ts";
export { encode as encodeToBase64 } from "https://deno.land/std@0.99.0/encoding/base64.ts";
export { encode as encodeToHex } from "https://deno.land/std@0.167.0/encoding/hex.ts";
export { encode as encodeToBase64 } from "https://deno.land/std@0.167.0/encoding/base64.ts";
2 changes: 1 addition & 1 deletion test_deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export {
assertEquals,
assertMatch,
assertThrows,
} from "https://deno.land/std@0.83.0/testing/asserts.ts";
} from "https://deno.land/std@0.167.0/testing/asserts.ts";