Skip to content

getAuthDetails

getAuthDetails returns the details about the authenticated user as LitUserMetadata, which is a SessionSigsMap: the authentication result when successful.

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

Usage

ts
import { createLitSignerWithAuthMethod } from "./lit";


const litSigner = new createLitSignerWithAuthMethod();

await litSigner.authenticate({
  context: AUTH_METHOD,
});

// returns a `SessionSigMap` regardless of using an auth sig or session signature
let authDetails = await litSigner.getAuthDetails();
ts
import { polygonMumbai } from "@alchemy/aa-core";
import { LitAuthMethod, LitSigner } from "@alchemy/aa-signers/lit-protocol";

const API_KEY = "<YOUR API KEY>";
const POLYGON_MUMBAI_RPC_URL = `${polygonMumbai.rpcUrls.alchemy.http[0]}/${API_KEY}`;
const PKP_PUBLIC_KEY = "<YOUR PKP PUBLIC KEY>";

export const createLitSignerWithAuthMethod = async () => {
  return new LitSigner<LitAuthMethod>({
    pkpPublicKey: PKP_PUBLIC_KEY,
    rpcUrl: POLYGON_MUMBAI_RPC_URL,
  });
};

Returns

Promise<LitUserMetadata>

A Promise containing the LitUserMetadata, a map of string -> object containing the following fields:

  • sig: string -- Signed authentication message of the given network node.
  • deriviedVia: string -- How the signature was generated.
  • address: string -- Ethereum address of the key.
  • algo: string -- Signing algorithm used.
  • signedMessage: string -- SIWE ReCap Authentication message in the format of SIWE ReCap.