mirror of https://github.com/status-im/js-waku.git
Fix typo
This commit is contained in:
parent
e9a1d88512
commit
e59e9f4162
|
@ -55,9 +55,9 @@ export async function createPublicKeyMessage(
|
||||||
* Validate that the EthDm Public Key was signed by the holder of the given Ethereum address.
|
* Validate that the EthDm Public Key was signed by the holder of the given Ethereum address.
|
||||||
*/
|
*/
|
||||||
export function validatePublicKeyMessage(msg: PublicKeyMessage): boolean {
|
export function validatePublicKeyMessage(msg: PublicKeyMessage): boolean {
|
||||||
const formatedMsg = formatPublicKeyForSignature(msg.ethDmPublicKey);
|
const formattedMsg = formatPublicKeyForSignature(msg.ethDmPublicKey);
|
||||||
try {
|
try {
|
||||||
const sigAddress = ethers.utils.verifyMessage(formatedMsg, msg.signature);
|
const sigAddress = ethers.utils.verifyMessage(formattedMsg, msg.signature);
|
||||||
const sigAddressBytes = Buffer.from(sigAddress.replace(/0x/, ''), 'hex');
|
const sigAddressBytes = Buffer.from(sigAddress.replace(/0x/, ''), 'hex');
|
||||||
// Compare the actual byte arrays instead of strings that may differ in casing or prefixing.
|
// Compare the actual byte arrays instead of strings that may differ in casing or prefixing.
|
||||||
const cmp = sigAddressBytes.compare(new Buffer(msg.ethAddress));
|
const cmp = sigAddressBytes.compare(new Buffer(msg.ethAddress));
|
||||||
|
@ -70,7 +70,7 @@ export function validatePublicKeyMessage(msg: PublicKeyMessage): boolean {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(
|
console.log(
|
||||||
'Failed to verify signature for Public Key Message',
|
'Failed to verify signature for Public Key Message',
|
||||||
formatedMsg,
|
formattedMsg,
|
||||||
msg
|
msg
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue