File tree Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,7 @@ impl Sealer {
213213
214214 table_entries. push ( (
215215 PrimaryKeyParts { pk, sk } ,
216- record. unsealed . unprotected ( ) ,
216+ record. unsealed . unprotected ( ) . clone ( ) ,
217217 terms,
218218 ) ) ;
219219 }
Original file line number Diff line number Diff line change @@ -37,6 +37,14 @@ impl Unsealed {
3737 }
3838 }
3939
40+ pub fn protected ( & self ) -> & HashMap < String , ( Plaintext , String ) > {
41+ & self . protected
42+ }
43+
44+ pub fn unprotected ( & self ) -> & HashMap < String , TableAttribute > {
45+ & self . unprotected
46+ }
47+
4048 pub fn get_protected ( & self , name : & str ) -> Result < & Plaintext , SealError > {
4149 let ( plaintext, _) = self
4250 . protected
@@ -63,10 +71,6 @@ impl Unsealed {
6371 self . unprotected . insert ( name. into ( ) , attribute) ;
6472 }
6573
66- pub ( crate ) fn unprotected ( & self ) -> HashMap < String , TableAttribute > {
67- self . unprotected . clone ( )
68- }
69-
7074 /// Remove and return a protected value along with its descriptor.
7175 pub ( crate ) fn remove_protected_with_descriptor (
7276 & mut self ,
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ use cipherstash_client::{
1919 service_credentials:: { ServiceCredentials , ServiceToken } ,
2020 Credentials ,
2121 } ,
22- encryption:: Encryption ,
22+ encryption:: { Encryption , Plaintext } ,
2323 zero_kms:: ZeroKMS ,
2424} ;
2525use log:: info;
@@ -137,6 +137,24 @@ impl PreparedRecord {
137137 }
138138 }
139139
140+ /// Get all the [`Plaintext`] protected attributes from the [`PreparedRecord`]
141+ pub fn protected ( & self ) -> impl Iterator < Item = ( & str , & Plaintext ) > {
142+ self . sealer
143+ . unsealed
144+ . protected ( )
145+ . iter ( )
146+ . map ( |( key, ( plaintext, _descriptor) ) | ( key. as_str ( ) , plaintext) )
147+ }
148+
149+ /// Get all the unprotected attributes from the [`PreparedRecord`]
150+ pub fn unprotected ( & self ) -> impl Iterator < Item = ( & str , & TableAttribute ) > {
151+ self . sealer
152+ . unsealed
153+ . unprotected ( )
154+ . iter ( )
155+ . map ( |( key, attr) | ( key. as_str ( ) , attr) )
156+ }
157+
140158 pub fn prepare_record < R > ( record : R ) -> Result < Self , SealError >
141159 where
142160 R : Searchable + Identifiable ,
You can’t perform that action at this time.
0 commit comments