Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding method to verify signature on SignedTransaction object #308

Closed
wants to merge 1 commit into from
Closed

Adding method to verify signature on SignedTransaction object #308

wants to merge 1 commit into from

Conversation

barnjamin
Copy link
Contributor

@barnjamin barnjamin commented Mar 25, 2022

I can do this across SDKs if this is reasonable

Should fill the need of algorand-devrel/community#10

API is

#...
pk, sk = get_account()
pay_txn = transaction.PaymentTxn(pk, sp, rcv, 10000)
stxn = pay_txn.sign(sk)
if not stxn.verify_signature():
    print("failzore")
#...

@barnjamin barnjamin requested a review from winder March 25, 2022 11:53
Copy link
Contributor

@algochoi algochoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just wondering why this API has different parameters from the existing verify methods. I don't have a strong opinion on this, but I'm also curious on the naming (opposed to raw_verify or something suggested on the original ticket.

@@ -2145,6 +2145,35 @@ def get_txid(self):
"""
return self.transaction.get_txid()

def verify_signature(self):
"""
Verify the signature on the transaction is valid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Verify the signature on the transaction is valid
Verify that the signature on the transaction is valid.

prefixed_message, base64.b64decode(self.signature)
)
return True
except BadSignatureError:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think nacl's VerifyKey API can now return a TypeError or ValueError. The multisig/logicsig verify in the Python SDK doesn't catch these errors yet either so I think it would be nice to update them :D

@barnjamin barnjamin closed this Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants