Ejemplo n.º 1
0
 def test_root_priv_from_trezor_vectors(self, trezor_bip39_vectors):
     # With Passphrase
     for v in trezor_bip39_vectors['english']:
         wallet = HDWallet()
         wallet.shards = FakeShards(v[1])
         wallet.unlock(passphrase="TREZOR")
         xprv = wallet.root_priv
         assert xprv == v[3]
Ejemplo n.º 2
0
 def test_root_priv_from_unchained_vectors(self, unchained_vectors):
     # Without Passphrase
     for words in unchained_vectors:
         wallet = HDWallet()
         wallet.shards = FakeShards(words)
         wallet.unlock()
         xprv = wallet.root_priv
         expected_xprv = unchained_vectors[words]['m']['xprv']
         assert xprv == expected_xprv
Ejemplo n.º 3
0
    def test_checksum_failed_raises_error(self):
        wallet = HDWallet()

        # https://github.com/trezor/python-mnemonic/blob/master/test_mnemonic.py
        wallet.shards = FakeShards("bless cloud wheel regular tiny venue" +
                                   "bird web grief security dignity zoo")
        with pytest.raises(hermit.errors.HermitError) as e_info1:
            wallet.unlock()

        # https://github.com/kristovatlas/bip39_gym/blob/master/test_bip39.py
        wallet.shards = FakeShards("town iron abandon")
        with pytest.raises(hermit.errors.HermitError) as e_info2:
            wallet.unlock()

        #https://github.com/tyler-smith/go-bip39/blob/master/bip39_test.go
        wallet.shards = FakeShards("abandon abandon abandon abandon abandon" +
                                   "abandon abandon abandon abandon abandon" +
                                   "abandon yellow")
        with pytest.raises(hermit.errors.HermitError) as e_info3:
            wallet.unlock()

        expected = "Wallet words failed checksum."
        assert str(e_info1.value) == expected
        assert str(e_info2.value) == expected
        assert str(e_info3.value) == expected
Ejemplo n.º 4
0
 def test_locked_wallet_is_not_unlocked(self, opensource_wallet_words):
     wallet = HDWallet()
     wallet.shards = FakeShards(opensource_wallet_words)
     wallet.unlock()
     wallet.lock()
     assert wallet.unlocked() == False