encode

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Decode

func Base64Decode(input string, urlSafe bool) ([]byte, error)

func Base64Encode

func Base64Encode(input []byte, urlSafe, noPadding bool) string

func HTMLDecode

func HTMLDecode(input string) string

func HTMLEncode

func HTMLEncode(input string) string

func Hash

func Hash(input []byte, algo string) (string, error)

func HashVerify

func HashVerify(input []byte, algo, expected string) (bool, error)

func JWTEncode

func JWTEncode(payloadJSON string, secret string, keyPEM []byte, algo string) (string, error)

func JWTInfoJSON

func JWTInfoJSON(info *JWTInfo) ([]byte, error)

func QRGenerate

func QRGenerate(input string, size int, level string) ([]byte, error)

func QRTerminal

func QRTerminal(input string, level string) (string, error)

func URLDecode

func URLDecode(input string, component bool) (string, error)

func URLEncode

func URLEncode(input string, component bool) string

Types

type JWTInfo

type JWTInfo struct {
	Header    map[string]any `json:"header"`
	Payload   map[string]any `json:"payload"`
	Signature string         `json:"signature"`
	Valid     bool           `json:"valid"`
	ExpiredAt *time.Time     `json:"expired_at,omitempty"`
}

JWTInfo holds decoded JWT information.

func JWTDecode

func JWTDecode(tokenStr string) (*JWTInfo, error)

func JWTVerify

func JWTVerify(tokenStr string, secret string, keyPEM []byte) (*JWTInfo, error)

Jump to

Keyboard shortcuts

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