public async override Task Execute() { try { using (var identifier = Prompt.GetPasswordAsSecureString("Identifier:", ConsoleColor.Yellow)) using (var password = Prompt.GetPasswordAsSecureString("Password:"******"\nWallet Key set added!\n"); console.ForegroundColor = ConsoleColor.White; return; } console.ForegroundColor = ConsoleColor.Red; console.WriteLine("Something went wrong!"); console.ForegroundColor = ConsoleColor.White; } } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> CreateWalletAddress([FromBody] CredentialsDto credentials) { var pksk = walletService.CreatePkSk(); var added = await walletService.AddKey(credentials.Identifier.ToSecureString(), credentials.Password.ToSecureString(), pksk); if (added) { return(new CreatedResult("httpWallet", new { success = added })); } return(new BadRequestResult()); }
public override async Task Execute() { var walletId = walletService.NewID(16); var passphrase = walletService.Passphrase(); var pkSk = walletService.CreatePkSk(); walletId.MakeReadOnly(); passphrase.MakeReadOnly(); try { await vaultService.CreateUserAsync(walletId, passphrase); // TODO: Add list for multiple store keys. //var dic = new Dictionary<string, object> //{ // { "storeKeys", new List<PkSkDto> { pkSk } } //}; var dic = new Dictionary <string, object> { { "storeKeys", pkSk } }; await vaultService.SaveDataAsync( walletId, passphrase, $"wallets/{walletId.ToUnSecureString()}/wallet", dic); console.WriteLine($"Created Wallet {walletId.ToUnSecureString()} with password: {passphrase.ToUnSecureString()}"); } catch (Exception) { console.WriteLine("Failed to create wallet. Is the vault unsealed?"); throw; } finally { walletId.Dispose(); passphrase.Dispose(); } }