1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-08-08 22:46:33 +02:00

Move cookie to pkg/encryption

This commit is contained in:
Joel Speed
2019-05-24 17:06:48 +01:00
parent 8027cc454e
commit d1ef14becc
14 changed files with 43 additions and 45 deletions

17
pkg/encryption/nonce.go Normal file
View File

@ -0,0 +1,17 @@
package encryption
import (
"crypto/rand"
"fmt"
)
// Nonce generates a random 16 byte string to be used as a nonce
func Nonce() (nonce string, err error) {
b := make([]byte, 16)
_, err = rand.Read(b)
if err != nil {
return
}
nonce = fmt.Sprintf("%x", b)
return
}