File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
packages/cipherstash-proxy-integration/src Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -13,5 +13,30 @@ mod tests {
1313 } ;
1414 use chrono:: NaiveDate ;
1515
16- // Tests will be added in subsequent tasks
16+ #[ tokio:: test]
17+ async fn text_encryption_sanity_check ( ) {
18+ trace ( ) ;
19+ clear ( ) . await ;
20+
21+ let id = random_id ( ) ;
22+ let plaintext = "hello world" ;
23+
24+ // Insert through proxy (should encrypt)
25+ let client = connect_with_tls ( PROXY ) . await ;
26+ let sql = "INSERT INTO encrypted (id, encrypted_text) VALUES ($1, $2)" ;
27+ client. query ( sql, & [ & id, & plaintext] ) . await . unwrap ( ) ;
28+
29+ // Verify encryption occurred
30+ assert_encrypted_text ( id, "encrypted_text" , plaintext) . await ;
31+
32+ // Round-trip: query through proxy should decrypt back to original
33+ let sql = "SELECT encrypted_text FROM encrypted WHERE id = $1" ;
34+ let rows = client. query ( sql, & [ & id] ) . await . unwrap ( ) ;
35+ assert_eq ! ( rows. len( ) , 1 , "Expected exactly one row for round-trip" ) ;
36+ let decrypted: String = rows[ 0 ] . get ( 0 ) ;
37+ assert_eq ! (
38+ decrypted, plaintext,
39+ "DECRYPTION FAILED: Round-trip value doesn't match original!"
40+ ) ;
41+ }
1742}
You can’t perform that action at this time.
0 commit comments