auth

package
v0.0.0-...-9ca5070 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	*models.User
}

func NewUser

func NewUser(username string, password string) (*User, error)

NewUser instanciates a user object

func (*User) Authenticate

func (myUser *User) Authenticate() (bool, error)

Authenticate allows to auth a user

func (*User) GeneratePlainKeyPair

func (u *User) GeneratePlainKeyPair() (*models.PlainKeyPair, error)

func (*User) GetPrivateKey

func (myUser *User) GetPrivateKey() (*rsa.PrivateKey, error)

GetPrivateKey decrypts the private key using the key which has encrypted it, and returns it

func (*User) GetPublicKey

func (myUser *User) GetPublicKey() (*rsa.PublicKey, error)

GetPublicKey return public key

func (*User) NewUserKeys

func (myUser *User) NewUserKeys() (*UserKeys, error)

NewUserKeys builds a UserKeys object. It uses a hash512 of the user's password, to encrypt the private key

func (*User) SignUp

func (myUser *User) SignUp() error

SignUp user into db

func (*User) UserExist

func (myUser *User) UserExist() (bool, error)

UserExist check if username exist in db

type UserKeys

type UserKeys struct {
	*models.UserKeys
}

func (*UserKeys) SaveToDB

func (keys *UserKeys) SaveToDB() error

SaveToDB saves keys to db

Jump to

Keyboard shortcuts

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