@@ -2310,7 +2310,10 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
2310
2310
kmip : { } ,
2311
2311
local : undefined
2312
2312
} ;
2313
- let client1 , client2 ;
2313
+ /** @type {import('../../mongodb').MongoClient } */
2314
+ let client1 ;
2315
+ /** @type {import('../../mongodb').MongoClient } */
2316
+ let client2 ;
2314
2317
2315
2318
describe ( 'Case 1: Rewrap with separate ClientEncryption' , function ( ) {
2316
2319
/**
@@ -2341,12 +2344,16 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
2341
2344
`should rewrap data key from ${ srcProvider } to ${ dstProvider } ` ,
2342
2345
metadata ,
2343
2346
async function ( ) {
2347
+ client1 . mongoLogger ?. trace ( 'client' , 'dropping datakeys collection' ) ;
2348
+
2344
2349
// Step 1. Drop the collection ``keyvault.datakeys``
2345
2350
await client1
2346
2351
. db ( 'keyvault' )
2347
2352
. dropCollection ( 'datakeys' )
2348
2353
. catch ( ( ) => null ) ;
2349
2354
2355
+ client1 . mongoLogger ?. trace ( 'client' , 'dropped datakeys collection' ) ;
2356
+
2350
2357
// Step 2. Create a ``ClientEncryption`` object named ``clientEncryption1``
2351
2358
const clientEncryption1 = new ClientEncryption ( client1 , {
2352
2359
keyVaultNamespace : 'keyvault.datakeys' ,
@@ -2361,17 +2368,24 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
2361
2368
bson : BSON
2362
2369
} ) ;
2363
2370
2371
+ client1 . mongoLogger ?. trace ( 'client' , 'clientEncryption1.createDataKey started' ) ;
2372
+
2364
2373
// Step 3. Call ``clientEncryption1.createDataKey`` with ``srcProvider``
2365
2374
const keyId = await clientEncryption1 . createDataKey ( srcProvider , {
2366
2375
masterKey : masterKeys [ srcProvider ]
2367
2376
} ) ;
2368
2377
2378
+ client1 . mongoLogger ?. trace ( 'client' , 'clientEncryption1.createDataKey finished' ) ;
2379
+ client1 . mongoLogger ?. trace ( 'client' , 'clientEncryption1.encrypt started' ) ;
2380
+
2369
2381
// Step 4. Call ``clientEncryption1.encrypt`` with the value "test"
2370
2382
const cipherText = await clientEncryption1 . encrypt ( 'test' , {
2371
2383
keyId,
2372
2384
algorithm : 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'
2373
2385
} ) ;
2374
2386
2387
+ client1 . mongoLogger ?. trace ( 'client' , 'clientEncryption1.encrypt finished' ) ;
2388
+
2375
2389
// Step 5. Create a ``ClientEncryption`` object named ``clientEncryption2``
2376
2390
const clientEncryption2 = new ClientEncryption ( client2 , {
2377
2391
keyVaultNamespace : 'keyvault.datakeys' ,
@@ -2386,6 +2400,8 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
2386
2400
bson : BSON
2387
2401
} ) ;
2388
2402
2403
+ client2 . mongoLogger ?. trace ( 'client' , 'clientEncryption2.rewrapManyDataKey started' ) ;
2404
+
2389
2405
// Step 6. Call ``clientEncryption2.rewrapManyDataKey`` with an empty ``filter``
2390
2406
const rewrapManyDataKeyResult = await clientEncryption2 . rewrapManyDataKey (
2391
2407
{ } ,
@@ -2395,16 +2411,25 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
2395
2411
}
2396
2412
) ;
2397
2413
2414
+ client2 . mongoLogger ?. trace ( 'client' , 'clientEncryption2.rewrapManyDataKey finished' ) ;
2415
+
2398
2416
expect ( rewrapManyDataKeyResult ) . to . have . property ( 'bulkWriteResult' ) ;
2399
2417
expect ( rewrapManyDataKeyResult . bulkWriteResult ) . to . have . property ( 'modifiedCount' , 1 ) ;
2400
2418
2419
+ client1 . mongoLogger ?. trace ( 'client' , 'clientEncryption1.decrypt started' ) ;
2420
+
2401
2421
// 7. Call ``clientEncryption1.decrypt`` with the ``ciphertext``. Assert the return value is "test".
2402
2422
const decryptResult1 = await clientEncryption1 . decrypt ( cipherText ) ;
2403
2423
expect ( decryptResult1 ) . to . equal ( 'test' ) ;
2404
2424
2425
+ client1 . mongoLogger ?. trace ( 'client' , 'clientEncryption1.decrypt finished' ) ;
2426
+ client2 . mongoLogger ?. trace ( 'client' , 'clientEncryption2.decrypt started' ) ;
2427
+
2405
2428
// 8. Call ``clientEncryption2.decrypt`` with the ``ciphertext``. Assert the return value is "test".
2406
2429
const decryptResult2 = await clientEncryption2 . decrypt ( cipherText ) ;
2407
2430
expect ( decryptResult2 ) . to . equal ( 'test' ) ;
2431
+
2432
+ client2 . mongoLogger ?. trace ( 'client' , 'clientEncryption2.decrypt finished' ) ;
2408
2433
}
2409
2434
) ;
2410
2435
}
0 commit comments