Closed dovigod closed 10 months ago
I never tried this in Cosmos space, but it might be possible using Secp256k1.recoverPubkey
. For this you need an ExtendedSecp256k1Signature
, which is just the signature plus a recovery param. If you don't have the recovery param you can loop through 0, 1, 2, 3 and check each public key you get.
@webmaster128 “Simon the Best” Thanks for answering, I’ll comment if this works :) thanks again
@webmaster128
YYYYEEEAAAhhhh it works!!!! once again, Thanks for the help :)
since I'd need to change signature(A) which is result of signAmino to ExtendedSecp256k1Signature,
what I did is, use 'A' as plain message and instantiate it to ExtendedSecp256k1Signature below is my source code.,
` const sigFromSignAmino = signature.signature.signature; // result of signAmino const x = new TextEncoder().encode(sigFromSignAmino); const hashBuffer = await crypto.subtle.digest("SHA-256", x); const privateKey = await getPrivateKeyFromMnemonic( seiWalletSet2.mnemonic ); const hashMessage = new Uint8Array(hashBuffer); const sig = await Secp256k1.createSignature( hashMessage, privateKey as Uint8Array ); console.log(sig); //extendedSig
const pubKey = await Secp256k1.recoverPubkey(sig, hashMessage);
console.dir(pubKey);
`
Hi devs, While verifing signature, is there way to verify by wallet address instead of using public key?
` const secp256K1PubKey = { type: "tendermint/PubKeySecp256k1", value: input.secp256k1PubKey } as Secp256k1Pubkey
`
while current codes works well, but I just want to verify signature with wallet address.
is there any way to do this?