parent
8ff99c19cd
commit
2561ee410a
Binary file not shown.
@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/oklog/ulid"
|
||||
"github.com/rs/xid"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main(){
|
||||
//获取主键ID
|
||||
ak := xid.New()
|
||||
appKey := ak.String() //新增就生成一个secret
|
||||
t := time.Now().UTC()
|
||||
entropy := rand.New(rand.NewSource(t.UnixNano()))
|
||||
appSecret := strings.ToLower(ulid.MustNew(ulid.Timestamp(t), entropy).String())
|
||||
|
||||
fmt.Println(appKey,appSecret)
|
||||
}
|
Loading…
Reference in new issue