models

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2025 License: AGPL-3.0, AGPL-3.0-or-later Imports: 7 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: AGPL-3.0-or-later

SPDX-License-Identifier: AGPL-3.0-or-later

SPDX-License-Identifier: AGPL-3.0-or-later

SPDX-License-Identifier: AGPL-3.0-or-later

SPDX-License-Identifier: AGPL-3.0-or-later

SPDX-License-Identifier: AGPL-3.0-or-later

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSignatureNotFound      = errors.New("signature not found")
	ErrSignatureAlreadyExists = errors.New("signature already exists")
	ErrInvalidUser            = errors.New("invalid user")
	ErrInvalidDocument        = errors.New("invalid document ID")
	ErrDatabaseConnection     = errors.New("database connection error")
	ErrUnauthorized           = errors.New("unauthorized")
	ErrDomainNotAllowed       = errors.New("domain not allowed")
)

Functions

This section is empty.

Types

type ContactInfo added in v1.1.3

type ContactInfo struct {
	Name  string
	Email string
}

ContactInfo represents a contact with optional name and email

type DocCompletionStats added in v1.1.3

type DocCompletionStats struct {
	DocID          string  `json:"doc_id"`
	ExpectedCount  int     `json:"expected_count"`
	SignedCount    int     `json:"signed_count"`
	PendingCount   int     `json:"pending_count"`
	CompletionRate float64 `json:"completion_rate"` // Percentage 0-100
}

DocCompletionStats provides completion statistics for a document

type Document added in v1.1.3

type Document struct {
	DocID             string    `json:"doc_id" db:"doc_id"`
	Title             string    `json:"title" db:"title"`
	URL               string    `json:"url" db:"url"`
	Checksum          string    `json:"checksum" db:"checksum"`
	ChecksumAlgorithm string    `json:"checksum_algorithm" db:"checksum_algorithm"`
	Description       string    `json:"description" db:"description"`
	CreatedAt         time.Time `json:"created_at" db:"created_at"`
	UpdatedAt         time.Time `json:"updated_at" db:"updated_at"`
	CreatedBy         string    `json:"created_by" db:"created_by"`
}

Document represents document metadata for tracking and integrity verification

type DocumentInput added in v1.1.3

type DocumentInput struct {
	Title             string `json:"title"`
	URL               string `json:"url"`
	Checksum          string `json:"checksum"`
	ChecksumAlgorithm string `json:"checksum_algorithm"`
	Description       string `json:"description"`
}

DocumentInput represents the input for creating/updating document metadata

type ExpectedSigner added in v1.1.3

type ExpectedSigner struct {
	ID      int64     `json:"id" db:"id"`
	DocID   string    `json:"doc_id" db:"doc_id"`
	Email   string    `json:"email" db:"email"`
	Name    string    `json:"name" db:"name"`
	AddedAt time.Time `json:"added_at" db:"added_at"`
	AddedBy string    `json:"added_by" db:"added_by"`
	Notes   *string   `json:"notes,omitempty" db:"notes"`
}

ExpectedSigner represents an expected signer for a document

type ExpectedSignerWithStatus added in v1.1.3

type ExpectedSignerWithStatus struct {
	ExpectedSigner
	HasSigned             bool       `json:"has_signed"`
	SignedAt              *time.Time `json:"signed_at,omitempty"`
	UserName              *string    `json:"user_name,omitempty"`
	LastReminderSent      *time.Time `json:"last_reminder_sent,omitempty"`
	ReminderCount         int        `json:"reminder_count"`
	DaysSinceAdded        int        `json:"days_since_added"`
	DaysSinceLastReminder *int       `json:"days_since_last_reminder,omitempty"`
}

ExpectedSignerWithStatus combines expected signer info with signature status

type ReminderLog added in v1.1.3

type ReminderLog struct {
	ID             int64     `json:"id" db:"id"`
	DocID          string    `json:"doc_id" db:"doc_id"`
	RecipientEmail string    `json:"recipient_email" db:"recipient_email"`
	SentAt         time.Time `json:"sent_at" db:"sent_at"`
	SentBy         string    `json:"sent_by" db:"sent_by"`
	TemplateUsed   string    `json:"template_used" db:"template_used"`
	Status         string    `json:"status" db:"status"`
	ErrorMessage   *string   `json:"error_message,omitempty" db:"error_message"`
}

ReminderLog represents a log entry for an email reminder sent to a signer

type ReminderSendResult added in v1.1.3

type ReminderSendResult struct {
	TotalAttempted   int      `json:"total_attempted"`
	SuccessfullySent int      `json:"successfully_sent"`
	Failed           int      `json:"failed"`
	Errors           []string `json:"errors,omitempty"`
}

ReminderSendResult represents the result of a bulk reminder send operation

type ReminderStats added in v1.1.3

type ReminderStats struct {
	TotalSent    int        `json:"total_sent"`
	LastSentAt   *time.Time `json:"last_sent_at,omitempty"`
	PendingCount int        `json:"pending_count"`
}

ReminderStats provides statistics about reminders for a document

type Signature

type Signature struct {
	ID          int64     `json:"id" db:"id"`
	DocID       string    `json:"doc_id" db:"doc_id"`
	UserSub     string    `json:"user_sub" db:"user_sub"`
	UserEmail   string    `json:"user_email" db:"user_email"`
	UserName    string    `json:"user_name,omitempty" db:"user_name"`
	SignedAtUTC time.Time `json:"signed_at" db:"signed_at"`
	PayloadHash string    `json:"payload_hash" db:"payload_hash"`
	Signature   string    `json:"signature" db:"signature"`
	Nonce       string    `json:"nonce" db:"nonce"`
	CreatedAt   time.Time `json:"created_at" db:"created_at"`
	Referer     *string   `json:"referer,omitempty" db:"referer"`
	PrevHash    *string   `json:"prev_hash,omitempty" db:"prev_hash"`
}

func (*Signature) ComputeRecordHash

func (s *Signature) ComputeRecordHash() string

ComputeRecordHash Stable record hash supports tamper-evident chaining and integrity checks across migrations.

func (*Signature) GetServiceInfo

func (s *Signature) GetServiceInfo() *services.ServiceInfo

type SignatureRequest

type SignatureRequest struct {
	DocID   string
	User    *User
	Referer *string
}

type SignatureStatus

type SignatureStatus struct {
	DocID     string
	UserEmail string
	IsSigned  bool
	SignedAt  *time.Time
}

type User

type User struct {
	Sub   string `json:"sub"`
	Email string `json:"email"`
	Name  string `json:"name"`
}

func (*User) IsValid

func (u *User) IsValid() bool

func (*User) NormalizedEmail

func (u *User) NormalizedEmail() string

Jump to

Keyboard shortcuts

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