feat: complete auth

This commit is contained in:
Rogee
2024-11-27 20:58:41 +08:00
parent e4b9cc5f26
commit 301879ca39
10 changed files with 380 additions and 54 deletions

14
pkg/wechat/funcs.go Normal file
View File

@@ -0,0 +1,14 @@
package wechat
import "math/rand"
// RandomString generate random size string
func randomString(size int) (string, error) {
// generate size string [0-9a-zA-Z]
const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
b := make([]byte, size)
for i := range b {
b[i] = chars[rand.Intn(len(chars))]
}
return string(b), nil
}