Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultJWTSecret = "default-secret-key" // Should be overridden in production | 生产环境应覆盖 TikTokenLength = 11 // TikTok-style short ID length | Tik风格短ID长度 TikCharset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" HashRandomBytesLen = 16 // Random bytes length for hash token | 哈希Token的随机字节长度 TimestampRandomLen = 8 // Random bytes length for timestamp token | 时间戳Token的随机字节长度 DefaultSimpleLength = 16 // Default simple token length | 默认简单Token长度 )
Constants for token generation | Token生成常量
Variables ¶
View Source
var ( ErrInvalidToken = fmt.Errorf("invalid token") ErrUnexpectedSigningMethod = fmt.Errorf("unexpected signing method") )
Error variables | 错误变量
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator Token generator | Token生成器
func NewGenerator ¶
NewGenerator Creates a new token generator | 创建新的Token生成器
func (*Generator) GetLoginIDFromJWT ¶ added in v0.1.2
GetLoginIDFromJWT Extracts login ID from JWT token | 从JWT Token中提取登录ID
func (*Generator) ValidateJWT ¶
ValidateJWT Validates JWT token | 验证JWT Token
Click to show internal directories.
Click to hide internal directories.