File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,17 @@ async fn test_encryption() {
4545 assert_eq ! ( text, "the only winning move is not to play" ) ;
4646 }
4747
48+ // let's test encryption with connection string
49+ {
50+ let conn_str = format ! ( "file:{}?key=s3cR3t" , tempdir. join( "encrypted.db" ) . display( ) ) ;
51+ let db = Builder :: new_local ( & conn_str) . build ( ) . await . unwrap ( ) ;
52+ let conn = db. connect ( ) . unwrap ( ) ;
53+ let mut results = conn. query ( "SELECT * FROM messages" , ( ) ) . await . unwrap ( ) ;
54+ let row = results. next ( ) . await . unwrap ( ) . unwrap ( ) ;
55+ let text: String = row. get ( 0 ) . unwrap ( ) ;
56+ assert_eq ! ( text, "the only winning move is not to play" ) ;
57+ }
58+
4859 {
4960 let _ = std:: fs:: remove_file ( & encrypted_path) ;
5061 let _ = std:: fs:: remove_file ( & base_path) ;
You can’t perform that action at this time.
0 commit comments