Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #114 from LiraNuna/remove_atob_btoa
Browse files Browse the repository at this point in the history
Don't pollute global scope with atob and btoa
  • Loading branch information
microshine committed Jan 18, 2018
2 parents 19d482e + aca4686 commit 0257342
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions lib/webcrypto.ts
Expand Up @@ -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 {
Expand Down

0 comments on commit 0257342

Please sign in to comment.