How to use the iroha.helper.crypto.create_key_pair function in iroha

To help you get started, we’ve selected a few iroha examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / iroha-python / tests / transaction / test_transaction.py View on Github external
)
        tx.add_command(
            Command.SetAccountQuorum(
                account_id = "test@test",
                quorum = 2
            )
        )


        logger.info("check signatures")
        self.assertEqual(tx.count_signatures(),0)
        tx.sign()
        self.assertEqual(tx.count_signatures(),3)
        self.assertTrue(tx.verify())

        tx.add_key_pair(crypto.create_key_pair())
        tx.sign()
        self.assertEqual(tx.count_signatures(),4)
        self.assertTrue(tx.verify())

        tx.time_stamp()
        tx.add_key_pair(crypto.create_key_pair())
        tx.sign()
        self.assertFalse(tx.verify())

        tx.signatures_clean()
        self.assertEqual(tx.count_signatures(),0)
        self.assertEqual(tx.signatories.size(),0)
        self.assertTrue(tx.verify())

        tx.add_command(
            Command.AddSignatory(
github hyperledger / iroha-python / tests / transaction / test_command.py View on Github external
def setUp(self):
        logger.setDebug()
        logger.debug("CommandTest")
        self.keypair = crypto.create_key_pair()
github hyperledger / iroha-python / tests / helper / test_stateless_validator.py View on Github external
def setUp(self):
        self.creator = "chika@ichigo.mashimaro"
        self.keypair = crypto.create_key_pair()
        self.tx_counter = 0
        logger.setDebug()
github hyperledger / iroha-python / tests / helper / test_cipher.py View on Github external
def test_sha3_sign(self):
        key_pair = crypto.create_key_pair()
        message = crypto.sha3_256(bytes(b'a031b'))
        dummy_message = crypto.sha3_256(bytes(b'a032b'))
        sign = crypto.sign(key_pair,message)
        self.assertTrue(crypto.verify(key_pair.public_key,sign,message))
        self.assertFalse(crypto.verify(key_pair.public_key,sign,dummy_message))
github hyperledger / iroha-python / tests / transaction / test_transaction.py View on Github external
def test_transaction(self):
        logger.debug("test_transaction")
        tx = Transaction()

        keypairs = []
        keypairs.append(crypto.create_key_pair())
        keypairs.append(crypto.create_key_pair())
        keypairs.append(crypto.create_key_pair())

        tx.add_key_pairs(keypairs)
        tx.set_creator_account_id("test@test")


        logger.info("add command")
        tx.add_command(
            Command.AddSignatory(
                account_id = "test@test",
                pubkey = keypairs[0].public_key
            )
        )
        tx.add_command(
            Command.SetAccountQuorum(
github hyperledger / iroha-python / tests / primitive / test_signatories.py View on Github external
def test_signatories(self):
        signatories = Signatories()

        keypairs = []
        keypairs.append(crypto.create_key_pair())
        keypairs.append(crypto.create_key_pair())
        keypairs.append(crypto.create_key_pair())

        for key in keypairs:
            signatories.append(key)

        self.assertTrue(signatories.size() == 3)


        tx = Transaction(
            payload = Transaction.Payload(
                creator_account_id = "test@test"
            ),
            signatures = []
        )

        signatories.sign(tx)
github hyperledger / iroha-python / tests / query / test_response.py View on Github external
def setUp(self):
        logger.setInfo()
        logger.info("RequestTest")
        self.keypair = crypto.create_key_pair()
github hyperledger / iroha-python / tests / helper / test_crypt.py View on Github external
def setUp(self):
        self.keypair = crypto.create_key_pair()

        create_ac = Command.CreateAccount(
            account_name = "rihito",
            domain_id = "light.wing",
            main_pubkey = self.keypair.public_key
        )
        self.payload = Transaction.Payload(
            commands = [
                Command(create_account = create_ac)
            ],
            creator_account_id = "rihito@light.wing",
            tx_counter = 0,
            created_time = crypto.now()
        )

        self.tx = Transaction(
github hyperledger / iroha-python / tests / test_creator.py View on Github external
def test_create_tx(self):
        logger.info("test_create_tx")
        creator = Creator()

        keypairs = []
        keypairs.append(crypto.create_key_pair())
        keypairs.append(crypto.create_key_pair())


        creator.set_account_id("test@test")
        creator.set_keys(keypairs)

        tx = creator.create_tx()
        tx.sign()
        self.assertEqual(
            tx.debug_proto_transaction(),
            Transaction(
                payload = Transaction.Payload(
                    creator_account_id = "test@test",
                    created_time = tx.debug_proto_transaction().payload.created_time
                ),
                signatures = [
github hyperledger / iroha-python / iroha / __init__.py View on Github external
def keygen():
    """
    Generate keypair ( public key and private key )

    Returns:
        `KeyPair`: base64 encoded ed25519 with sha3_256 keypair [ public_key, private_key ].
    """
    return crypto.create_key_pair()