Esempio n. 1
0
        /// <summary>
        /// Adds a private key to be managed by the wallet and sign transactions.
        /// </summary>
        /// <param name="privateKey">The private key to be stored by the wallet.</param>
        /// <returns>The address derived from the <paramref name="privateKey" /></returns>
        public string AddRawKey(string privateKey)
        {
            string address = GetAddress(privateKey);

            PrivateKeys.Add(address.ToLower(), privateKey);
            return(address);
        }
Esempio n. 2
0
        public async Task ImportKeyAsync(PrivateKeyDetails key, bool isPublic = true)
        {
            if (IsLocked)
            {
                throw new LockedException();
            }
            if (isPublic)
            {
                await ImportReadOnlyAddressAsync(key);
            }

            await privateKeyLock.WaitAsync();

            try {
                PrivateKeys.Add(key);
            }
            finally {
                privateKeyLock.Release();
            }
            await SaveAsync();
        }
 public void AddKey(string privateKey)
 {
     PrivateKeys.Add(privateKey);
 }
Esempio n. 4
0
        private static PrivateKeys GetPrivateKeys(privkeys keys)
        {
            var privateKeys = new PrivateKeys();

            foreach (account account in keys.account)
            {
                var privateKey = new PrivateKey(account.private_key.dsa.GetDSAParameters(true));
                privateKey.AccountName = account.name;
                privateKey.Protocol = account.protocol;

                privateKeys.Add(privateKey);
            }

            return privateKeys;
        }
Esempio n. 5
0
 public void AddKey(string key, Guid id)
 {
     PrivateKeys.Add(new KeyValuePair <string, Guid>(key, id));
     Update();
 }