【文件属性】:
文件名称:branca:安全替代JWT。 经过验证的Go加密API令牌
文件大小:7KB
文件格式:ZIP
更新时间:2021-01-30 16:28:56
go api golang jwt cryptography
布兰卡
branca是JWT的安全替代方案,此实现是用纯Go语言编写的(无cgo依赖项),并且实现了。
要求
转到1.13+
安装
go get -u github.com/hako/branca
例
package main
import (
"fmt"
"github.com/hako/branca"
)
func main () {
b := branca . NewBranca ( "supersecretkeyyoushouldnotcommit" ) // This key must be exactly 32 bytes long.
// Encode String to Branca Token.
token , err := b . EncodeToString ( "Hello world!" )
if err != nil {
fmt . Println ( err )
}
//b.SetTTL(3600) // Uncomment this to set an expiration (or ttl) of the tok
【文件预览】:
branca-master
----.gitignore(266B)
----README.md(2KB)
----LICENSE(1KB)
----go.mod(139B)
----go.sum(987B)
----.travis.yml(48B)
----branca.go(4KB)
----branca_test.go(7KB)