Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
17 lines (13 sloc) 318 Bytes
package main
import (
"github.com/fernet/fernet-go"
)
func FernetEncrypt(s string) []byte {
tok, err := fernet.EncryptAndSign([]byte(s), ConfigFernetKeys[0])
Must(err)
return tok
}
func FernetDecrypt(b []byte) string {
msg := fernet.VerifyAndDecrypt(b, ConfigFernetTtl, ConfigFernetKeys)
return string(msg)
}