đŸ¤ŗExample

Usage of Passkey Manager for Integration with Wallet SDK

When integrating a wallet, let's say, ABCWallet-sdk smart contract wallet into your decentralized application (dApp), you will need to initialize it with an External Owned Account (EOA) signer. The PasskeyEoaSigner from the '@rize-labs/paas' package can fulfill this requirement.

To begin, import the necessary modules and classes:

import { PasskeyEoaSigner } from '@rize-labs/paas';
import { ABCWallet } from 'ABCWallet-sdk'; 
import { ethers } from 'ethers'; // assuming ethers library is installed

const provider = ethers.getDefaultProvider();

Create an instance of the PasskeyEoaSigner using the provider:

const passkeySigner = new PasskeyEoaSigner(provider);

Next, specify the username associated with the passkey:

const username = "username";

Initialize the signer with the provided username:

try {
  await passkeySigner.init(username);
} catch (err) {
  console.error(err);
}

Assuming the ABCWallet class accepts an EOA signer via its constructor, pass the passkeySigner instance to create an ABCWallet smart contract wallet instance:

const abcSmartWalletInstance = new ABCWallet(passkeySigner);

By passing the passkeySigner to the ABCWallet instance, all requests related to signing messages and typed messages will be automatically handled by the signer.

If you have any questions, please feel free to ask on the Banana SDK Discord forum.

Last updated