Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
payload = Transaction.Payload(
creator_account_id = "test@test"
),
signatures = []
)
signatories.sign(tx)
self.assertEqual(len(tx.signatures),3)
for i in range(0,3):
sig = tx.signatures[i]
self.assertTrue(
crypto.verify(
sig.pubkey,
sig.signature,
crypto.sign_hash(tx.payload)
)
)
self.assertEqual(
sig.signature,
crypto.sign(
keypairs[i],
crypto.sign_hash(tx.payload)
)
)
signatories.clean()
self.assertEqual(signatories.size(),0)
def test_sign_hash(self):
hash = crypto.sign_hash(self.tx.payload)
logger.info(hash)
logger.info(crypto.b64encode(hash))
sign = crypto.sign(self.keypair,hash)
logger.info(sign)
is_verify = crypto.verify(self.keypair.public_key,sign,hash)
logger.info(is_verify)
self.assertTrue(is_verify)
creator_account_id = "test@test",
created_time = tx.debug_proto_transaction().payload.created_time
),
signatures = [
Signature(
pubkey = keypairs[0].public_key,
signature = crypto.sign(
keypairs[0],
crypto.sign_hash(tx.debug_proto_transaction().payload)
)
),
Signature(
pubkey = keypairs[1].public_key,
signature = crypto.sign(
keypairs[1],
crypto.sign_hash(tx.debug_proto_transaction().payload)
)
self.assertEqual(len(tx.signatures),3)
for i in range(0,3):
sig = tx.signatures[i]
self.assertTrue(
crypto.verify(
sig.pubkey,
sig.signature,
crypto.sign_hash(tx.payload)
)
)
self.assertEqual(
sig.signature,
crypto.sign(
keypairs[i],
crypto.sign_hash(tx.payload)
)
)
signatories.clean()
self.assertEqual(signatories.size(),0)
payload = Transaction.Payload(
commands = [
Command(create_account = create_ac)
],
creator_account_id = self.creator,
tx_counter = self.tx_counter,
created_time = crypto.now()+3600*24*1000*10
)
tx = Transaction(
payload = payload,
signatures = [
Signature(
pubkey = self.keypair.public_key,
signature = crypto.sign(self.keypair,crypto.sign_hash(payload))
)
]
)
self.assertFalse(stateless_validator.verify(tx))