blackmwk commented on code in PR #2834:
URL: https://github.com/apache/iceberg-rust/pull/2834#discussion_r3594467012
##########
crates/iceberg/src/encryption/key_metadata.rs:
##########
@@ -54,10 +54,15 @@ impl fmt::Debug for StandardKeyMetadata {
}
impl StandardKeyMetadata {
- /// Creates a new `StandardKeyMetadata`.
- pub fn new(encryption_key: &[u8]) -> Self {
+ /// Creates a new `StandardKeyMetadata` from raw key bytes.
+ pub fn new(encryption_key: &[u8]) -> Result<Self> {
Review Comment:
```suggestion
pub fn try_new(encryption_key: &[u8]) -> Result<Self> {
```
##########
crates/iceberg/src/encryption/key_metadata.rs:
##########
@@ -54,10 +54,15 @@ impl fmt::Debug for StandardKeyMetadata {
}
impl StandardKeyMetadata {
- /// Creates a new `StandardKeyMetadata`.
- pub fn new(encryption_key: &[u8]) -> Self {
+ /// Creates a new `StandardKeyMetadata` from raw key bytes.
+ pub fn new(encryption_key: &[u8]) -> Result<Self> {
+ Ok(Self::from_secure_key(SecureKey::new(encryption_key)?))
+ }
+
+ /// Creates a new `StandardKeyMetadata` from an already-validated key.
+ pub fn from_secure_key(encryption_key: SecureKey) -> Self {
Review Comment:
nit: Implement From for SecureKey?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]