用于 Golang 的经过认证的加密 API 令牌 (IETF XChaCha20-Poly1305 AEAD)
Installation • Usage example • Benchmarks • Build Status • License
branca.go is branca token specification implementation for Go 1.23+.
Features and benefits:
Make sure you have a working Go 1.23+ workspace (instructions), then:
go get -u github.com/essentialkaos/branca/v2package main
import (
"fmt"
"github.com/essentialkaos/branca/v2"
)
func main() {
key := "abcd1234abcd1234abcd1234abcd1234"
brc, err := branca.NewBranca([]byte(key))
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
payload := "MySuperSecretData"
token, err := brc.EncodeToString([]byte(payload))
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
fmt.Printf("Token: %s\n", token)
}
You can run benchmarks by yourself using make benchmark command.
…| Branch | Status |
|---|---|
master |
|
develop |
Before contributing to this project please read our Contributing Guidelines.
暂无开放 Issues,或尚未同步最近议题。