Skip to content

Fordefi Signer

FordefiSigner is a signer implementation which extends SmartAccountAuthenticator to leverage the Fordefi Web3 Provider. It supports features such as authentication, message and typed data signing, and authentication details retrieval.

FordefiSigner provides implementations for all methods on SmartAccountAuthenticator:

  1. authenticate -- supports user authentication.
  2. getAddress -- gets the address of the smart contract account's connected EOA signer account.
  3. signMessage -- supports message signatures.
  4. signTypedData -- supports typed data signatures.
  5. getAuthDetails -- verifies that this signer is authenticated, it does not return any details.

Install Dependencies

FordefiSigner requires installation of the @fordefi/web3-provider SDK. aa-signers lists it as an optional dependency.

npm
npm i -s @fordefi/web3-provider

Usage

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

Developer Links