add key size as constant.

Signed-off-by: Volkan Özçelik <me@volkan.io>
This commit is contained in:
Volkan Özçelik 2025-08-23 16:29:20 -07:00
parent af789658e2
commit 72d6272863
No known key found for this signature in database
GPG Key ID: FDA6FFBBC9465A7F
1 changed files with 3 additions and 2 deletions

View File

@ -12,7 +12,8 @@ import (
var reader = rand.Read
const aes256KeySize = 32
// AES256KeySize defines the size of a key in bytes for AES-256 encryption.
const AES256KeySize = 32
// AES256Seed generates a cryptographically secure random 256-bit key suitable
// for use with AES-256 encryption. The key is returned as a hexadecimal-encoded
@ -28,7 +29,7 @@ const aes256KeySize = 32
// can be decoded back to bytes using hex.DecodeString when needed for encryption.
func AES256Seed() (string, error) {
// Generate a 256-bit key
key := make([]byte, aes256KeySize)
key := make([]byte, AES256KeySize)
_, err := reader(key)
if err != nil {