diff --git a/cryptoRandomString.ts b/cryptoRandomString.ts index a88d8e9..4757868 100644 --- a/cryptoRandomString.ts +++ b/cryptoRandomString.ts @@ -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); }; diff --git a/deps.ts b/deps.ts index b081789..6cd1403 100644 --- a/deps.ts +++ b/deps.ts @@ -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"; diff --git a/test_deps.ts b/test_deps.ts index 988d136..d60babd 100644 --- a/test_deps.ts +++ b/test_deps.ts @@ -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";