You've already forked oauth2-proxy
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:
17
pkg/encryption/nonce.go
Normal file
17
pkg/encryption/nonce.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user