gun/sea/base64.js
sirpy 29ed57e955
react native support (#5)
* WIP: use isomorphic-webcrypto for RN

* WIP: expo friendly exports

* WIP: buffer for RN

* WIP: textencoder for RN

* WIP: aeskey from jwk instead of raw for RN

* fix: missing taglength for msrcrypto

* add: update isomorphic-webcrypto

* add: match isocrypto api

* add: failing test for 4e2 as 400

* fix: remove extra atob btoa

* add: sea unbuild

* refactor: according to mhelander review

* refactor: shorter require

* fix: make bug test pass, capitlize bug test.

* fix: npm ci + sea test

* add: restore old browser export and add react-native friendly exports

* fix: import buffer into correct global/window

* fix: bad comparison

* fix: only include buffer if no btoa/atob
2019-12-08 17:41:26 +02:00

9 lines
331 B
JavaScript

if(typeof btoa === "undefined"){
if(typeof Buffer === "undefined") {
root.Buffer = require("buffer").Buffer
}
root.btoa = function (data) { return Buffer.from(data, "binary").toString("base64"); };
root.atob = function (data) { return Buffer.from(data, "base64").toString("binary"); };
}