From aca4686ee9560ffd2644d6ba994595019b50334f Mon Sep 17 00:00:00 2001 From: Liran Nuna Date: Wed, 17 Jan 2018 21:15:36 -0800 Subject: [PATCH] Don't pollute global scope with atob and btoa Fixes #99 --- lib/webcrypto.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/webcrypto.ts b/lib/webcrypto.ts index f4301ef..02d93d1 100644 --- a/lib/webcrypto.ts +++ b/lib/webcrypto.ts @@ -6,11 +6,6 @@ import * as webcrypto from "webcrypto-core"; import { KeyStorage } from "./key_storage"; import * as subtle from "./subtle"; -// Fix btoa and atob for NodeJS -const g = global as any; -g.btoa = (data: string) => new Buffer(data, "binary").toString("base64"); -g.atob = (data: string) => new Buffer(data, "base64").toString("binary"); - const ERR_RANDOM_VALUE_LENGTH = "Failed to execute 'getRandomValues' on 'Crypto': The ArrayBufferView's byte length (%1) exceeds the number of bytes of entropy available via this API (65536)."; export interface WebCryptoOptions {