models

package
v0.0.0-...-b63ba6b Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alias

type Alias struct {
	ID         string
	PayloadID  string
	Short      string
	CreatedAt  time.Time
	ModifiedAt time.Time
}

Alias represent a translation from a Payload ID to a shorter alias Useful for short injection and easier to remember E.g: /p/5c28e6cf-72d6-49b3-b03e-2a40672c41ad would be shortened /p/a It also works for subdomains like a.domain.tld

type Execution

type Execution struct {
	ID          string
	PayloadID   string
	AliasID     string
	TriggeredAt time.Time
}

Execution represents an execution of a payload. It is unique. A new trigger will generate a new Execution.

type Injection

type Injection struct {
	ID         string
	Name       string
	Content    string
	CreatedAt  time.Time
	ModifiedAt time.Time
}

type Loot

type Loot struct {
	ID        string
	Data      string
	CreatedAt time.Time
}

Loot represents an Loot of a payload. It is unique. A new trigger will generate a new Loot.

type Payload

type Payload struct {
	ID          string
	Name        string
	Content     string
	ContentType string
	Hashes      SRIHashes
	CreatedAt   time.Time
	ModifiedAt  time.Time
}

type SRIHashes

type SRIHashes struct {
	SHA256 string `json:"sha256"`
	SHA384 string `json:"sha384"`
	SHA512 string `json:"sha512"`
}

func (*SRIHashes) String

func (sh *SRIHashes) String() string

type StorageError

type StorageError uint
const (
	Success StorageError = iota
	NoSuchItem
	AlreadyExist
	StorageFailure
)

func (StorageError) Error

func (s StorageError) Error() string

type User

type User struct {
	// This should never be returned to other parts of the application
	Password string `json:"-"` // remove secret from HTTP Response
	// TOTPSecret represent the shared secret for TOTP
	TOTPSecret string `json:"-"` // remove secret from HTTP Response
	// ID should be a string: uuid. Non sequential
	ID string `json:"id"`
	// The username is the login of the user.
	Username string `json:"username"`
	// Is 2FA enabled on this account.
	// It will be used to determine if it requires another step during the login process
	TwoFactorEnabled bool      `json:"two_factor_enabled"`
	CreatedAt        time.Time `json:"created_at"`
	ModifiedAt       time.Time `json:"modified_at"`
}

User complement the SafeUser model with its password

Jump to

Keyboard shortcuts

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