crypthelper

package
v0.0.0-...-29e02a0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 10 Imported by: 0

README

该包为 biob-v1 使用 后续作废

  1. 密码部分移到 utils
  2. jwt 部分移到 ddmember 包

Documentation

Overview

* @Name: * @Descripttion: * @Warning: * @version: * @Author: moo * @Date: 2020-10-29 18:27:27 * @LastEditors: moo * @LastEditTime: 2020-10-30 19:03:03

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneEmailValidateCode

func GeneEmailValidateCode(orgid uint, uid uint) (string, error)

func GenePwdHash

func GenePwdHash(userPassword string) (string, error)

GenePwdHash 给密码就行加密操作

func GeneSalt

func GeneSalt() string

func GeneToken

func GeneToken(uid uint, exp_min ...int) (string, error)

func InitJwt

func InitJwt(secret string)

func RandomNum

func RandomNum(n int) string

func RandomString

func RandomString(n int) string

RandomString returns a random string with a fixed length

func RsaDecrypt

func RsaDecrypt(ciphertext []byte) ([]byte, error)

解密

func RsaEncrypt

func RsaEncrypt(origData []byte) ([]byte, error)

加密

func ValidatePwd

func ValidatePwd(userPassword string, hashed string) bool

ValidatePwd 密码比对

Types

type Payload

type Payload struct {
	UID      uint   `json:"uid"`
	UserName string `json:"username"`
	jwt.StandardClaims
}

func ParseToken

func ParseToken(token string) (*Payload, error)

Jump to

Keyboard shortcuts

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