Authenticating with SDK

Authenticate

Once you've created an account and keypair has been created for it, to now interact with the protocol, to sign messages and transactions you will first have to authenticate. For authentication the flow is more or less the same.

import { Passport } from "@0xpass/passport";
import { WebauthnSigner } from "@0xpass/webauthn-signer";

const signer = new WebauthnSigner({
      rpId: window.location.hostname,
      rpName: "rpName",
});
s
const passport = new Passport({
    scope_id: "insert_your_scope_id",
    signer: signer
});

const userInput {
   username: "insert_username_here"
   userDisplayName: "insert_user_display_name_here"
}

await passport.setupEncryption();
const [authenticatedHeader, address] = await passport.authenticate(userInput);

The setup is the same we just call the authenticate function with the userInput.

The authenticate function returns two items, a header which we use to authenticate subsequent requests, and the address associated with the account

The authenticatedHeader

The address:

Now with these setup, we can start to sign messages and transactions.

Last updated