@@ -362,10 +362,8 @@ describe('WASM Objects', () => {
362362 expect ( isOwner ) . equal ( true ) ;
363363 } )
364364
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 ) ) ;
369367 // Ensure the record ciphertext cannot be decrypted with an invalid record view key
370368 expect ( ( ) => ciphertext . decryptWithRecordViewKey ( badRecordViewKey ) ) . throw ( ) ;
371369 } )
@@ -406,7 +404,7 @@ describe('WASM Objects', () => {
406404 it ( 'can generate a transition view key from a valid view key' , ( ) => {
407405 const generatedTransitionViewKey = transition . tvk ( viewKey ) ;
408406
409- const generatedTransitionViewKeyFromEncryptionToolkit = EncryptionToolkit . generateTransitionViewKey ( viewKey , transition ) ;
407+ const generatedTransitionViewKeyFromEncryptionToolkit = EncryptionToolkit . generateTvk ( viewKey , transition . tpk ( ) ) ;
410408 // Ensure the generated transition view key is the same as the one used to decrypt
411409 expect ( generatedTransitionViewKey . toString ( ) ) . equal ( generatedTransitionViewKeyFromEncryptionToolkit . toString ( ) ) ;
412410 } ) ;
@@ -427,14 +425,14 @@ owner: aleo1j7qxyunfldj2lp8hsvy7mw5k8zaqgjfyr72x2gh3x4ewgae8v5gscf5jh3.private,
427425 const recordViewKey = Field . fromString ( recordViewKeyString ) ;
428426
429427 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 ) ;
431429 // Ensure the generated record view key is the same as the one used to decrypt
432430 expect ( generatedRecordViewKey . toString ( ) ) . equal ( recordViewKey . toString ( ) ) ;
433431 } ) ;
434432 it ( 'can decrypt a record ciphertext with the record view key' , ( ) => {
435433 const decryptedRecord = EncryptionToolkit . decryptRecordWithRVk ( recordViewKey , recordCiphertext ) ;
436434 // Ensure the decrypted record is the same as the plaintext
437- expect ( decryptedRecord ) . equal ( recordPlaintext ) ;
435+ expect ( decryptedRecord . toString ( ) ) . equal ( recordPlaintext . toString ( ) ) ;
438436 } ) ;
439437 it ( 'cannot decrypt a record ciphertext with an invalid record view key' , ( ) => {
440438 const invalidRecordViewKey = Field . fromString ( "4445718830394614891114647247073357114867447866913203502139893824059966201724field" ) ;
0 commit comments