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

Don't pollute global scope with atob and btoa #114

Merged
merged 1 commit into from Jan 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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