Permissions (Session Keys)Policies
For the complete documentation index, see llms.txt. This page is also available as markdown.

Timestamp Policy

Archived version

You are viewing @zerodev/sdk v5.3.x documentation. View the latest documentation.

The timestamp policy specifies the start and end time for when the signer is valid.

API

import { toTimestampPolicy } from "@zerodev/permissions/policies"

// In this example, the signer can send one UserOp per month
const timestampPolicy = toTimestampPolicy({
  validAfter: 1704085200,  // January 1, 2024 12:00 AM UTC
  validUntil: 1735707599,  // December 31, 2024 11:59 PM UTC
})

const validator = toPermissionValidator(publicClient, {
  entryPoint,
  kernelVersion,
  signer: someSigner,
  policies: [
    timestampPolicy,
    // ...other policies
  ],
})

Arguments to toTimestampPolicy:

  • validAfter: the time after which the signer becomes valid. If not specified, the signer is immediately valid.
  • validUntil: the time before which the signer is valid. If not specified, the signer never expires.

On this page