utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MASTER_KEY_ENV      = "MASTER_KEY"
	HMAC_SECRET_KEY_ENV = "HMAC_SECRET_KEY"

	POSTGRES_CONNECTION_STRING_ENV = "POSTGRES_CONNECTION_STRING"

	SKIP_PADDING_ENV = "SKIP_PADDING"

	VAPID_EXPIRY_DURATION_ENV = "VAPID_EXPIRY_DURATION"
	VAPID_PRIVATE_KEY_ENV     = "VAPID_PRIVATE_KEY"
	VAPID_SUBJECT_ENV         = "VAPID_SUBJECT"
)
View Source
const (
	APPLICATION_JSON = "application/json"
	JSON_API         = "application/vnd.api+json"
	TEXT_PLAIN       = "text/plain"
)
View Source
const (
	URGENCY_VERY_LOW = "very-low"
	URGENCY_LOW      = "low"
	URGENCY_NORMAL   = "normal"
	URGENCY_HIGH     = "high"
)
View Source
const (
	EPOCH_GT_NOW = "epoch-gt-now"
	MAILTO       = "mailto"
	ORIGIN       = "origin"
)

Variables

This section is empty.

Functions

func CustomValidateStruct

func CustomValidateStruct(s any) (err error)

func Decrypt

func Decrypt(data []byte) ([]byte, error)

func Encrypt

func Encrypt(data []byte) ([]byte, error)

func Hash

func Hash(data []byte) (hashed [32]byte)

func NewCustomValidator

func NewCustomValidator() *validator.Validate

Types

type EncryptedBytes

type EncryptedBytes []byte

func (*EncryptedBytes) Scan

func (e *EncryptedBytes) Scan(value interface{}) error

func (EncryptedBytes) Value

func (e EncryptedBytes) Value() (driver.Value, error)

type EncryptedString

type EncryptedString string

func (*EncryptedString) Scan

func (e *EncryptedString) Scan(value interface{}) error

func (EncryptedString) Value

func (e EncryptedString) Value() (driver.Value, error)

type Epoch

type Epoch time.Time

func (Epoch) MarshalJSON

func (e Epoch) MarshalJSON() ([]byte, error)

func (*Epoch) Scan

func (e *Epoch) Scan(value interface{}) error

func (*Epoch) UnmarshalJSON

func (e *Epoch) UnmarshalJSON(data []byte) (err error)

func (Epoch) Value

func (e Epoch) Value() (driver.Value, error)

type EpochMillis

type EpochMillis time.Time

func (EpochMillis) MarshalJSON

func (e EpochMillis) MarshalJSON() ([]byte, error)

func (*EpochMillis) Scan

func (e *EpochMillis) Scan(value interface{}) error

func (*EpochMillis) UnmarshalJSON

func (e *EpochMillis) UnmarshalJSON(data []byte) (err error)

func (EpochMillis) Value

func (e EpochMillis) Value() (driver.Value, error)

type HashedString

type HashedString string

func (*HashedString) Compare

func (h *HashedString) Compare(plain []byte) bool

func (*HashedString) Scan

func (h *HashedString) Scan(value interface{}) error

func (HashedString) String

func (h HashedString) String() string

func (HashedString) Value

func (h HashedString) Value() (driver.Value, error)

type Recipient

type Recipient struct {
	ClientId    string `json:"clientId" validate:"required"`
	RecipientId string `json:"id" validate:"required"`

	Subscription *RecipientSubscription `json:"subscription" validate:"required"`
}

type RecipientKeys

type RecipientKeys struct {
	P256DH string `json:"p256dh" validate:"len=87"`
	Auth   string `json:"auth" validate:"len=22"`
}

type RecipientSubscription

type RecipientSubscription struct {
	Endpoint       string         `json:"endpoint" validate:"http_url"`
	ExpirationTime *EpochMillis   `json:"expirationTime,omitempty"`
	Keys           *RecipientKeys `json:"keys" validate:"required"`
}

type StringerValidator

type StringerValidator interface {
	String() string
	Validate() error
}

Jump to

Keyboard shortcuts

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