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
:
authenticate
-- supports user authentication.getAddress
-- gets the address of the the smart contract account's connected EOA signer account.signMessage
-- supports message signatures.signTypedData
-- supports typed data signatures.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);