website/pkg/encryption/keygen/keygen.go

12 lines
277 B
Go
Raw Normal View History

2023-09-19 00:22:50 +00:00
// Package keygen provides the AES key initializer function.
package keygen
import "crypto/rand"
// NewAESKey returns a 32-byte (AES 256 bit) encryption key.
func NewAESKey() ([]byte, error) {
var result = make([]byte, 32)
_, err := rand.Read(result)
return result, err
}