Skip to content

Portal Signer

PassportSigner is a signer implementation which extends SmartAccountAuthenticator to leverage the Passport SDK. It supports features such as authentication, message and typed data signing, and authentication details retrieval.

PassportSigner provides implementations for all methods on SmartAccountAuthenticator:

  1. authenticate -- supports user authentication.
  2. getAddress -- gets the address of the the smart contract account's connected EOA signer account.
  3. signMessage -- supports message signatures.
  4. signTypedData -- supports typed data signatures.
  5. getAuthDetails -- supports authentication details retrieval.

Install Dependencies

PassportSigner requires installation of the package requires installation of the @0xpass/passport and @0xpass/webauthn-signer.

npm
npm i @0xpass/passport
npm i @0xpass/webauthn-signer

Usage

example.ts
import { createPassportSigner } from "./passport";
 
const passportSigner = await createPassportSigner();
 
const address = await passportSigner.getAddress();
 
const details = await passportSigner.getAuthDetails();
 
const signedMessage = await passportSigner.signMessage("test");
 
const typedData = {
  types: {
    Request: [{ name: "hello", type: "string" }],
  },
  primaryType: "Request",
  message: {
    hello: "world",
  },
};
const signTypedData = await passportSigner.signTypedData(typedData);

Developer Links