Upgrade dependencies

This commit is contained in:
Boris Kubiak 2023-06-26 11:59:09 +02:00
parent 992b49799c
commit 46d8883e3e
3 changed files with 3571 additions and 2995 deletions

6548
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -21,11 +21,11 @@
"crypto-js": "^3.3.0",
"downloadjs": "^1.4.7",
"humanize-duration": "^3.27.0",
"keccak": "^3.0.1",
"randombytes": "^2.0.6",
"keccak": "^3.0.3",
"randombytes": "^2.1.0",
"register-service-worker": "^1.7.1",
"remodal": "^1.1.1",
"secp256k1": "^3.8.0",
"secp256k1": "^5.0.0",
"vue": "^2.6.11"
},
"devDependencies": {

View file

@ -10,7 +10,7 @@ const step = 500;
*/
const privateToAddress = (privateKey) => {
const pub = secp256k1.publicKeyCreate(privateKey, false).slice(1);
return keccak('keccak256').update(pub).digest().slice(-20).toString('hex');
return keccak('keccak256').update(Buffer.from(pub)).digest().slice(-20).toString('hex');
};
/**
@ -21,7 +21,7 @@ const getRandomWallet = () => {
const randbytes = randomBytes(32);
return {
address: privateToAddress(randbytes).toString('hex'),
privKey: randbytes.toString('hex')
privKey: randbytes.toString('hex'),
};
};
@ -83,13 +83,13 @@ const getVanityWallet = (input, isChecksum, isSuffix, cb) => {
while (!isValidVanityAddress(wallet.address, input, isChecksum, isSuffix)) {
if (attempts >= step) {
cb({attempts});
cb({ attempts });
attempts = 0;
}
wallet = getRandomWallet();
attempts++;
}
cb({address: '0x' + toChecksumAddress(wallet.address), privKey: wallet.privKey, attempts});
cb({ address: '0x' + toChecksumAddress(wallet.address), privKey: wallet.privKey, attempts });
};
onmessage = function (event) {
@ -97,10 +97,10 @@ onmessage = function (event) {
try {
getVanityWallet(input.hex, input.checksum, input.suffix, (message) => postMessage(message));
} catch (err) {
self.postMessage({error: err.toString()});
self.postMessage({ error: err.toString() });
}
};
module.exports = {
onmessage
onmessage,
};