Auro Wallet Docs
  • Getting Started
  • How to integrate
    • Connect Wallet
    • Add or Switch Chain
    • Create Nullifier
    • Send Transaction
    • Send zk Transaction
    • Sign Message
    • VerifyMessage in server-side
    • Anonymous Credentials
    • Building zkApp on Android
  • Wallet Basics
    • Submit token info
    • ​Pull Up Auro Wallet with DeepLink
    • Mina Providers
  • Reference
    • API Reference
      • Methods
        • mina_accounts
        • mina_requestAccounts
        • mina_requestNetwork
        • mina_sendPayment
        • mina_sendStakeDelegation
        • mina_sendTransaction
        • mina_addChain
        • mina_switchChain
        • mina_createNullifier
        • mina_signMessage
        • mina_sign_JsonMessage
        • mina_verifyMessage
        • mina_signFields
        • mina_verifyFields
        • mina_storePrivateCredential
        • mina_requestPresentation
      • Events
      • Error
      • Source
Powered by GitBook
On this page
Edit on GitHub
  1. How to integrate

VerifyMessage in server-side

This scenario mainly explains how the server-side verify the result of the signMessage. Fields verification can also be implemented using mina-signer. Only signMessage examples are provided here.

PreviousSign MessageNextAnonymous Credentials

Last updated 1 year ago

The features is implemented through .

mina-signer is the NodeJS SDK provided by Mina Protocol for sign, verify signatures, etc.

Verify Message

  1. Add mina-signer to package.json.

"dependencies": {
    "mina-signer": "2.1.1"
}
  1. Import and init mina-signer.

var Client = require("mina-signer");

// type Network = 'mainnet' | 'testnet'
var signerClient = new Client({ network: "mainnet" });

There are two types of initialization supported here. The main network type is mainnet, and the type of other network are testnet.

  1. Implement code.

const publicKey = 'B62qj6z7oseWTr37SQTn53mF8ebHn45cmSfRC58Sy52wG6KcaPZNWjw'

const verifyMessage = `Click "Sign" to sign in. No password needed!

  This request will not trigger a blockchain transaction or cost any gas fees.
  
  I accept the Auro Test zkApp Terms of Service: https://test-zkapp.aurowallet.com
  
  address: B62qj6z7oseWTr37SQTn53mF8ebHn45cmSfRC58Sy52wG6KcaPZNWjw
  iat: 1701069403643`;

const signature = {
    field: '25087624681052481871246375076085075176624243458008290192358519021588472251513',
    scalar: '17285357755862735391605884635523872951699156489623612197745807470058903167470'
}

const verifyBody = {
    data: verifyMessage, // Signature content that needs to be verified.
    publicKey: publicKey, // Public key that needs to be verified.
    signature: signature, // Signature results that need to be verified.
};

// When verifyResult is true, the verification is successful.
const verifyResult = signerClient.verifyMessage(verifyBody);

This is an verification of signature. You can refer to the implementation or run it locally.

mina-signer
See original definition.
example of server-side