Skip to content

Commit

Permalink
Wallet: Add basic recovery phrase page
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisreimann committed Feb 11, 2025
1 parent 9e6aa4d commit 02e5f96
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
64 changes: 64 additions & 0 deletions BTCPayApp.UI/Pages/Wallet/SeedPage.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
@attribute [Route(Routes.WalletSeed)]
@using BTCPayApp.UI.Features
@using BTCPayApp.Core.Auth
@using BTCPayApp.Core.Data
@using BTCPayApp.Core.Wallet
@using BTCPayApp.UI.Components.Layout
@inherits Fluxor.Blazor.Web.Components.FluxorComponent
@inject OnChainWalletManager OnChainWalletManager
@inject IState<RootState> State

<PageTitle>@GetTitle()</PageTitle>

<SectionContent SectionId="_Layout.Top">
<Titlebar Back>
<h1>@GetTitle()</h1>
</Titlebar>
</SectionContent>

<section class="container">
<AuthorizeView Policy="@AppPolicies.CanModifySettings">
<Authorized>
@if (State.Value.OnchainWalletState == OnChainWalletState.Loaded && Config is not null)
{
<h2>Wallet</h2>
<div class="box">
<ol class="m-0 pt-4 ms-3">
@foreach (var word in Config.Mnemonic.Split(' '))
{
<li class="font-monospace">@word</li>
}
</ol>
</div>
}
else
{
<p>
@(State.Value.OnchainWalletState switch
{
OnChainWalletState.NotConfigured => "Not configured",
OnChainWalletState.WaitingForConnection => "Waiting for connection",
_ => State.Value.OnchainWalletState.ToString()
})
</p>
}
</Authorized>
<NotAuthorized>
<Alert Type="danger">Unauthorized.</Alert>
</NotAuthorized>
</AuthorizeView>
</section>

@code {
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();

Config = await OnChainWalletManager.GetConfig();
}

private WalletConfig? Config { get; set; }

private string GetTitle() => "Secure your recovery phrase";
}

1 change: 1 addition & 0 deletions BTCPayApp.UI/Routes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static class Routes
public const string PosSettings = "/settings/pos/{AppId}";
public const string NotificationSettings = "/settings/notifications";
public const string WalletSettings = "/settings/wallet";
public const string WalletSeed = "/settings/wallet/seed";
public const string WalletFunds = "/settings/wallet/funds";
public const string LightningSettings = "/settings/lightning";
public const string ChannelsPeers = "/settings/lightning/channels";
Expand Down

0 comments on commit 02e5f96

Please sign in to comment.