@@ -2310,7 +2310,10 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
23102310 kmip : { } ,
23112311 local : undefined
23122312 } ;
2313- let client1 , client2 ;
2313+ /** @type {import('../../mongodb').MongoClient } */
2314+ let client1 ;
2315+ /** @type {import('../../mongodb').MongoClient } */
2316+ let client2 ;
23142317
23152318 describe ( 'Case 1: Rewrap with separate ClientEncryption' , function ( ) {
23162319 /**
@@ -2341,12 +2344,16 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
23412344 `should rewrap data key from ${ srcProvider } to ${ dstProvider } ` ,
23422345 metadata ,
23432346 async function ( ) {
2347+ client1 . mongoLogger ?. trace ( 'client' , 'dropping datakeys collection' ) ;
2348+
23442349 // Step 1. Drop the collection ``keyvault.datakeys``
23452350 await client1
23462351 . db ( 'keyvault' )
23472352 . dropCollection ( 'datakeys' )
23482353 . catch ( ( ) => null ) ;
23492354
2355+ client1 . mongoLogger ?. trace ( 'client' , 'dropped datakeys collection' ) ;
2356+
23502357 // Step 2. Create a ``ClientEncryption`` object named ``clientEncryption1``
23512358 const clientEncryption1 = new ClientEncryption ( client1 , {
23522359 keyVaultNamespace : 'keyvault.datakeys' ,
@@ -2361,17 +2368,24 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
23612368 bson : BSON
23622369 } ) ;
23632370
2371+ client1 . mongoLogger ?. trace ( 'client' , 'clientEncryption1.createDataKey started' ) ;
2372+
23642373 // Step 3. Call ``clientEncryption1.createDataKey`` with ``srcProvider``
23652374 const keyId = await clientEncryption1 . createDataKey ( srcProvider , {
23662375 masterKey : masterKeys [ srcProvider ]
23672376 } ) ;
23682377
2378+ client1 . mongoLogger ?. trace ( 'client' , 'clientEncryption1.createDataKey finished' ) ;
2379+ client1 . mongoLogger ?. trace ( 'client' , 'clientEncryption1.encrypt started' ) ;
2380+
23692381 // Step 4. Call ``clientEncryption1.encrypt`` with the value "test"
23702382 const cipherText = await clientEncryption1 . encrypt ( 'test' , {
23712383 keyId,
23722384 algorithm : 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'
23732385 } ) ;
23742386
2387+ client1 . mongoLogger ?. trace ( 'client' , 'clientEncryption1.encrypt finished' ) ;
2388+
23752389 // Step 5. Create a ``ClientEncryption`` object named ``clientEncryption2``
23762390 const clientEncryption2 = new ClientEncryption ( client2 , {
23772391 keyVaultNamespace : 'keyvault.datakeys' ,
@@ -2386,6 +2400,8 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
23862400 bson : BSON
23872401 } ) ;
23882402
2403+ client2 . mongoLogger ?. trace ( 'client' , 'clientEncryption2.rewrapManyDataKey started' ) ;
2404+
23892405 // Step 6. Call ``clientEncryption2.rewrapManyDataKey`` with an empty ``filter``
23902406 const rewrapManyDataKeyResult = await clientEncryption2 . rewrapManyDataKey (
23912407 { } ,
@@ -2395,16 +2411,25 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
23952411 }
23962412 ) ;
23972413
2414+ client2 . mongoLogger ?. trace ( 'client' , 'clientEncryption2.rewrapManyDataKey finished' ) ;
2415+
23982416 expect ( rewrapManyDataKeyResult ) . to . have . property ( 'bulkWriteResult' ) ;
23992417 expect ( rewrapManyDataKeyResult . bulkWriteResult ) . to . have . property ( 'modifiedCount' , 1 ) ;
24002418
2419+ client1 . mongoLogger ?. trace ( 'client' , 'clientEncryption1.decrypt started' ) ;
2420+
24012421 // 7. Call ``clientEncryption1.decrypt`` with the ``ciphertext``. Assert the return value is "test".
24022422 const decryptResult1 = await clientEncryption1 . decrypt ( cipherText ) ;
24032423 expect ( decryptResult1 ) . to . equal ( 'test' ) ;
24042424
2425+ client1 . mongoLogger ?. trace ( 'client' , 'clientEncryption1.decrypt finished' ) ;
2426+ client2 . mongoLogger ?. trace ( 'client' , 'clientEncryption2.decrypt started' ) ;
2427+
24052428 // 8. Call ``clientEncryption2.decrypt`` with the ``ciphertext``. Assert the return value is "test".
24062429 const decryptResult2 = await clientEncryption2 . decrypt ( cipherText ) ;
24072430 expect ( decryptResult2 ) . to . equal ( 'test' ) ;
2431+
2432+ client2 . mongoLogger ?. trace ( 'client' , 'clientEncryption2.decrypt finished' ) ;
24082433 }
24092434 ) ;
24102435 }
0 commit comments