Skip to content

rotateSessionKey

rotateSessionKey(params): Promise<RotateSessionKeyResult>

Defined in: src/session/rotate.ts:64

Atomically rotate the agent’s session key: revoke the old, issue the new.

The revoke is always awaited to the bundler receipt — issuing a replacement before the old key is actually disarmed would leave two valid signers at once, defeating the point.

Parameters

params

RotateSessionKeyParams

Returns

Promise<RotateSessionKeyResult>

Example

import { rotateSessionKey } from "kawasekit";
const { revoke, envelope } = await rotateSessionKey({
revoke: {
ownerKernelClient,
envelope: oldEnvelope,
sessionKeySigner: oldSessionKeySigner,
policies: oldPolicies,
},
issue: {
publicClient,
ownerSigner,
sessionKeySigner: newSessionKeySigner,
policies: newPolicies,
},
});