users

package
v0.0.0-...-34162d4 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const CONFIGURATION_SECRET_LENGTH = 32

How long should configuration secrets be in random characters before base64 encode?

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	gorm.Model

	Username  string
	PublicKey string

	// Specify if a user's public key can be configured. Also specify a secret that must be passed for
	// the configuration to happen.
	IsConfigurable bool
	Secret         string
}

func GetUserBySecret

func GetUserBySecret(secret string) (*User, error)

Given a secret, see if a configurable user can be found with that secret.

func GetUserByUsername

func GetUserByUsername(username string) (*User, error)

Given a secret, see if a configurable user can be found with that secret.

func NewUser

func NewUser(username string) *User

Given a username as a string, return a pointer to a new user. THe user has public key configuration open.

func (*User) Create

func (u *User) Create()

func (*User) EnableConfiguration

func (u *User) EnableConfiguration() error

Set a user to be configurable by setting the boolean and generating a new secret.

func (*User) Encrypt

func (u *User) Encrypt(message string) string

Given a public key and a message, encrypt the data with that pubkic key and return it.

(input) => Encrypt => Armor => (output)

func (*User) Save

func (u *User) Save()

When updates are made to a user struct, this will sync any changes back to disk.

Jump to

Keyboard shortcuts

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