@inherits VaultElement @implements IDisposable
@if (Error != "") { @Error }
@code { private readonly VaultBridgeUI ui; public Passphrase(VaultBridgeUI ui) { this.ui = ui; } string PasswordConfirmation { get; set; } = ""; string Password { get; set; } = ""; string Error { get; set; } = ""; private TaskCompletionSource _cts; public Task GetPassword() { ui.ShowFeedback(FeedbackType.Loading, ui.StringLocalizer["Enter the passphrase."]); ui.AddElement(this); _cts = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); return _cts.Task; } public void OnConfirmPasswordClick() { if (Password != PasswordConfirmation) { Error = ui.StringLocalizer["Invalid password confirmation."].Value; ui.StateHasChanged(); return; } ui.Elements.Remove(this); ui.ShowFeedback(FeedbackType.Success, ui.StringLocalizer["Password entered..."]); _cts?.TrySetResult(Password); _cts = null; } public void Dispose() => _cts?.TrySetCanceled(); }