Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return function validate(signature) {
let recovered = sigUtil.recoverPersonalSignature({
data: message,
sig: signature
})
return norm(account) === norm(recovered)
}
}
.then((sig) => {
assert.notEqual(sig, message, 'something changed')
const restored = sigUtil.recoverPersonalSignature({
data: message,
sig,
})
assert.equal(restored, sigUtil.normalize(address), 'recovered address')
done()
})
.catch((reason) => {
const recovertSign = (params) => {
const { signedToken, signText } = params;
return sigUtil.recoverPersonalSignature({
data: signText,
sig: signedToken
});
};
function (err, result) {
if (err) {
return errorCallback(err);
}
if (result.error) {
return errorCallback(result.error);
}
const msgParams = {data: msg, sig: result.result};
const recovered = sigUtil.recoverPersonalSignature(msgParams);
if (recovered === currentAddress) {
saveTokenToLocalStorage(currentAddress, result.result);
return successCallback();
} else {
return errorCallback();
}
}
);
HookedWalletSubprovider.prototype.recoverPersonalSignature = function(msgParams, cb) {
let senderHex
try {
senderHex = sigUtil.recoverPersonalSignature(msgParams)
} catch (err) {
return cb(err)
}
cb(null, senderHex)
}
async verifySignature (data, signature) {
return sigUtil.recoverPersonalSignature({ data: data, sig: signature })
}
})
let matchingKey: OwnedKey | undefined
if (queryResults.data) {
matchingKey = queryResults.data.keyHolders[0].keys.find((key: OwnedKey) => {
return key.lock.address === lockAddress
})
}
const secondsElapsedFromSignature = Math.floor(
(Date.now() - timestamp) / 1000
)
const identityIsValid =
sigUtil.recoverPersonalSignature({
data: hexData,
sig,
}) === accountAddress.toLowerCase()
return (
<div>
{matchingKey && <h1>{matchingKey.lock.name}</h1>}
</div>