god_crypto icon indicating copy to clipboard operation
god_crypto copied to clipboard

DENO 2 related issue. Update helper.ts

Open shaunie2fly opened this issue 7 months ago • 0 comments

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.

shaunie2fly avatar Jul 19 '24 02:07 shaunie2fly