예제 #1
0
        public async Task <PrivateKeyDetails> GenerateAddressAsync(string label = null, bool isPublic = true)
        {
            var key     = new ECKey();
            var details = new PrivateKeyDetails(key, label);

            await ImportKeyAsync(details);

            return(details);
        }
예제 #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();
        }
예제 #3
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();
		}
예제 #4
0
		public async Task<PrivateKeyDetails> GenerateAddressAsync(string label = null, bool isPublic = true) {
			var key = new ECKey();
			var details = new PrivateKeyDetails(key, label);
			await ImportKeyAsync(details);
			return details;
		}