File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -38,12 +38,14 @@ type CustomRetryPolicy = FilteredRetryPolicy<
3838 Box < dyn Fn ( & VssError ) -> bool + ' static + Send + Sync > ,
3939> ;
4040
41+ const KEY_LENGTH : usize = 32 ;
42+
4143/// A [`KVStore`] implementation that writes to and reads from a [VSS](https://github.com/lightningdevkit/vss-server/blob/main/README.md) backend.
4244pub struct VssStore {
4345 client : VssClient < CustomRetryPolicy > ,
4446 store_id : String ,
4547 runtime : Arc < Runtime > ,
46- data_encryption_key : [ u8 ; 32 ] ,
48+ data_encryption_key : [ u8 ; KEY_LENGTH ] ,
4749 key_obfuscator : KeyObfuscator ,
4850}
4951
@@ -237,6 +239,12 @@ impl KVStore for VssStore {
237239 }
238240}
239241
242+ impl Drop for VssStore {
243+ fn drop ( & mut self ) {
244+ self . data_encryption_key . copy_from_slice ( & [ 0u8 ; KEY_LENGTH ] ) ;
245+ }
246+ }
247+
240248fn derive_data_encryption_and_obfuscation_keys ( vss_seed : & [ u8 ; 32 ] ) -> ( [ u8 ; 32 ] , [ u8 ; 32 ] ) {
241249 let hkdf = |initial_key_material : & [ u8 ] , salt : & [ u8 ] | -> [ u8 ; 32 ] {
242250 let mut engine = HmacEngine :: < sha256:: Hash > :: new ( salt) ;
You can’t perform that action at this time.
0 commit comments