Skip to content

Commit

Permalink
Update wrt. tx.computeBytesForVerifying().
Browse files Browse the repository at this point in the history
  • Loading branch information
andreibancioiu committed Apr 5, 2024
1 parent 8d744ba commit e351e03
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions docs/sdk-and-tools/sdk-js/sdk-js-cookbook-v13.md
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ const bobVerifier = UserVerifier.fromAddress(addressOfBob);
Verifying a signature:

```
serializedTransaction = transactionComputer.computeBytesForSigning(transaction);
serializedTransaction = transactionComputer.computeBytesForVerifying(transaction);
serializedMessage = messageComputer.computeBytesForVerifying(message);
console.log("Is signature of Alice?", aliceVerifier.verify(serializedTransaction, transaction.signature));
Expand Down Expand Up @@ -1066,13 +1066,6 @@ const bytesToSign = transactionComputer.computeHashForSigning(transaction);
transaction.signature = await signer.sign(bytesToSign);
```

If hash signing is used for transactions, make sure to handle the verification accordingly:

```
const bytesToVerify = transactionComputer.computeHashForSigning(transaction);
console.log("Is signature of Alice?", aliceVerifier.verify(bytesToVerify, transaction.signature));
```

:::note
If you'd like to learn more about hash signing, please refer to the overview on [signing transactions](/developers/signing-transactions).
:::
Expand Down

0 comments on commit e351e03

Please sign in to comment.