Avnology ID
SDKsTypeScript SDKType Reference

Session Types

TypeScript type definitions for Session, AuthMethod, and DeviceInfo.

Session Types

Session

Returned by getSession(), login(), register(), and MFA verification methods.

interface Session {
  /** Unique session identifier (e.g., "ses_abc123") */
  id: string;

  /** Whether the session is currently valid */
  active: boolean;

  /** ISO 8601 expiry timestamp */
  expiresAt: string;

  /** ISO 8601 timestamp when the session was created */
  authenticatedAt: string;

  /** ISO 8601 timestamp when the session was last used */
  issuedAt: string;

  /** MFA assurance level */
  authenticatorAssuranceLevel: "aal1" | "aal2";

  /** The authenticated user */
  identity: Identity;

  /** Devices associated with this session */
  devices: DeviceInfo[];

  /** Authentication methods used in this session */
  authenticationMethods: AuthMethod[];
}

Identity

The user identity within a session context.

interface Identity {
  id: string;
  email: string;
  emailVerified: boolean;
  phone: string | null;
  phoneVerified: boolean;
  name: { first: string; last: string } | null;
  avatarUrl: string | null;
  locale: string | null;
  timezone: string | null;
  organizationId: string | null;
  metadata: { public: Record<string, unknown> };
  createdAt: string;
  updatedAt: string;
  verifiedAt: string | null;
}

AuthMethod

Authentication methods used during the session.

interface AuthMethod {
  method: "password" | "webauthn" | "totp" | "recovery_code" | "oidc" | "code" | "link";
  aal: "aal1" | "aal2";
  completedAt: string;
  provider?: string;  // For OIDC: "google", "github", etc.
}

DeviceInfo

Device and location metadata for a session.

interface DeviceInfo {
  id: string;
  userAgent: string;         // "Chrome 120 on macOS"
  ipAddress: string;         // "203.0.113.42"
  location: string | null;   // "San Francisco, CA, US"
  lastActiveAt: string;
}

SessionList

interface SessionList {
  sessions: Session[];
  nextPageToken: string | null;
  totalSize: number;
}

See also

On this page