ObjectStackObjectStack

Identity

Identity protocol schemas

Identity & User Model Specification

Defines the standard user, account, and session data models for ObjectStack. These schemas represent "who is logged in" and their associated data.

This is separate from authentication configuration (auth.zod.ts) which defines "how to login".

Source: packages/spec/src/identity/identity.zod.ts

TypeScript Usage

import { AccountSchema, ApiKeySchema, UserSchema, VerificationTokenSchema } from '@objectstack/spec/identity';
import type { Account, ApiKey, User, VerificationToken } from '@objectstack/spec/identity';

// Validate data
const result = AccountSchema.parse(data);

Account

Properties

PropertyTypeRequiredDescription
idstringUnique account identifier
userIdstringAssociated user ID
typeEnum<'oauth' | 'oidc' | 'email' | 'credentials' | 'saml' | 'ldap'>Account type
providerstringProvider name
providerAccountIdstringProvider account ID
refreshTokenstringoptionalOAuth refresh token
accessTokenstringoptionalOAuth access token
expiresAtnumberoptionalToken expiry timestamp (Unix)
tokenTypestringoptionalOAuth token type
scopestringoptionalOAuth scope
idTokenstringoptionalOAuth ID token
sessionStatestringoptionalSession state
createdAtstringAccount creation timestamp
updatedAtstringLast update timestamp

ApiKey

Properties

PropertyTypeRequiredDescription
idstringAPI key identifier
namestringAPI key display name
startstringoptionalKey prefix for identification
prefixstringoptionalCustom key prefix
userIdstringOwner user ID
organizationIdstringoptionalScoped organization ID
expiresAtstringoptionalExpiration timestamp
createdAtstringCreation timestamp
updatedAtstringLast update timestamp
lastUsedAtstringoptionalLast used timestamp
lastRefetchAtstringoptionalLast refetch timestamp
enabledbooleanWhether the key is active
rateLimitEnabledbooleanoptionalWhether rate limiting is enabled
rateLimitTimeWindowintegeroptionalRate limit window (ms)
rateLimitMaxintegeroptionalMax requests per window
remainingintegeroptionalRemaining requests
permissionsRecord<string, boolean>optionalGranular permission flags
scopesstring[]optionalHigh-level access scopes
metadataRecord<string, any>optionalCustom metadata

User

Properties

PropertyTypeRequiredDescription
idstringUnique user identifier
emailstringUser email address
emailVerifiedbooleanWhether email is verified
namestringoptionalUser display name
imagestringoptionalProfile image URL
createdAtstringAccount creation timestamp
updatedAtstringLast update timestamp

VerificationToken

Properties

PropertyTypeRequiredDescription
identifierstringToken identifier (email or phone)
tokenstringVerification token
expiresstringToken expiry timestamp
createdAtstringToken creation timestamp

On this page