secret

package
v0.0.0-...-96ffb46 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BcryptAuth

type BcryptAuth struct {
	UserContext auth.UserAuth
}

example implementation of a Revel auth security driver This driver should be embedded into your app-level User model It expects your User model to have `Password` and `HashedPassword` string fields

Your User model also needs to set itself as the UserContext for the BcryptAuth driver

func NewUser(email, pass string) *User {
	u := &User{
		email:    email,
		password: pass,
	}
	u.UserContext = u
}

func (*BcryptAuth) Authenticate

func (ba *BcryptAuth) Authenticate() (bool, error)

Bycrypt Authenticate() expects a single string argument of the plaintext password It returns true on success and false if error or password mismatch.

func (*BcryptAuth) HashSecret

func (ba *BcryptAuth) HashSecret(args ...interface{}) (string, error)

Bcrypt Secret() returns the hashed version of the password. It expects an argument of type string, which is the plain text password.

Jump to

Keyboard shortcuts

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