Skip to content

Fix plutus script deserialization #293

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

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove extraneous parameter for verify
  • Loading branch information
theeldermillenial committed Oct 18, 2023
commit 049c6bf3ca21a11e1fe9c67142b8b0079326507c
8 changes: 3 additions & 5 deletions pycardano/cip/cip8.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Optional, Union

from cbor2 import CBORTag, dumps

from cose.algorithms import EdDSA
from cose.headers import KID, Algorithm
from cose.keys import CoseKey
Expand All @@ -14,10 +13,10 @@
from pycardano.address import Address
from pycardano.crypto import BIP32ED25519PublicKey
from pycardano.key import (
PaymentVerificationKey,
SigningKey,
ExtendedSigningKey,
ExtendedVerificationKey,
PaymentVerificationKey,
SigningKey,
StakeExtendedSigningKey,
StakeSigningKey,
StakeVerificationKey,
Expand Down Expand Up @@ -129,7 +128,6 @@ def sign(
def verify(
signed_message: Union[str, dict],
attach_cose_key: Optional[bool] = None,
extended=False,
) -> dict:
"""Verify the signature of a COSESign1 message and decode its contents following CIP-0008.
Supports messages signed by browser wallets or `Message.sign()`.
Expand Down Expand Up @@ -196,7 +194,7 @@ def verify(
# attach the key to the decoded message
decoded_message.key = cose_key

if extended:
if len(verification_key) > 32:
vk = BIP32ED25519PublicKey(
public_key=verification_key[:32], chain_code=verification_key[32:]
)
Expand Down
3 changes: 1 addition & 2 deletions test/pycardano/test_cip8.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
)
from pycardano.network import Network


EXTENDED_SK = ExtendedSigningKey.from_json(
"""{
"type": "PaymentExtendedSigningKeyShelley_ed25519_bip32",
Expand Down Expand Up @@ -170,7 +169,7 @@ def test_extended_sign_and_verify():
network=Network.TESTNET,
)

verification = verify(signed_message, extended=True)
verification = verify(signed_message)
assert verification["verified"]
assert verification["message"] == "Pycardano is cool."
assert verification["signing_address"].payment_part == EXTENDED_VK.hash()
Expand Down