Ejemplo n.º 1
0
 public static Gen <HDKeyPathKVMap> HDKeyPaths(IEnumerable <PubKey> pks, int itemNum) =>
 from MasterKeyFingerPrints in Gen.ListOf(itemNum, PrimitiveGenerator.UInt32())
 from paths in Gen.ListOf(itemNum, CryptoGenerator.KeyPath())
 let fingerPrintAndPath = MasterKeyFingerPrints.ToArray().Zip(paths.ToArray(), (m, p) => Tuple.Create(m, p)).ToList()
                          select Utils.DictionaryFromList <PubKey, Tuple <uint, KeyPath> >(pks.ToList(), fingerPrintAndPath);
Ejemplo n.º 2
0
 public static Gen <Dictionary <KeyId, Tuple <PubKey, ECDSASignature> > > PartialSigs() =>
 from itemNum in Gen.Choose(0, 15)
 from sigs in CryptoGenerator.ECDSAs(itemNum)
 from pks in CryptoGenerator.PublicKeys(itemNum)
 let items = pks.ToList().Zip(sigs.ToList(), (pk, sig) => Tuple.Create(pk, sig)).ToList()
             select Utils.DictionaryFromList <KeyId, Tuple <PubKey, ECDSASignature> >(pks.Select(pk => pk.Hash).ToList(), items);
Ejemplo n.º 3
0
 public static Gen <HDKeyPathKVMap> HDKeyPaths() =>
 from itemNum in Gen.Choose(0, 15)
 from pks in Gen.ListOf(itemNum, CryptoGenerator.PublicKey())
 from map in HDKeyPaths(pks, itemNum)
 select map;
Ejemplo n.º 4
0
 private static Gen <PubKeyProvider> ConstPubKeyProviderGen() =>
 from pk in CryptoGenerator.PublicKey()
 select PubKeyProvider.NewConst(pk);
Ejemplo n.º 5
0
 private static Gen <PubKeyProvider> OriginPubKeyProviderGen(Network?n = null) =>
 from keyOrigin in CryptoGenerator.RootedKeyPath()
 from inner in Gen.OneOf(ConstPubKeyProviderGen(), HDPubKeyProviderGen(n))
 select PubKeyProvider.NewOrigin(keyOrigin, inner);
Ejemplo n.º 6
0
 private static Gen <PubKeyProvider> HDPubKeyProviderGen(Network?n = null) =>
 from extPk in n is null?CryptoGenerator.BitcoinExtPubKey() : CryptoGenerator.ExtPubKey().Select(e => new BitcoinExtPubKey(e, n))
     from kp in CryptoGenerator.KeyPath()
     from t in Arb.Generate <PubKeyProvider.DeriveType>()
     select PubKeyProvider.NewHD(extPk, kp, t);
 public static Gen <OutPoint> OutPoint() => from txid in CryptoGenerator.Hash256()
 from vout in Gen.Choose(0, Int32.MaxValue)
 select new OutPoint(txid, vout);