@linara/identity

UserSession type and isSessionExpired() helper

isSessionExpired() checks

Valid sessionvalid
{
  "userId": "a1b2c3d4-0000-0000-0000-000000000001",
  "preferredName": "Phill Paterson",
  "roles": {
    "health": "owner"
  },
  "encryptionKey": "",
  "expiresAt": 1783537749,
  "expiresIn": "3599s"
}
Expired sessionexpired
{
  "userId": "a1b2c3d4-0000-0000-0000-000000000002",
  "preferredName": "Eddie Paterson",
  "roles": {
    "health": "read"
  },
  "encryptionKey": "",
  "expiresAt": 1783534089,
  "expiresIn": "-61s"
}

UserSession type

interface UserSession {
  userId:        string;      // Supabase auth.uid()
  preferredName: string;      // from Azure OAuth metadata
  roles:         { health: 'owner' | 'viewer' };
  encryptionKey: string;      // per-user key (Phase 2)
  expiresAt:     number;      // Unix seconds
}