Skip to content

getAuthDetails

getAuthDetails returns the details about the authenticated user, specifically all EOA addresses tied to the user's Capsule account.

This method must be called after authenticate. Otherwise, this method will throw an error with the message Not Authenticated.

Usage

ts
import { createCapsuleSigner } from "./capsule";

const capsuleSigner = await createCapsuleSigner();

const details = await capsuleSigner.getAuthDetails();
ts
import { sepolia } from "@alchemy/aa-core";
import { CapsuleSigner } from "@alchemy/aa-signers/capsule";
import { Environment } from "@usecapsule/web-sdk";
import { http } from "viem";

export const createCapsuleSigner = async () => {
  // get an API Key by filling out this form: https://form.typeform.com/to/hLaJeYJW
  const capsuleSigner = new CapsuleSigner({
    env: Environment.DEVELOPMENT,
    apiKey: "CAPSULE_API_KEY",
    walletConfig: {
      chain: sepolia,
      // get your own Alchemy API key at: https://dashboard.alchemy.com/
      transport: http(`${sepolia.rpcUrls.alchemy.http[0]}/ALCHEMY_API_KEY`),
    },
  });

  await capsuleSigner.authenticate();

  return capsuleSigner;
};

Returns

Promise<CapsuleUserInfo>

A Promise containing the CapsuleUserInfo, an Record<string, Wallet> where Wallet is an object with the following properties:

  • id: string -- ID of the Capsule Signer.

  • signer: string -- Capsule Signer information.

  • address: string -- [optional] EOA address of the Capsule Signer.

  • publicKey: string -- [optional] Public Key of the Capsule Signer.

  • scheme: WalletScheme -- [optional] either CGGMP or DKLS.