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
  • Sign Message
  • Sign Json Message
  • Verify Message
Edit on GitHub
  1. How to integrate

Sign Message

This scenario is mainly used to sign information. that can be used for login verification.

Sign Message

This method is used for sign message.

interface SignedData {
    publicKey: string;
    data: string;
    signature: {
        field: string;
        scalar: string;
    };
}

interface ProviderError extends Error {
    message: string;
    code: number;
    data?: unknown;
}
type SignMessageArgs = {
    message:string
}

const content = `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: ${window.location.href}

address: ${currentAccount}
iat: ${new Date().getTime()}`;

const signContent:SignMessageArgs = {
    message:content
}

const signResult: SignedData|ProviderError = await window.mina?
     .signMessage(signContent)
     .catch((err: any) => err);

console.log(signResult)

Sign Json Message

This method is used for sign JSON data , Auro Wallet will format message.

type JsonMessageData  = {
    label:string
    value:string
}

type SignJsonMessageArgs = {
    readonly message: Array<JsonMessageData>
}

const msgParams = [
    { label: "Label:", value: "Sign Confirm" },
    {
      label: "Message:",
      value: "Click to sign in and accept the Terms of Service",
    },
    {
      label: "URI:",
      value: window.location.href,
    },
    {
      label: "networkID:",
      value: network.networkID,
    },
    {
      label: "Chain Name:",
      value: network.name,
    },
    {
      label: "Issued At:",
      value: new Date().getTime(),
    },
    {
      label: "Resources:",
      value: "https://docs.aurowallet.com/",
    },
    ];
  
const signResult:SignedData|ProviderError = await window.mina
    ?.signJsonMessage({
        message: msgParams
    })
    .catch((err: any) => err);

console.log(signResult);

Verify Message

This methods is used for verify signed Message.

let verifyResult:boolean|ProviderError = await window.mina
    ?.verifyMessage(verifyMessageBody)
    .catch((err: any) => err);
  
console.log(verifyResult); // If the result is successful, it will return true.
PreviousSend zk TransactionNextVerifyMessage in server-side

Last updated 11 months ago