Skip to main content

Function

generatePkpDelegationAuthSig(params)
Creates a delegation signature that authorises a session key to act on behalf of a PKP. Use this in server or pre-generation flows where you want to prepare session materials ahead of time.

Parameters

params.pkpPublicKey
string
required
Hex-encoded PKP public key.
params.authData
AuthData
required
Authentication data for the PKP owner (e.g., from ViemAccountAuthenticator.authenticate).
params.sessionKeyPair
SessionKeyPair
required
Session keypair generated with generateSessionKeyPair.
params.authConfig
AuthConfigV2
required
Configures resources and expiration scoped to the delegation.
params.litClient
LitClient
required
Lit client used to reach the network and request the delegation signature.

Returns

delegationAuthSig
AuthSig
Signed delegation that can be shipped alongside the session keypair.

Example

import { generatePkpDelegationAuthSig, generateSessionKeyPair } from '@lit-protocol/auth';

const sessionKeyPair = generateSessionKeyPair();

const delegationAuthSig = await generatePkpDelegationAuthSig({
  pkpPublicKey,
  authData,
  sessionKeyPair,
  authConfig: {
    resources: [ ['pkp-signing', '*'], ['lit-action-execution', '*'] ],
    expiration: new Date(Date.now() + 15 * 60 * 1000).toISOString(),
  },
  litClient,
});