models

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRoomRequest

type CreateRoomRequest struct {
	Name     string  `json:"name" validate:"required,min=1,max=50"`
	Password *string `json:"password,omitempty" validate:"omitempty,min=4,max=72"`
}

type Message

type Message struct {
	ID              string    `json:"id"`
	Room            string    `json:"room"`
	User            string    `json:"user"`
	Content         string    `json:"content"`
	Timestamp       time.Time `json:"timestamp"`
	Signature       string    `json:"signature,omitempty"`        // Cryptographic signature (hex-encoded)
	Pubkey          string    `json:"pubkey,omitempty"`           // Public key used for signing (hex-encoded)
	SignedTimestamp int64     `json:"signed_timestamp,omitempty"` // Unix timestamp that was signed
}

type RegisterUserRequest

type RegisterUserRequest struct {
	PublicKey string `json:"public_key" validate:"required"`
}

type Room

type Room struct {
	Name                 string  `json:"name"`
	HasPassword          bool    `json:"has_password"`
	LastMessageContent   *string `json:"last_message_content,omitempty"`
	LastMessageUser      *string `json:"last_message_user,omitempty"`
	LastMessageTimestamp *string `json:"last_message_timestamp,omitempty"`
}

func (*Room) OutTransform

func (r *Room) OutTransform(context.Context) error

InTransform implements fuego.InTransformer.

type SendMessageRequest

type SendMessageRequest struct {
	User         string `json:"user" validate:"required"`
	Content      string `json:"content" validate:"required"`
	Signature    string `json:"signature" validate:"required"`
	Pubkey       string `json:"pubkey" validate:"required"`
	Timestamp    int64  `json:"timestamp" validate:"required"`
	RoomPassword string `json:"room_password,omitempty"`
}

type User

type User struct {
	PublicKey string    `json:"public_key"` // Hex-encoded secp256k1 public key
	Verified  bool      `json:"verified"`   // Whether the public key has been verified
	CreatedAt time.Time `json:"created_at"` // When the user was registered
	UpdatedAt time.Time `json:"updated_at"` // When the user or key was last updated
}

type UserWithPostCount

type UserWithPostCount struct {
	PublicKey string    `json:"public_key"` // Hex-encoded secp256k1 public key
	Verified  bool      `json:"verified"`   // Whether the public key has been verified
	CreatedAt time.Time `json:"created_at"` // When the user was registered
	UpdatedAt time.Time `json:"updated_at"` // When the user or key was last updated
	PostCount int64     `json:"post_count"` // Number of posts by this user
}

type VerifyUserRequest

type VerifyUserRequest struct {
	PublicKey string `json:"public_key" validate:"required"`
}

Jump to

Keyboard shortcuts

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