cipher

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cipher

type Cipher struct {
	TokenExpiredHours int
	HashCost          int
	PassPhrase        string
}

func DefaultCipher

func DefaultCipher() Cipher

func NewCipher added in v0.1.3

func NewCipher(tokenExpiredHours, hashCost int, passPhrase string) Cipher

NewCipher new a cihper

func (*Cipher) ComparePassword

func (c *Cipher) ComparePassword(ciphertext string, plaintext string) bool

ComparePassword compare the cipher text password is correct or not

func (*Cipher) EncodePassword

func (c *Cipher) EncodePassword(plaintext string) string

EncodePassword encode plain text password

func (*Cipher) GetJWT

func (c *Cipher) GetJWT(message string) string

GetJWT convert message string to token string

func (*Cipher) ParseJWT

func (c *Cipher) ParseJWT(tokenString string) (string, error)

ParseJWT convert token string to message string

type CustomClaims

type CustomClaims struct {
	Message string `json:"message"`
	jwt.StandardClaims
}

Jump to

Keyboard shortcuts

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