-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a80aa4b
commit 9ba2cfb
Showing
5 changed files
with
144 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
@using aoWebWallet.Models | ||
@inherits MvvmComponentBase<MainViewModel> | ||
@inject ISnackbar Snackbar | ||
|
||
<MudPaper Class="pa-8"> | ||
<MudStack Spacing="2"> | ||
<MudText Color="Color.Secondary">Wallets are locked. Please unlock the wallets.</MudText> | ||
|
||
<div Class="d-w-100 d-flex mt-2"> | ||
<MudButton OnClick="Submit" Color="Color.Primary" Variant="Variant.Filled"> | ||
Unlock Wallet | ||
</MudButton> | ||
</div> | ||
</MudStack> | ||
</MudPaper> | ||
|
||
|
||
|
||
@code { | ||
|
||
public string? Progress { get; set; } | ||
|
||
|
||
public async Task<bool> Submit() | ||
{ | ||
await BindingContext.TriggerUnlock(); | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@using aoww.Services | ||
@inject ISnackbar Snackbar | ||
@inherits MvvmComponentBase<MainViewModel> | ||
|
||
<MudDialog> | ||
<DialogContent> | ||
Unlock Wallets | ||
<MudFocusTrap DefaultFocus="DefaultFocus.FirstChild"> | ||
<MudTextField @bind-Value="Password" Label="Password" Variant="Variant.Text"></MudTextField> | ||
</MudFocusTrap> | ||
<MudText Color="Color.Secondary">@Progress</MudText> | ||
</DialogContent> | ||
<DialogActions> | ||
<MudButton OnClick="Cancel">Cancel</MudButton> | ||
<MudButton Color="Color.Primary" OnClick="Submit">Unlock</MudButton> | ||
</DialogActions> | ||
</MudDialog> | ||
@code { | ||
[CascadingParameter] MudDialogInstance MudDialog { get; set; } = default!; | ||
|
||
public string? Password { get; set; } | ||
public string? Progress { get; set; } | ||
|
||
public void Submit() | ||
{ | ||
if (string.IsNullOrEmpty(Password)) | ||
return; | ||
|
||
BindingContext.SecretKey = Password; | ||
|
||
try | ||
{ | ||
foreach(var wallet in BindingContext.WalletList.Data ?? new()) | ||
{ | ||
if(wallet.NeedsUnlock) | ||
{ | ||
if (wallet.JwkEncrypted == null) | ||
continue; | ||
|
||
wallet.JwkSecret = EncryptionService.DecryptWallet(Password, wallet.JwkEncrypted); | ||
} | ||
} | ||
} | ||
catch | ||
{ | ||
Progress = "Could not unlock wallets."; | ||
} | ||
} | ||
|
||
//void Submit() => MudDialog.Close(DialogResult.Ok(true)); | ||
void Cancel() => MudDialog.Cancel(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters