Models

package
v0.0.0-...-c493954 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassphrase

func CheckPassphrase(testPrivateKey string) bool

CheckPassphrase Perform decryption, using supplied private key, against DB test row and test data

func DecryptData

func DecryptData(input string) string

func EncryptData

func EncryptData(input string) string

func GetConnection

func GetConnection() *gorm.DB

GetConnection Return database connection singleton

func GetPassphrase

func GetPassphrase() *rsa.PrivateKey

func GetPublicKey

func GetPublicKey() *rsa.PublicKey

func GetUserByUsername

func GetUserByUsername(username string, result *User)

GetUserByUsername Get user based by username

func HavePassphrase

func HavePassphrase() bool

HavePassphrase Whether passphrase has been entered and is accessible for use

func IsPassphraseSet

func IsPassphraseSet() bool

IsPassphraseSet Determine whether passphrase has been set

func SetPassphrase

func SetPassphrase() string

SetPassphrase Generate private/public key pair, storing test data and setting cached keys

func SetupDatabase

func SetupDatabase()

SetupDatabase Setupn database object and perform database migrations

Types

type Certificate

type Certificate struct {
	gorm.Model
	Domains  []CertificateDomain  `gorm:"ForeignKey:CertID"`
	Versions []CertificateVersion `gorm:"ForeignKey:CertID"`
	KeySize  int
}

Certificate structure for holding certificate in DB

func GetAllCertificates

func GetAllCertificates() []Certificate

GetAllCertificates Get all certificates

func GetCertificateByID

func GetCertificateByID(certificateID int) (Certificate, error)

func (Certificate) Create

func (cert Certificate) Create()

Create certificate in database

func (Certificate) Delete

func (cert Certificate) Delete()

Delete certificate, as well as all related objects

type CertificateDomain

type CertificateDomain struct {
	gorm.Model
	Domain string
	CertID uint
}

CertificateDomain structure for holding domain for a certificate

type CertificateVersion

type CertificateVersion struct {
	gorm.Model
	PubKey            string
	PrivKey           string
	IssuerCertificate string
	Expiry            time.Time
	CertID            uint
}

CertificateVersion structure for holding single issued certificate public and private key

func (CertificateVersion) Create

func (certVersion CertificateVersion) Create(privKey string)

Create certificate verion

func (CertificateVersion) GetPrivateKey

func (certVersion CertificateVersion) GetPrivateKey() string

type Client

type Client struct {
	gorm.Model
	Name string
}

Client struct, representing client DB table

type ClientSecret

type ClientSecret struct {
	gorm.Model
	Secret string
	Client Client `gorm:"foreignkey:Client"`
}

ClientSecret struct, representing client secret DB table

type TestData

type TestData struct {
	gorm.Model
	IsSet          bool
	EncryptedValue string
	PublicKey      string
}

TestData struct, representing test data DB table, which holds test encryption data to determine validity of encryption keySize

type User

type User struct {
	gorm.Model
	Username string
	Email    string
	Password string
}

User structure for reference to user DB table, holding users.

Jump to

Keyboard shortcuts

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