Пример #1
0
    def test_derive_key_data(self, sk, pk, hash):
        public_key = Key(pk)
        self.assertFalse(public_key.is_secret)
        self.assertEqual(pk, public_key.public_key())
        self.assertEqual(hash, public_key.public_key_hash())

        secret_key = Key(sk)
        self.assertTrue(secret_key.is_secret)
        self.assertEqual(pk, secret_key.public_key())
        self.assertEqual(sk, secret_key.secret_key())
Пример #2
0
    def test_encrypted_keys(self, sk, passphrase, salt, pk):
        key = Key(sk, passphrase=passphrase)
        self.assertEqual(pk, key.public_key())

        with patch('pytezos.crypto.pysodium.randombytes', return_value=salt):
            self.assertEqual(sk, key.secret_key(passphrase))