models

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 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

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 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