// generateSessionKey produces a secure random n-byte session key and returns its
// base64-encoded representation that is URL-safe.
// It reports an error if n is less than MIN_SESSION_KEY_BYTE_LEN.
generateSessionKey produces a secure random n-byte session key and returns its
base64-encoded representation that is URL-safe.
It reports an error if n is less than MIN_SESSION_KEY_BYTE_LEN.
// generateSessionKey produces a secure random n - byte session key and returns its // base64 - encoded representation that is URL - safe . // It reports an error if n is less than MIN_SESSION_KEY_BYTE_LEN .
func (m *SessionManager) generateSessionKey() (*string, error) {
	randBytes := make([]byte, m.sessionKeyByteLen)
	_, err := rand.Read(randBytes)
	if err != nil {
		return nil, err
	}
	sessionKey := base64.URLEncoding.EncodeToString(randBytes)
	return &sessionKey, nil
}
func ( m * SessionManager ) generateSessionKey ( ) ( * string , error ) { randBytes := make ( [ ] byte , m . sessionKeyByteLen ) _ , err := rand . Read ( randBytes ) if err != nil { return nil , err } sessionKey := base64 . URLEncoding . EncodeToString ( randBytes ) return & sessionKey , nil }
generateSessionKey produces a secure random n-byte session key and returns its
base64-encoded representation that is URL-safe.
generateSessionKey produces a secure random n - byte session key and returns its base64 - encoded representation that is URL - safe .
// reads m.sessionKeyByteLen random bytes (e.g. len(randBytes)) to randBytes array // an error may occur if the system's secure RNG doesn't function properly, in which case // we can't generate a secure session key