Skip to main content

Verify Signature on Server-Side


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

import { SIWS } from "@web3auth/sign-in-with-solana";
...
const { header } = <fields>;
const { payload } = <fields>;
const { signature } = <fields>;
const msg = new SIWS({ header, payload });
const resp = await msg.verify({ payload, signature });
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 SIWS message using the header and payload and then call the verify method with payload and signature as arguments.