@@ -362,10 +362,8 @@ describe('WASM Objects', () => {
362
362
expect ( isOwner ) . equal ( true ) ;
363
363
} )
364
364
365
- it ( 'cannot be decrypted with an invalid record view key' , ( ) => {
366
- const foreignViewKey = ViewKey . from_string ( foreignViewKeyString ) ;
367
- const badRecordViewKey = ciphertext . recordViewKey ( foreignViewKey ) ;
368
-
365
+ it ( 'cannot be decrypted with an invalid record view key' , ( ) => {
366
+ const badRecordViewKey = ciphertext . recordViewKey ( ViewKey . from_string ( foreignViewKeyString ) ) ;
369
367
// Ensure the record ciphertext cannot be decrypted with an invalid record view key
370
368
expect ( ( ) => ciphertext . decryptWithRecordViewKey ( badRecordViewKey ) ) . throw ( ) ;
371
369
} )
@@ -406,7 +404,7 @@ describe('WASM Objects', () => {
406
404
it ( 'can generate a transition view key from a valid view key' , ( ) => {
407
405
const generatedTransitionViewKey = transition . tvk ( viewKey ) ;
408
406
409
- const generatedTransitionViewKeyFromEncryptionToolkit = EncryptionToolkit . generateTransitionViewKey ( viewKey , transition ) ;
407
+ const generatedTransitionViewKeyFromEncryptionToolkit = EncryptionToolkit . generateTvk ( viewKey , transition . tpk ( ) ) ;
410
408
// Ensure the generated transition view key is the same as the one used to decrypt
411
409
expect ( generatedTransitionViewKey . toString ( ) ) . equal ( generatedTransitionViewKeyFromEncryptionToolkit . toString ( ) ) ;
412
410
} ) ;
@@ -427,14 +425,14 @@ owner: aleo1j7qxyunfldj2lp8hsvy7mw5k8zaqgjfyr72x2gh3x4ewgae8v5gscf5jh3.private,
427
425
const recordViewKey = Field . fromString ( recordViewKeyString ) ;
428
426
429
427
it ( 'can generate a record view key from a view key and a record ciphertext' , ( ) => {
430
- const generatedRecordViewKey = EncryptionToolkit . generateRecordViewkey ( viewKey , recordCiphertext ) ;
428
+ const generatedRecordViewKey = EncryptionToolkit . generateRecordViewKey ( viewKey , recordCiphertext ) ;
431
429
// Ensure the generated record view key is the same as the one used to decrypt
432
430
expect ( generatedRecordViewKey . toString ( ) ) . equal ( recordViewKey . toString ( ) ) ;
433
431
} ) ;
434
432
it ( 'can decrypt a record ciphertext with the record view key' , ( ) => {
435
433
const decryptedRecord = EncryptionToolkit . decryptRecordWithRVk ( recordViewKey , recordCiphertext ) ;
436
434
// Ensure the decrypted record is the same as the plaintext
437
- expect ( decryptedRecord ) . equal ( recordPlaintext ) ;
435
+ expect ( decryptedRecord . toString ( ) ) . equal ( recordPlaintext . toString ( ) ) ;
438
436
} ) ;
439
437
it ( 'cannot decrypt a record ciphertext with an invalid record view key' , ( ) => {
440
438
const invalidRecordViewKey = Field . fromString ( "4445718830394614891114647247073357114867447866913203502139893824059966201724field" ) ;
0 commit comments