public void DeriveEntropyXprv_ExceptionTest() { var bip85 = new BIP0085(Xprv); bip85.Dispose(); Assert.Throws <ObjectDisposedException>(() => bip85.DeriveEntropyXprv(1)); }
public void DeriveEntropyTest(string xprv, BIP0032Path path, byte[] expected) { using BIP0085 bip85 = new BIP0085(xprv); byte[] actual = bip85.DeriveEntropy(path); Assert.Equal(expected, actual); }
public void DeriveEntropyHexTest(string xprv, int byteLen, uint index, string expected) { using BIP0085 bip85 = new BIP0085(xprv); string actual = bip85.DeriveEntropyHex(byteLen, index); Assert.Equal(expected, actual); }
public void DeriveEntropyHdSeedWifTest(string xprv, uint index, byte[] expected) { using BIP0085 bip85 = new BIP0085(xprv); byte[] actual = bip85.DeriveEntropyHdSeedWif(index); Assert.Equal(expected, actual); }
public void DeriveEntropyHex_ExceptionTest() { var bip85 = new BIP0085(Xprv); Assert.Throws <ArgumentOutOfRangeException>(() => bip85.DeriveEntropyHex(-1, 0)); Assert.Throws <ArgumentOutOfRangeException>(() => bip85.DeriveEntropyHex(15, 0)); Assert.Throws <ArgumentOutOfRangeException>(() => bip85.DeriveEntropyHex(65, 0)); bip85.Dispose(); Assert.Throws <ObjectDisposedException>(() => bip85.DeriveEntropyHex(16, 0)); }
public void DeriveEntropyBip39Test(string xprv, BIP0039.WordLists lang, int wordLen, uint index, byte[] expectedEnt, string expectedMn) { using BIP0085 bip85 = new BIP0085(xprv); byte[] actualEnt = bip85.DeriveEntropyBip39(lang, wordLen, index); using BIP0039 bip39 = new BIP0039(actualEnt, lang); string actualMn = bip39.ToMnemonic(); Assert.Equal(expectedEnt, actualEnt); Assert.Equal(expectedMn, actualMn); }
public void DeriveEntropy_ExceptionTest() { var bip85 = new BIP0085(Xprv); var badPath = new BIP0032Path(1); var badPath2 = new BIP0032Path("m/1'/0/0'"); Assert.Throws <ArgumentNullException>(() => bip85.DeriveEntropy(null)); Assert.Throws <ArgumentException>(() => bip85.DeriveEntropy(badPath)); Assert.Throws <ArgumentException>(() => bip85.DeriveEntropy(badPath2)); bip85.Dispose(); Assert.Throws <ObjectDisposedException>(() => bip85.DeriveEntropy(new BIP0032Path(uint.MaxValue))); }
public void DeriveEntropyBip39_ExceptionTest() { var bip85 = new BIP0085(Xprv); var wl = (BIP0039.WordLists) 1000; Exception ex = Assert.Throws <ArgumentException>(() => bip85.DeriveEntropyBip39(wl, 12, 0)); Assert.Contains("Word-list is not defined.", ex.Message); ex = Assert.Throws <ArgumentException>(() => bip85.DeriveEntropyBip39(BIP0039.WordLists.English, 0, 0)); Assert.Contains("Invalid seed length", ex.Message); bip85.Dispose(); Assert.Throws <ObjectDisposedException>(() => bip85.DeriveEntropyBip39(BIP0039.WordLists.English, 12, 0)); }