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
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 ¶
- Variables
- type ChecksumVerification
- type ChecksumVerificationResult
- type ContactInfo
- type DocCompletionStats
- type Document
- type DocumentInput
- type EmailPeriodStats
- type EmailPriority
- type EmailQueueInput
- type EmailQueueItem
- type EmailQueueStats
- type EmailQueueStatus
- type ExpectedSigner
- type ExpectedSignerWithStatus
- type JSONB
- type MagicLinkAuthAttempt
- type MagicLinkToken
- type NullRawMessage
- type OAuthSession
- type ReminderLog
- type ReminderSendResult
- type ReminderStats
- type Signature
- type SignatureRequest
- type SignatureStatus
- type User
- type Webhook
- type WebhookDelivery
- type WebhookDeliveryInput
- type WebhookDeliveryStatus
- type WebhookInput
Constants ¶
This section is empty.
Variables ¶
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") ErrDomainNotAllowed = errors.New("domain not allowed") ErrDocumentModified = errors.New("document has been modified since creation") ErrDocumentNotFound = errors.New("document not found") )
Functions ¶
This section is empty.
Types ¶
type ChecksumVerification ¶
type ChecksumVerification struct {
ID int64 `json:"id" db:"id"`
DocID string `json:"doc_id" db:"doc_id"`
VerifiedBy string `json:"verified_by" db:"verified_by"`
VerifiedAt time.Time `json:"verified_at" db:"verified_at"`
StoredChecksum string `json:"stored_checksum" db:"stored_checksum"`
CalculatedChecksum string `json:"calculated_checksum" db:"calculated_checksum"`
Algorithm string `json:"algorithm" db:"algorithm"`
IsValid bool `json:"is_valid" db:"is_valid"`
ErrorMessage *string `json:"error_message,omitempty" db:"error_message"`
}
ChecksumVerification represents a verification attempt of a document's checksum
type ChecksumVerificationResult ¶
type ChecksumVerificationResult struct {
Valid bool `json:"valid"`
StoredChecksum string `json:"stored_checksum"`
CalculatedChecksum string `json:"calculated_checksum"`
Algorithm string `json:"algorithm"`
Message string `json:"message"`
HasReferenceHash bool `json:"has_reference_hash"`
}
ChecksumVerificationResult represents the result of a checksum verification operation
type ContactInfo ¶
ContactInfo represents a contact with optional name and email
type DocCompletionStats ¶
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 ¶
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"`
DeletedAt *time.Time `json:"deleted_at,omitempty" db:"deleted_at"`
}
Document represents document metadata for tracking and integrity verification
func (*Document) GetExpectedChecksumLength ¶
GetExpectedChecksumLength returns the expected length for the configured algorithm
func (*Document) HasChecksum ¶
HasChecksum returns true if the document has a checksum configured
type DocumentInput ¶
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 EmailPeriodStats ¶
type EmailPeriodStats struct {
Sent int `json:"sent"`
Failed int `json:"failed"`
Queued int `json:"queued"`
}
EmailPeriodStats represents email statistics for a time period
type EmailPriority ¶
type EmailPriority int
EmailPriority represents email priority levels
const ( EmailPriorityNormal EmailPriority = 0 EmailPriorityHigh EmailPriority = 10 EmailPriorityUrgent EmailPriority = 100 )
type EmailQueueInput ¶
type EmailQueueInput struct {
ToAddresses []string `json:"to_addresses"`
CcAddresses []string `json:"cc_addresses,omitempty"`
BccAddresses []string `json:"bcc_addresses,omitempty"`
Subject string `json:"subject"`
Template string `json:"template"`
Locale string `json:"locale"`
Data map[string]interface{} `json:"data"`
Headers map[string]string `json:"headers,omitempty"`
Priority EmailPriority `json:"priority"`
ScheduledFor *time.Time `json:"scheduled_for,omitempty"` // nil = immediate
ReferenceType *string `json:"reference_type,omitempty"`
ReferenceID *string `json:"reference_id,omitempty"`
CreatedBy *string `json:"created_by,omitempty"`
MaxRetries int `json:"max_retries"` // 0 = use default (3)
}
EmailQueueInput represents the input for creating a new email queue item
type EmailQueueItem ¶
type EmailQueueItem struct {
ID int64 `json:"id"`
ToAddresses []string `json:"to_addresses"`
CcAddresses []string `json:"cc_addresses,omitempty"`
BccAddresses []string `json:"bcc_addresses,omitempty"`
Subject string `json:"subject"`
Template string `json:"template"`
Locale string `json:"locale"`
Data json.RawMessage `json:"data"`
Headers NullRawMessage `json:"headers,omitempty"`
Status EmailQueueStatus `json:"status"`
Priority EmailPriority `json:"priority"`
RetryCount int `json:"retry_count"`
MaxRetries int `json:"max_retries"`
CreatedAt time.Time `json:"created_at"`
ScheduledFor time.Time `json:"scheduled_for"`
ProcessedAt *time.Time `json:"processed_at,omitempty"`
NextRetryAt *time.Time `json:"next_retry_at,omitempty"`
LastError *string `json:"last_error,omitempty"`
ErrorDetails NullRawMessage `json:"error_details,omitempty"`
ReferenceType *string `json:"reference_type,omitempty"`
ReferenceID *string `json:"reference_id,omitempty"`
CreatedBy *string `json:"created_by,omitempty"`
}
EmailQueueItem represents an email in the processing queue
type EmailQueueStats ¶
type EmailQueueStats struct {
TotalPending int `json:"total_pending"`
TotalProcessing int `json:"total_processing"`
TotalSent int `json:"total_sent"`
TotalFailed int `json:"total_failed"`
OldestPending *time.Time `json:"oldest_pending,omitempty"`
AverageRetries float64 `json:"average_retries"`
ByStatus map[string]int `json:"by_status"`
ByPriority map[string]int `json:"by_priority"`
Last24Hours EmailPeriodStats `json:"last_24_hours"`
}
EmailQueueStats represents aggregated statistics for the email queue
type EmailQueueStatus ¶
type EmailQueueStatus string
EmailQueueStatus represents the status of an email in the queue
const ( EmailStatusPending EmailQueueStatus = "pending" EmailStatusProcessing EmailQueueStatus = "processing" EmailStatusSent EmailQueueStatus = "sent" EmailStatusFailed EmailQueueStatus = "failed" EmailStatusCancelled EmailQueueStatus = "cancelled" )
type ExpectedSigner ¶
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 ¶
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 MagicLinkAuthAttempt ¶ added in v1.2.1
type MagicLinkAuthAttempt struct {
ID int64 `json:"id" db:"id"`
Email string `json:"email" db:"email"`
Success bool `json:"success" db:"success"`
FailureReason string `json:"failure_reason,omitempty" db:"failure_reason"`
IPAddress string `json:"ip_address" db:"ip_address"`
UserAgent string `json:"user_agent,omitempty" db:"user_agent"`
AttemptedAt time.Time `json:"attempted_at" db:"attempted_at"`
}
MagicLinkAuthAttempt représente une tentative d'authentification
type MagicLinkToken ¶ added in v1.2.1
type MagicLinkToken struct {
ID int64 `json:"id" db:"id"`
Token string `json:"token" db:"token"`
Email string `json:"email" db:"email"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
ExpiresAt time.Time `json:"expires_at" db:"expires_at"`
UsedAt *time.Time `json:"used_at,omitempty" db:"used_at"`
UsedByIP *string `json:"used_by_ip,omitempty" db:"used_by_ip"`
UsedByUserAgent *string `json:"used_by_user_agent,omitempty" db:"used_by_user_agent"`
RedirectTo string `json:"redirect_to" db:"redirect_to"` // URL destination après auth (ex: /?doc=xxx)
CreatedByIP string `json:"created_by_ip" db:"created_by_ip"`
CreatedByUserAgent string `json:"created_by_user_agent" db:"created_by_user_agent"`
Purpose string `json:"purpose" db:"purpose"` // 'login' or 'reminder_auth'
DocID *string `json:"doc_id,omitempty" db:"doc_id"` // Document ID for reminder_auth (NULL for login)
}
MagicLinkToken représente un token de connexion Magic Link
func (*MagicLinkToken) IsValid ¶ added in v1.2.1
func (t *MagicLinkToken) IsValid() bool
IsValid vérifie si le token est valide (non expiré, non utilisé)
type NullRawMessage ¶
type NullRawMessage struct {
RawMessage json.RawMessage
Valid bool
}
NullRawMessage is a nullable json.RawMessage for database scanning
func (*NullRawMessage) Scan ¶
func (n *NullRawMessage) Scan(value interface{}) error
Scan implements sql.Scanner
type OAuthSession ¶
type OAuthSession struct {
ID int64
SessionID string
UserSub string
RefreshTokenEncrypted []byte
AccessTokenExpiresAt time.Time
CreatedAt time.Time
UpdatedAt time.Time
LastRefreshedAt *time.Time
UserAgent string
IPAddress string
}
OAuthSession represents an OAuth session with encrypted refresh token
type ReminderLog ¶
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 ¶
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 ¶
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"`
DocChecksum string `json:"doc_checksum,omitempty" db:"doc_checksum"`
PayloadHash string `json:"payload_hash" db:"payload_hash"`
Signature string `json:"signature" db:"signature"`
Nonce string `json:"nonce" db:"nonce"`
Referer *string `json:"referer,omitempty" db:"referer"`
PrevHash *string `json:"prev_hash,omitempty" db:"prev_hash"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
HashVersion int `json:"hash_version" db:"hash_version"`
DocDeletedAt *time.Time `json:"doc_deleted_at,omitempty" db:"doc_deleted_at"`
// Document metadata enriched from LEFT JOIN (not stored in signatures table)
DocTitle string `json:"doc_title,omitempty"`
DocURL string `json:"doc_url,omitempty"`
}
func (*Signature) ComputeRecordHash ¶
ComputeRecordHash computes the hash of the signature record for blockchain integrity Uses versioned hash algorithms for backward compatibility
func (*Signature) GetServiceInfo ¶
func (s *Signature) GetServiceInfo() *services.ServiceInfo
type SignatureRequest ¶
type SignatureStatus ¶
type User ¶
func (*User) NormalizedEmail ¶
type Webhook ¶
type Webhook struct {
Title string `json:"title"`
ID int64 `json:"id"`
TargetURL string `json:"targetUrl"`
Secret string `json:"-"`
Active bool `json:"active"`
Events []string `json:"events"`
Headers map[string]string `json:"headers,omitempty"`
Description string `json:"description,omitempty"`
CreatedBy string `json:"createdBy,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
LastDeliveredAt *time.Time `json:"lastDeliveredAt,omitempty"`
FailureCount int `json:"failureCount"`
}
type WebhookDelivery ¶
type WebhookDelivery struct {
ID int64 `json:"id"`
WebhookID int64 `json:"webhookId"`
EventType string `json:"eventType"`
EventID string `json:"eventId"`
Payload json.RawMessage `json:"payload"`
Status WebhookDeliveryStatus `json:"status"`
RetryCount int `json:"retryCount"`
MaxRetries int `json:"maxRetries"`
Priority int `json:"priority"`
CreatedAt time.Time `json:"createdAt"`
ScheduledFor time.Time `json:"scheduledFor"`
ProcessedAt *time.Time `json:"processedAt,omitempty"`
NextRetryAt *time.Time `json:"nextRetryAt,omitempty"`
RequestHeaders NullRawMessage `json:"requestHeaders,omitempty"`
ResponseStatus *int `json:"responseStatus,omitempty"`
ResponseHeaders NullRawMessage `json:"responseHeaders,omitempty"`
ResponseBody *string `json:"responseBody,omitempty"`
LastError *string `json:"lastError,omitempty"`
}
type WebhookDeliveryInput ¶
type WebhookDeliveryStatus ¶
type WebhookDeliveryStatus string
const ( WebhookStatusPending WebhookDeliveryStatus = "pending" WebhookStatusProcessing WebhookDeliveryStatus = "processing" WebhookStatusDelivered WebhookDeliveryStatus = "delivered" WebhookStatusFailed WebhookDeliveryStatus = "failed" WebhookStatusCancelled WebhookDeliveryStatus = "cancelled" )
type WebhookInput ¶
type WebhookInput struct {
Title string `json:"title"`
TargetURL string `json:"targetUrl"`
Secret string `json:"secret"`
Active bool `json:"active"`
Events []string `json:"events"`
Headers map[string]string `json:"headers,omitempty"`
Description string `json:"description,omitempty"`
CreatedBy string `json:"createdBy,omitempty"`
}