Skip to main content

Verify Signature on Server-Side


Here we learn how to verify our signature on the server side.

import { SIWStarkware } from "@web3auth/sign-in-with-starkware";
...
const { header } = <fields>;
const { payload } = <fields>;
const { signature } = <fields>;
const msg = new SIWStarkware({ header, payload });
// Pass the IStarknetWindowObject from the client side
// const starknet = await getStarknet();
const resp = await msg.verify({ payload, signature, kp:starknet });
if (resp.success == true) {
<success flow>
} else {
<error handling>
}

The header, payload and signature fields will be obtained from the client side. We generate a SIWStarkware message using the header and payload and then call the verify method with payload and signature as arguments.