valueobject

package
v0.0.0-...-106d939 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(hash, password, salt []byte) error

CheckPassword compares the hash with the salted password. A nil return means the password is correct, but an error could mean either the password is not correct, or the salt process failed - indicated in logs

func FmtBytes

func FmtBytes(size float64) string

FmtBytes converts the numeric byte size value to the appropriate magnitude size in KB, MB, GB, TB, PB, or EB.

func FmtTime

func FmtTime(t int64) string

FmtTime shows a human readable time based on the timestamp

func HashPassword

func HashPassword(password, salt []byte) ([]byte, error)

HashPassword encrypts the salted password using bcrypt

func NewEtag

func NewEtag() string

NewEtag generates a new Etag for response caching

func RandSalt

func RandSalt() ([]byte, error)

RandSalt generates 16 * 8 bits of data for a random salt

Types

type Config

type Config struct {
	contentVO.Item

	Name                    string   `json:"name"`
	Domain                  string   `json:"domain"`
	BindAddress             string   `json:"bind_addr"`
	HTTPPort                string   `json:"http_port"`
	HTTPSPort               string   `json:"https_port"`
	DevHTTPSPort            string   `json:"dev_https_port"`
	AdminEmail              string   `json:"admin_email"`
	ClientSecret            string   `json:"client_secret"`
	Etag                    string   `json:"etag"`
	DisableCORS             bool     `json:"cors_disabled"`
	DisableGZIP             bool     `json:"gzip_disabled"`
	DisableHTTPCache        bool     `json:"cache_disabled"`
	CacheMaxAge             int64    `json:"cache_max_age"`
	CacheInvalidate         []string `json:"cache"`
	BackupBasicAuthUser     string   `json:"backup_basic_auth_user"`
	BackupBasicAuthPassword string   `json:"backup_basic_auth_password"`
}

func (*Config) Convert

func (c *Config) Convert(data url.Values) (*Config, error)

func (*Config) IsCacheInvalidate

func (c *Config) IsCacheInvalidate() bool

func (*Config) Marshal

func (c *Config) Marshal() ([]byte, error)

func (*Config) MarshalEditor

func (c *Config) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Post and partially implements editor.Editable

func (*Config) Update

func (c *Config) Update(key string, value any) (*Config, error)

type FileUpload

type FileUpload struct {
	contentVO.Item

	Name          string `json:"name"`
	Path          string `json:"path"`
	ContentLength int64  `json:"content_length"`
	ContentType   string `json:"content_type"`
}

FileUpload represents the file uploaded to the system

func (*FileUpload) FilePath

func (f *FileUpload) FilePath() string

func (*FileUpload) MarshalEditor

func (f *FileUpload) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Post and partially implements editor.Editable

func (*FileUpload) Push

func (f *FileUpload) Push() []string

func (*FileUpload) String

func (f *FileUpload) String() string

String partially implements item.Identifiable and overrides Item's String()

type User

type User struct {
	Id    uint64 `json:"id"`
	Email string `json:"email"`
	Hash  string `json:"hash"`
	Salt  string `json:"salt"`
}

func (*User) Name

func (u *User) Name() string

Jump to

Keyboard shortcuts

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