entity

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package entity contains domain data models representing application domain objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID        string    `json:"id"`
	UserID    string    `json:"userId"`
	Provider  string    `json:"provider"`
	Password  string    `json:"-"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Account represents an authentication provider account associated with a user.

type Passkey added in v0.9.0

type Passkey struct {
	ID           string    `json:"id"`
	Name         *string   `json:"name,omitempty"`       // Nombre amigable o resuelto por AAGUID
	UserID       string    `json:"userId"`               // ID del usuario propietario
	CredentialID string    `json:"credentialID"`         // Identificador único de credencial (Base64URL)
	PublicKey    string    `json:"publicKey"`            // Clave pública COSE / PKIX (Base64)
	Counter      uint32    `json:"counter"`              // Contador de firmas para mitigación de repetición/clonado
	DeviceType   string    `json:"deviceType"`           // "singleDevice" o "multiDevice" (sincronizada)
	BackedUp     bool      `json:"backedUp"`             // Indica si la clave tiene respaldo en la nube (iCloud, Google, etc.)
	Transports   *string   `json:"transports,omitempty"` // Transportes soportados ("usb,ble,nfc,internal,hybrid")
	AAGUID       *string   `json:"aaguid,omitempty"`     // GUID del modelo de autenticador
	CreatedAt    time.Time `json:"createdAt"`
	UpdatedAt    time.Time `json:"updatedAt"`
}

Passkey representa una credencial WebAuthn registrada para un usuario.

type Session

type Session struct {
	ID                   string         `json:"id"`
	UserID               string         `json:"userId"`
	Token                string         `json:"token"`
	ExpiresAt            time.Time      `json:"expiresAt"`
	CreatedAt            time.Time      `json:"createdAt"`
	IPAddress            string         `json:"ipAddress,omitempty"`
	UserAgent            string         `json:"userAgent,omitempty"`
	ImpersonatedBy       *string        `json:"impersonatedBy,omitempty"`
	ActiveOrganizationID *string        `json:"activeOrganizationId,omitempty"`
	ActiveTeamID         *string        `json:"activeTeamId,omitempty"`
	DeviceID             *string        `json:"deviceId,omitempty"`
	Extra                map[string]any `json:"extra,omitempty"`
	UpdatedAt            *time.Time     `json:"updatedAt,omitempty"`
}

Session represents an active authentication session belonging to a user.

type User

type User struct {
	ID                  string     `json:"id"`
	Name                string     `json:"name"`
	Email               string     `json:"email"`
	Username            string     `json:"username,omitempty"`
	DisplayUsername     string     `json:"displayUsername,omitempty"`
	PasswordHash        string     `json:"-"`
	EmailVerified       bool       `json:"emailVerified"`
	PhoneNumber         *string    `json:"phoneNumber,omitempty"`
	PhoneNumberVerified bool       `json:"phoneNumberVerified,omitempty"`
	TwoFactorEnabled    bool       `json:"twoFactorEnabled"`
	Role                string     `json:"role,omitempty"`
	Banned              bool       `json:"banned"`
	BanReason           *string    `json:"banReason,omitempty"`
	BanExpires          *time.Time `json:"banExpires,omitempty"`
	LastLoginMethod     *string    `json:"lastLoginMethod,omitempty"`
	IsAnonymous         bool       `json:"isAnonymous,omitempty"`
	CreatedAt           time.Time  `json:"createdAt"`
	UpdatedAt           time.Time  `json:"updatedAt"`
}

User represents an authenticated application user.

type Verification added in v1.2.0

type Verification struct {
	// ID is the unique record identifier (typically a UUIDv7).
	ID string `json:"id"`

	// Identifier is the composite lookup key (e.g. email address, phone number, or raw token string).
	Identifier string `json:"identifier"`

	// Value stores the secret token, hashed OTP, or associated session/user payload.
	Value string `json:"value"`

	// ExpiresAt specifies the exact timestamp when this verification record becomes invalid.
	ExpiresAt time.Time `json:"expiresAt"`

	// CreatedAt records when the verification record was initialized.
	CreatedAt time.Time `json:"createdAt"`

	// UpdatedAt records when the verification record was last modified, if applicable.
	UpdatedAt *time.Time `json:"updatedAt,omitzero"`
}

Verification represents a standard ephemeral verification record (token, OTP, or secret) used across authentication plugins (e.g. emailpassword, magiclink, emailotp, phonenumber, ott).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL