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

Conversation

shaunie2fly
Copy link

update base64_to_binary function .

In browser JavaScript, atob() is used to decode a base64-encoded string. It's part of the Web APIs, which aren't natively available in Deno's runtime environment.

After enabling DENO_FUTURE=1 we now get thsi error :

error: Uncaught (in promise) ReferenceError: window is not defined
let binaryString = window.atob(b);
^
at base64_to_binary (https://deno.land/x/[email protected]/src/helper.ts:60:22)
at rsa_import_pem_public (https://deno.land/x/[email protected]/src/rsa/import_key.ts:132:16)
at rsa_import_pem (https://deno.land/x/[email protected]/src/rsa/import_key.ts:160:50)
at rsa_import_key (https://deno.land/x/[email protected]/src/rsa/import_key.ts:179:37)
at Function.importKey (https://deno.land/x/[email protected]/src/rsa/mod.ts:102:23)
at Function.parseKey (https://deno.land/x/[email protected]/src/rsa/mod.ts:89:17)

atob() is a global function in browser environments, typically accessed via window.atob(). In Deno, especially with DENO_FUTURE=1, this global function isn't available by default.

update base64_to_binary function .

In browser JavaScript, atob() is used to decode a base64-encoded string. It's part of the Web APIs, which aren't natively available in Deno's runtime environment.

After enabling DENO_FUTURE=1 we now get thsi error :

error: Uncaught (in promise) ReferenceError: window is not defined
  let binaryString = window.atob(b);
                     ^
    at base64_to_binary (https://deno.land/x/[email protected]/src/helper.ts:60:22)
    at rsa_import_pem_public (https://deno.land/x/[email protected]/src/rsa/import_key.ts:132:16)
    at rsa_import_pem (https://deno.land/x/[email protected]/src/rsa/import_key.ts:160:50)
    at rsa_import_key (https://deno.land/x/[email protected]/src/rsa/import_key.ts:179:37)
    at Function.importKey (https://deno.land/x/[email protected]/src/rsa/mod.ts:102:23)
    at Function.parseKey (https://deno.land/x/[email protected]/src/rsa/mod.ts:89:17)

atob() is a global function in browser environments, typically accessed via window.atob().
In Deno, especially with DENO_FUTURE=1, this global function isn't available by default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant