@@ -262,12 +262,12 @@ impl<T: TreeIndex> SecretTree<T> {
262
262
263
263
let res = ratchet
264
264
. message_key_generation ( cipher_suite, generation, key_type)
265
- . await ? ;
265
+ . await ;
266
266
267
267
self . known_secrets
268
268
. set_node ( leaf_index, SecretTreeNode :: Ratchet ( ratchet) ) ;
269
269
270
- Ok ( res)
270
+ res
271
271
}
272
272
}
273
273
@@ -808,6 +808,30 @@ mod tests {
808
808
)
809
809
}
810
810
811
+ #[ maybe_async:: test( not( mls_build_async) , async ( mls_build_async, crate :: futures_test) ) ]
812
+ async fn double_hit_leaves_epoch_intact ( ) {
813
+ let cs = test_cipher_suite_provider ( TEST_CIPHER_SUITE ) ;
814
+ let test_secret = vec ! [ 0u8 ; cs. kdf_extract_size( ) ] ;
815
+ let mut test_tree = get_test_tree ( test_secret, 4u32 ) ;
816
+ let key_type = KeyType :: Application ;
817
+
818
+ // We receive a ciphertext from leaf 2 (node 4)
819
+ test_tree
820
+ . message_key_generation ( & cs, 4 , key_type, 0 )
821
+ . await
822
+ . unwrap ( ) ;
823
+
824
+ // Due to a double hit we receive that ciphertext again
825
+ let res = test_tree. message_key_generation ( & cs, 4 , key_type, 0 ) . await ;
826
+ assert_matches ! ( res, Err ( MlsError :: KeyMissing ( 0 ) ) ) ;
827
+
828
+ // We receive another ciphertext from leaf 2
829
+ test_tree
830
+ . message_key_generation ( & cs, 4 , key_type, 1 )
831
+ . await
832
+ . unwrap ( ) ;
833
+ }
834
+
811
835
#[ derive( Debug , PartialEq , serde:: Serialize , serde:: Deserialize ) ]
812
836
struct Ratchet {
813
837
application_keys : Vec < Vec < u8 > > ,
0 commit comments