@@ -757,6 +757,66 @@ class DocumentAccessResult {
757757 pre_build_generate_equals_and_hashcode DocumentAccessResult ;
758758} ) ;
759759
760+ foreign_class ! (
761+ /// Result of file encryption (managed). Contains metadata about the encrypted document.
762+ class DocumentFileEncryptResult {
763+ self_type DocumentFileEncryptResult ;
764+ private constructor = empty;
765+ /// Unique (within the segment) id of the document
766+ fn document_file_encrypt_result:: id( & self ) -> DocumentId ; alias getId;
767+ /// Non-unique document name
768+ fn document_file_encrypt_result:: name( & self ) -> Option <DocumentName >; alias getName;
769+ /// When the document was created
770+ fn document_file_encrypt_result:: created( & self ) -> OffsetDateTime ; alias getCreated;
771+ /// When the document was last updated
772+ fn document_file_encrypt_result:: last_updated( & self ) -> OffsetDateTime ; alias getLastUpdated;
773+ /// Get the users and groups whose access was successfully granted
774+ fn DocumentAccessChange :: changed( & self ) -> SucceededResult ; alias getChanged;
775+ /// Get the users and groups whose access failed to be granted
776+ fn DocumentAccessChange :: errors( & self ) -> FailedResult ; alias getErrors;
777+ pre_build_generate_equals_and_hashcode DocumentFileEncryptResult ;
778+ } ) ;
779+
780+ foreign_class ! (
781+ /// Result of file encryption (unmanaged). Contains the document ID and encrypted DEKs.
782+ class DocumentFileEncryptUnmanagedResult {
783+ self_type DocumentFileEncryptUnmanagedResult ;
784+ private constructor = empty;
785+ /// Unique (within the segment) id of the document
786+ fn document_file_encrypt_unmanaged_result:: id( & self ) -> DocumentId ; alias getId;
787+ /// Bytes of encrypted document encryption keys (EDEKs)
788+ fn document_file_encrypt_unmanaged_result:: encrypted_deks( & self ) -> Vec <i8 >; alias getEncryptedDeks;
789+ /// Get the users and groups whose access was successfully granted
790+ fn DocumentAccessChange :: changed( & self ) -> SucceededResult ; alias getChanged;
791+ /// Get the users and groups whose access failed to be granted
792+ fn DocumentAccessChange :: errors( & self ) -> FailedResult ; alias getErrors;
793+ pre_build_generate_equals_and_hashcode DocumentFileEncryptUnmanagedResult ;
794+ } ) ;
795+
796+ foreign_class ! (
797+ /// Result of file decryption (managed). Contains minimal metadata about the decrypted document.
798+ class DocumentFileDecryptResult {
799+ self_type DocumentFileDecryptResult ;
800+ private constructor = empty;
801+ /// Unique (within the segment) id of the document
802+ fn document_file_decrypt_result:: id( & self ) -> DocumentId ; alias getId;
803+ /// Non-unique document name
804+ fn document_file_decrypt_result:: name( & self ) -> Option <DocumentName >; alias getName;
805+ pre_build_generate_equals_and_hashcode DocumentFileDecryptResult ;
806+ } ) ;
807+
808+ foreign_class ! (
809+ /// Result of file decryption (unmanaged). Contains the document ID and access info.
810+ class DocumentFileDecryptUnmanagedResult {
811+ self_type DocumentFileDecryptUnmanagedResult ;
812+ private constructor = empty;
813+ /// Unique (within the segment) id of the document
814+ fn document_file_decrypt_unmanaged_result:: id( & self ) -> DocumentId ; alias getId;
815+ /// User/Group that granted access to the encrypted data
816+ fn document_file_decrypt_unmanaged_result:: access_via( & self ) -> UserOrGroupId ; alias getAccessViaUserOrGroup;
817+ pre_build_generate_equals_and_hashcode DocumentFileDecryptUnmanagedResult ;
818+ } ) ;
819+
760820foreign_class ! (
761821/// Policy evaluation caching config
762822///
@@ -1066,6 +1126,41 @@ class IronOxide {
10661126 /// @return result containing updated EDEKs and per-user/group success/failure
10671127 fn document_revoke_access_unmanaged( & self , edeks: & [ i8 ] , userRevokes: & [ UserId ] , groupRevokes: & [ GroupId ] )
10681128 -> Result <DocumentAccessUnmanagedResult , String >; alias documentRevokeAccessUnmanaged;
1129+ /// Encrypt a file from source path to destination path (managed).
1130+ /// Uses streaming I/O with constant memory usage. The output format is identical to documentEncrypt.
1131+ ///
1132+ /// @param sourcePath path to the plaintext file to encrypt
1133+ /// @param destinationPath path where the encrypted file will be written
1134+ /// @param encryptOpts optional document encrypt parameters
1135+ /// @return metadata about the encrypted document including id, name, timestamps, and access grants/errors
1136+ fn document_file_encrypt( & self , sourcePath: & str , destinationPath: & str , encryptOpts: & DocumentEncryptOpts )
1137+ -> Result <DocumentFileEncryptResult , String >; alias documentFileEncrypt;
1138+ /// Decrypt an encrypted file to destination path (managed).
1139+ /// Uses streaming I/O with constant memory usage.
1140+ ///
1141+ /// @param sourcePath path to the encrypted file to decrypt
1142+ /// @param destinationPath path where the decrypted file will be written
1143+ /// @return metadata about the decrypted document including id and name
1144+ fn document_file_decrypt( & self , sourcePath: & str , destinationPath: & str )
1145+ -> Result <DocumentFileDecryptResult , String >; alias documentFileDecrypt;
1146+ /// Encrypt a file from source path to destination path (unmanaged).
1147+ /// Uses streaming I/O with constant memory usage. Returns encrypted DEKs instead of storing them on the server.
1148+ ///
1149+ /// @param sourcePath path to the plaintext file to encrypt
1150+ /// @param destinationPath path where the encrypted file will be written
1151+ /// @param encryptOpts optional document encrypt parameters
1152+ /// @return document ID, encrypted DEKs, and access grants/errors
1153+ fn document_file_encrypt_unmanaged( & self , sourcePath: & str , destinationPath: & str , encryptOpts: & DocumentEncryptOpts )
1154+ -> Result <DocumentFileEncryptUnmanagedResult , String >; alias documentFileEncryptUnmanaged;
1155+ /// Decrypt an encrypted file to destination path (unmanaged).
1156+ /// Uses streaming I/O with constant memory usage. Caller provides encrypted DEKs.
1157+ ///
1158+ /// @param sourcePath path to the encrypted file to decrypt
1159+ /// @param destinationPath path where the decrypted file will be written
1160+ /// @param encryptedDeks encrypted document encryption keys
1161+ /// @return document ID and the user/group that granted access
1162+ fn document_file_decrypt_unmanaged( & self , sourcePath: & str , destinationPath: & str , encryptedDeks: & [ i8 ] )
1163+ -> Result <DocumentFileDecryptUnmanagedResult , String >; alias documentFileDecryptUnmanaged;
10691164 /// Initialize IronOxide with a device and a pre-populated public key cache.
10701165 ///
10711166 /// @param init device context used to initialize the IronOxide with a set of device keys
0 commit comments