Represents a stateless, cryptographically verifiable session token.

Instead of storing session state on the server, the Session object encapsulates all necessary authorization data (handle ID, scopes, expiration) into a self-contained structure that can be verified using the Handle's public key.

Constructors

Properties

Methods

Constructors

  • Creates a new Session instance.

    Parameters

    • handleId: string

      The ID of the Handle that authorized this session.

    • scopes: string[]

      An array of permission scopes granted in this session (e.g., ['read', 'write']).

    • expiresAt: number

      Unix timestamp (in milliseconds) when this session expires.

    • token: string

      The cryptographic token string (e.g., JWT or custom signature format).

    Returns Session

Properties

handleId: string

The ID of the Handle that authorized this session.

scopes: string[]

An array of permission scopes granted in this session (e.g., ['read', 'write']).

expiresAt: number

Unix timestamp (in milliseconds) when this session expires.

token: string

The cryptographic token string (e.g., JWT or custom signature format).

Methods

  • Checks if the session has expired based on the current time.

    Returns boolean

    true if the current time is past the expiresAt timestamp, false otherwise.