1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-04 15:00:23 +01:00

Fixed public key error with existed private key

This commit is contained in:
Donald Cheng Hong Zou 2022-01-31 09:38:05 -05:00
parent eaad971c0a
commit 99fb07c6b3
2 changed files with 14 additions and 2 deletions

View File

@ -171,6 +171,17 @@
return String.fromCharCode.apply(null, base64);
}
function base64ToKey(base64) {
let binary_string = window.atob(base64);
let len = binary_string.length;
let bytes = new Uint8Array(len);
for (let i = 0; i < len; i++) {
bytes[i] = binary_string.charCodeAt(i);
}
let uint8 = new Uint8Array(bytes.buffer);
return uint8;
}
function putU32(b, n)
{
b.push(n & 0xff, (n >>> 8) & 0xff, (n >>> 16) & 0xff, (n >>> 24) & 0xff);
@ -282,7 +293,8 @@
};
},
generatePublicKey: function (privateKey){
return keyToBase64(generatePublicKey(privateKey))
privateKey = base64ToKey(privateKey);
return keyToBase64(generatePublicKey(privateKey));
},
generateZipFiles: function(res){

File diff suppressed because one or more lines are too long