Externally Owned Account (EOA) authentication uses your existing Ethereum account to authenticate and mint PKPs. You can either use a private key or connect your wallet.
// 1. import the useWalletClient function from wagmiimport { useWalletClient } from 'wagmi';// 2. Use your connected wallet as the accountconst { data: myAccount } = useWalletClient();
2
Authenticate with EOA
Use the WalletClientAuthenticator/ViemAccountAuthenticator to authenticate your connected wallet and generate auth data.
Copy
import { WalletClientAuthenticator } from '@lit-protocol/auth';const authData = await WalletClientAuthenticator.authenticate(walletClient);
3
Get or Mint a PKP
You can select an existing PKP associated with your account or mint a new one.
Copy
const mintedPkpWithEoaAuth = await litClient.mintWithAuth({ account: myAccount, // or walletClient depending on method authData: authData, scopes: ['sign-anything'],});
4
Generate Auth Context
Use your newly minted PKP to create an AuthContext. This method will cache two things:
session key pair - a temporary cryptographic key pair generated on the client side that acts as a temporary identity for the client application. It consists of:
A public key - shared with the Lit nodes
A secret key (private key) - kept securely on the client
Delegation AuthSig aka. the inner auth sig - a cryptographic attestation from the Lit Protocol nodes that authorises your session key to act on behalf of your PKP.