func NewAES(subMarshaller codec.MarshalUnmarshaler, key []byte) (*AES, error) {
	aesCipher, err := aes.NewCipher(key)
	if err != nil {
		return nil, fmt.Errorf("error creating AES cipher: %w", err)
	}

	aesGCM, err := cipher.NewGCM(aesCipher)
	if err != nil {
		return nil, fmt.Errorf("error creating GCM block mode: %w", err)
	}

	return &AES{
		subMarshaller: subMarshaller,
		aesGCM:        aesGCM,
	}, nil
}
// NewAES creates a new AES encryption marshaller. It takes a sub marshaller to actually serialize the data and a 16/32 bytes private key to
// encrypt all data using AES in GCM block mode.
NewAES creates a new AES encryption marshaller. It takes a sub marshaller to actually serialize the data and a 16/32 bytes private key to
encrypt all data using AES in GCM block mode.
// NewAES creates a new AES encryption marshaller . It takes a sub marshaller to actually serialize the data and a 16 / 32 bytes private key to // encrypt all data using AES in GCM block mode .
func NewAES(subMarshaller codec.MarshalUnmarshaler, key []byte) (*AES, error) {
	aesCipher, err := aes.NewCipher(key)
	if err != nil {
		return nil, fmt.Errorf("error creating AES cipher: %w", err)
	}
	aesGCM, err := cipher.NewGCM(aesCipher)
	if err != nil {
		return nil, fmt.Errorf("error creating GCM block mode: %w", err)
	}
	return &AES{
		subMarshaller: subMarshaller,
		aesGCM:        aesGCM,
	}, nil
}
func NewAES ( subMarshaller codec . MarshalUnmarshaler , key [ ] byte ) ( * AES , error ) { aesCipher , err := aes . NewCipher ( key ) if err != nil { return nil , fmt . Errorf ( " " , err ) } aesGCM , err := cipher . NewGCM ( aesCipher ) if err != nil { return nil , fmt . Errorf ( " " , err ) } return & AES { subMarshaller : subMarshaller , aesGCM : aesGCM , } , nil }
NewAES creates a new AES encryption marshaller.
NewAES creates a new AES encryption marshaller .