Beispiel #1
0
        /// <summary>
        /// Constructor to create a new wallet using a private key.
        /// </summary>
        /// <param name="signature">Signature of the wallet.</param>
        /// <param name="privateKey">Private key to divide</param>
        public Wallet(IWalletSignature signature, string privateKey) : this(signature)
        {
            // Validate private key
            if (string.IsNullOrWhiteSpace(privateKey))
            {
                throw new ArgumentException($"Argument '{nameof(privateKey)}' is null or white space.");
            }

            PrivateKey = privateKey;

            // Produce wallet parts
            ProduceWalletParts();
        }
Beispiel #2
0
        private Wallet(IWalletSignature signature)
        {
            // Validate signature
            if (signature == null)
            {
                throw new ArgumentNullException(nameof(signature));
            }

            if (!signature.IsValid(out string message))
            {
                throw new ArgumentException(message);
            }

            // Add data
            Signature = signature;
        }
Beispiel #3
0
 public bool Equals(IWalletSignature other)
 {
     return(Version == other.Version &&
            PartsThreshold == other.PartsThreshold &&
            PartsTotal == other.PartsTotal);
 }