...
 
......@@ -37,6 +37,7 @@ push_to_github:
- .gitlab-ci.yml
- index.ts
- package.json
- yarn.lock
- releases/**/*
- server.ts
- test/**/*
......
......@@ -72,8 +72,8 @@ export function randomKey() {
}
const keypair = nacl.sign.keyPair.fromSeed(byteseed)
return new Key(
Base58encode(new Buffer(keypair.publicKey)),
Base58encode(new Buffer(keypair.secretKey))
Base58encode(Buffer.from(keypair.publicKey)),
Base58encode(Buffer.from(keypair.secretKey))
)
}
......
......@@ -28,7 +28,7 @@ export const encodeUTF8 = function(arr:any[]) {
export const encodeBase64 = function(arr:Uint8Array) {
if (typeof btoa === 'undefined' || !window) {
return (new Buffer(arr)).toString('base64');
return (Buffer.from(arr)).toString('base64');
} else {
let i, s = [], len = arr.length;
for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
......@@ -38,10 +38,10 @@ export const encodeBase64 = function(arr:Uint8Array) {
export const decodeBase64 = function(s:string) {
if (typeof atob === 'undefined' || !window) {
return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
} else {
let i, d = atob(s), b = new Uint8Array(d.length);
for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
return b;
}
}
\ No newline at end of file
}
......@@ -32,8 +32,8 @@ export const Scrypt = async (salt:string, key:string, N = 4096, r = 16, p = 1) =
const keyBytes = await getScryptKey(key, salt, N, r, p)
const pair = nacl.sign.keyPair.fromSeed(keyBytes);
return {
pub: Base58encode(new Buffer(pair.publicKey, 'hex')),
sec: Base58encode(new Buffer(pair.secretKey, 'hex'))
pub: Base58encode(Buffer.from(pair.publicKey, 'hex')),
sec: Base58encode(Buffer.from(pair.secretKey, 'hex'))
};
}
......