xanderbailey commented on code in PR #3930:
URL: https://github.com/apache/iceberg-python/pull/3930#discussion_r3992237494
##########
pyiceberg/table/metadata.py:
##########
@@ -125,6 +126,33 @@ def construct_refs(table_metadata: TableMetadata) ->
TableMetadata:
return table_metadata
+class EncryptedKey(IcebergBaseModel):
+ """A key used for table encryption, tracked in v3 metadata under
`encryption-keys`.
+
+ https://iceberg.apache.org/spec/#encryption-keys
+ """
+
+ key_id: str = Field(alias="key-id")
+ """ID of the encryption key."""
+
+ encrypted_key_metadata: bytes = Field(alias="encrypted-key-metadata")
+ """The encrypted key and metadata, base64 encoded in JSON."""
+
+ encrypted_by_id: str | None = Field(alias="encrypted-by-id", default=None)
+ """ID of the key used to encrypt or wrap `encrypted-key-metadata`."""
+
+ properties: dict[str, str] = Field(default_factory=dict)
+ """Additional metadata used by the table's encryption scheme."""
+
+ @field_validator("encrypted_key_metadata", mode="before")
+ def decode_encrypted_key_metadata(cls, encrypted_key_metadata: Any) -> Any:
+ return base64.b64decode(encrypted_key_metadata) if
isinstance(encrypted_key_metadata, str) else encrypted_key_metadata
Review Comment:
[cc9e329](https://github.com/apache/iceberg-python/pull/3930/commits/cc9e32981f5bff366121a98aa4607149df57b0ca)
--
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]