Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DENO 2 related issue. Update helper.ts #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 3 additions & 9 deletions src/helper.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { decode as base64Decode } from "https://deno.land/std/encoding/base64.ts"; // Not sure where we should place imports ;)

export function str2bytes(str: string): Uint8Array {
const encoder = new TextEncoder();
return encoder.encode(str);
Expand Down Expand Up @@ -57,13 +59,5 @@ export function get_key_size(n: bigint): number {
}

export function base64_to_binary(b: string): Uint8Array {
const binaryString = atob(b);
const len = binaryString.length;
const bytes = new Uint8Array(len);

for (let i = 0; i < len; i++) {
bytes[i] = binaryString.charCodeAt(i);
}

return bytes;
return base64Decode(b);
}