csrf protection; always set state

This commit is contained in:
Colin Arnott
2017-03-29 09:31:10 -04:00
committed by Jehiah Czebotar
parent 6c690b699b
commit 55085d9697
4 changed files with 112 additions and 44 deletions
+16
View File
@@ -0,0 +1,16 @@
package cookie
import (
"crypto/rand"
"fmt"
)
func Nonce() (nonce string, err error) {
b := make([]byte, 16)
_, err = rand.Read(b)
if err != nil {
return
}
nonce = fmt.Sprintf("%x", b)
return
}