Skip to main content

User Interface

The User interface represents an authenticated user account in Arraf Auth. It contains all the core user profile information and verification status.
id
string
required
Unique identifier for the user
email
string | null
The user’s email address. Can be null if the user authenticated via phone only.
phone
string | null
The user’s phone number. Can be null if the user authenticated via email only.
name
string | null
The user’s display name. Can be null if not provided.
emailVerified
boolean
required
Indicates whether the user’s email address has been verified
phoneVerified
boolean
required
Indicates whether the user’s phone number has been verified
image
string | null
URL to the user’s profile image. Can be null if not set.
createdAt
Date
required
Timestamp when the user account was created
updatedAt
Date
required
Timestamp when the user account was last updated

Usage Example

import { User } from "arraf-auth"

// Get current user from session
const user: User = await auth.getUser(sessionToken)

console.log(user.id) // "user_123"
console.log(user.email) // "[email protected]"
console.log(user.emailVerified) // true

// Update user profile
const updatedUser = await auth.updateUser(user.id, {
  name: "John Doe",
  image: "https://example.com/avatar.jpg"
})
Users can authenticate with email, phone, or OAuth providers. At least one of email or phone will be set, but not necessarily both.
The emailVerified and phoneVerified fields are automatically set to true when users verify their contact information via OTP or when authenticating through OAuth providers that provide verified email addresses.

Build docs developers (and LLMs) love