Jesse Sawa
Jesse Sawa

Reputation: 21

How do you verify a signature originated from a given Tezos wallet?

After connecting to a Tezos wallet, you can send over a payload requesting it be signed.

Given the signature, wallet address, and a pre-defined message (payload) what are the steps to determine the authenticity of that signature.

Upvotes: 2

Views: 322

Answers (2)

Dapp Composer
Dapp Composer

Reputation: 198

import { verifySignature } from '@taquito/utils';
verifySignature(
  payloadBytes,
  publicKey,
  updateAatarLinkDto.signature,
);

You need to include payloadBytes and signature to verify.

Upvotes: 1

Michael Zaikin
Michael Zaikin

Reputation: 995

You can do that in C# using Netezos library.

First, you need to obtain the public key for a given wallet address:

using Netezos.Rpc;

using var rpc = new TezosRpc("https://mainnet-tezos.giganode.io/");

var rawPubKey = await rpc.Blocks.Head.Context.Contracts[address].ManagerKey.GetAsync<string>();

Then you can verify the signature:

using Netezos.Keys;

var pubKey = PubKey.FromBase58(rawPubKey);
var isValid = pubKey.Verify(message, signature);

Upvotes: 1

Related Questions