Brought back new changes

This commit is contained in:
Marcus Bernales 2019-09-14 13:20:21 -07:00
parent 7d7b11f9b8
commit cf642b75d1
4 changed files with 15 additions and 4 deletions

9
sea.js
View File

@ -17,6 +17,13 @@
}
if(typeof module !== "undefined"){ var common = module }
/* UNBUILD */
function atob(a) {
return new Buffer(a, 'base64').toString('binary');
};
function btoa(b) {
return new Buffer(b).toString('base64');
};
;USE(function(module){
// Security, Encryption, and Authorization: SEA.js
@ -174,7 +181,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.");

View File

@ -1,4 +1,6 @@
function btoa(b) {
return new Buffer(b).toString('base64');
};
// This is Array extended to have .toString(['utf8'|'hex'|'base64'])
function SeaArray() {}
Object.assign(SeaArray, { from: Array.from })

View File

@ -1,4 +1,6 @@
function atob(a) {
return new Buffer(a, 'base64').toString('binary');
};
// 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'

View File

@ -22,7 +22,7 @@
random: (len) => Buffer.from(crypto.randomBytes(len))
});
//try{
const WebCrypto = require('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.");