Authenticate with Signature
Step 1: Import Required Modules
Import the necessary modules at the beginning of your script:
import { Auth } from "@didpass/issuer-sdk";
Step 2: Set Up Authentication Payload
Replace the placeholder values with your actual authentication payload:
const connectPayload = {
sessionId: "YOUR_SESSION_ID",
did: "USER_DID",
message: "MESSAGE_FROM_WALLET",
signature: "SIGNATURE_FROM_WALLET",
};
Step 3: Authenticate Signature
Authenticate the provided signature using the payload:
const auth = new Auth();
const result = await auth.authenticateSignature(
connectPayload.message,
connectPayload.signature
);
Step 4: Return Authenticate Result
Return the authentication result:
return result;
Final Code
Here's the complete code:
import { Auth } from "@didpass/issuer-sdk";
async function authenticate() {
// Set up authentication payload
const connectPayload = {
sessionId: "YOUR_SESSION_ID",
did: "USER_DID",
message: "MESSAGE_FROM_WALLET",
signature: "SIGNATURE_FROM_WALLET",
};
// Authenticate signature
const auth = new Auth();
const result = await auth.authenticateSignature(
connectPayload.message,
connectPayload.signature
);
// Return authentication result
return result;
}
Last updated