From 11123820fba8bbc52739252fb69b5e421fcbea3a Mon Sep 17 00:00:00 2001 From: Matt Silverlock Date: Thu, 13 Sep 2018 11:41:34 -0700 Subject: [docs] Add note RE: persistence to GenerateRandomKey --- securecookie.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/securecookie.go b/securecookie.go index 61af390..a34f851 100644 --- a/securecookie.go +++ b/securecookie.go @@ -506,6 +506,10 @@ func decode(value []byte) ([]byte, error) { // GenerateRandomKey creates a random key with the given length in bytes. // On failure, returns nil. // +// Note that keys created using `GenerateRandomKey()` are not automatically +// persisted. New keys will be created when the application is restarted, and +// previously issued cookies will not be able to be decoded. +// // Callers should explicitly check for the possibility of a nil return, treat // it as a failure of the system random number generator, and not continue. func GenerateRandomKey(length int) []byte { -- cgit v1.2.3