|
@@ -47,6 +47,15 @@
|
|
|
})(USE, './https');
|
|
|
|
|
|
;USE(function(module){
|
|
|
+ if(typeof global !== "undefined"){
|
|
|
+ var g = global;
|
|
|
+ g.btoa = function (data) { return Buffer.from(data, "binary").toString("base64"); };
|
|
|
+ g.atob = function (data) { return Buffer.from(data, "base64").toString("binary"); };
|
|
|
+ }
|
|
|
+ })(USE, './base64');
|
|
|
+
|
|
|
+ ;USE(function(module){
|
|
|
+ USE('./base64');
|
|
|
// This is Array extended to have .toString(['utf8'|'hex'|'base64'])
|
|
|
function SeaArray() {}
|
|
|
Object.assign(SeaArray, { from: Array.from })
|
|
@@ -72,6 +81,7 @@
|
|
|
})(USE, './array');
|
|
|
|
|
|
;USE(function(module){
|
|
|
+ USE('./base64');
|
|
|
// This is Buffer implementation used in SEA. Functionality is mostly
|
|
|
// compatible with NodeJS 'safe-buffer' and is used for encoding conversions
|
|
|
// between binary and 'hex' | 'utf8' | 'base64'
|
|
@@ -174,7 +184,7 @@
|
|
|
random: (len) => Buffer.from(crypto.randomBytes(len))
|
|
|
});
|
|
|
//try{
|
|
|
- const WebCrypto = USE('node-webcrypto-ossl', 1);
|
|
|
+ const { Crypto: WebCrypto } = USE('@peculiar/webcrypto', 1);
|
|
|
api.ossl = api.subtle = new WebCrypto({directory: 'ossl'}).subtle // ECDH
|
|
|
//}catch(e){
|
|
|
//console.log("node-webcrypto-ossl is optionally needed for ECDH, please install if needed.");
|