lux/crypto/lux_key.go
2024-12-29 09:13:20 +02:00

26 lines
374 B
Go

package crypto
import (
"crypto/rand"
"lux/types"
"github.com/google/uuid"
)
type LuxKey struct {
Type types.LuxType
Id uuid.UUID
Key []byte
}
func (key *LuxKey) NewLuxKey(keyType types.LuxType) error {
key.Type = keyType
key.Id = uuid.New()
key.Key = make([]byte, 32)
if _, err := rand.Read(key.Key); err != nil {
return err
} else {
return nil
}
}