starcrypto/symm/options.go

23 lines
454 B
Go
Raw Normal View History

package symm
// CipherOptions provides a unified configuration for symmetric APIs.
// For AEAD modes (GCM/CCM), Nonce must be set explicitly.
type CipherOptions struct {
Mode string
Padding string
IV []byte
Nonce []byte
AAD []byte
}
func normalizeCipherOptions(opts *CipherOptions) CipherOptions {
if opts == nil {
return CipherOptions{}
}
return *opts
}
func nonceFromOptions(opts CipherOptions) []byte {
return opts.Nonce
}