Skip to content

Commit

Permalink
fix: only show vss info in alby account settings if vss is supported (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz authored Dec 17, 2024
1 parent 0325ad5 commit e98f207
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
2 changes: 2 additions & 0 deletions alby/alby_oauth_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ func (svc *albyOAuthService) ConsumeEvent(ctx context.Context, event *events.Eve
type channelsBackup struct {
Description string `json:"description"`
Data string `json:"data"`
NodePubkey string `json:"node_pubkey"`
}

func (svc *albyOAuthService) createEncryptedChannelBackup(event *events.StaticChannelsBackupEvent) (*channelsBackup, error) {
Expand All @@ -818,6 +819,7 @@ func (svc *albyOAuthService) createEncryptedChannelBackup(event *events.StaticCh
backup := &channelsBackup{
Description: "channels_v2",
Data: encrypted,
NodePubkey: event.NodeID,
}
return backup, nil
}
Expand Down
5 changes: 5 additions & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ func (api *api) GetInfo(ctx context.Context) (*InfoResponse, error) {
info.Version = version.Tag
info.EnableAdvancedSetup = api.cfg.GetEnv().EnableAdvancedSetup
info.LdkVssEnabled = ldkVssEnabled == "true"
info.VssSupported = backendType == config.LDKBackendType && api.cfg.GetEnv().LDKVssUrl != ""
albyUserIdentifier, err := api.albyOAuthSvc.GetUserIdentifier()
if err != nil {
logger.Logger.WithError(err).Error("Failed to get alby user identifier")
Expand Down Expand Up @@ -921,6 +922,10 @@ func (api *api) MigrateNodeStorage(ctx context.Context, to string) error {
return errors.New("VSS already enabled")
}

if api.cfg.GetEnv().LDKVssUrl == "" {
return errors.New("No VSS URL set")
}

api.cfg.SetUpdate("LdkVssEnabled", "true", "")
api.cfg.SetUpdate("LdkMigrateStorage", "VSS", "")
return api.Stop()
Expand Down
1 change: 1 addition & 0 deletions api/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ type InfoResponse struct {
Network string `json:"network"`
EnableAdvancedSetup bool `json:"enableAdvancedSetup"`
LdkVssEnabled bool `json:"ldkVssEnabled"`
VssSupported bool `json:"vssSupported"`
StartupError string `json:"startupError"`
StartupErrorTime time.Time `json:"startupErrorTime"`
}
Expand Down
24 changes: 12 additions & 12 deletions frontend/src/screens/settings/AlbyAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,19 @@ export function AlbyAccount() {
</CardHeader>
</Card>
</UnlinkAlbyAccount>
<div /* spacing */ />
<SettingsHeader title="VSS" description="Versioned Storage Service" />
<p>
Versioned Storage Service (VSS) provides a secure, encrypted server-side
storage of essential lightning and onchain data.
</p>
<p>
This service is enabled by your Alby account and provides additional
backup security which allows you to recover your lightning data with
your recovery phrase alone, without having to close your channels.
</p>
{info && (
{info?.vssSupported && (
<>
<div /* spacing */ />
<SettingsHeader title="VSS" description="Versioned Storage Service" />
<p>
Versioned Storage Service (VSS) provides a secure, encrypted
server-side storage of essential lightning and onchain data.
</p>
<p>
This service is enabled by your Alby account and provides additional
backup security which allows you to recover your lightning data with
your recovery phrase alone, without having to close your channels.
</p>
{info.ldkVssEnabled && (
<p>
✅ VSS <b>enabled</b>.{" "}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export interface InfoResponse {
oauthRedirect: boolean;
albyAccountConnected: boolean;
ldkVssEnabled: boolean;
vssSupported: boolean;
running: boolean;
albyAuthUrl: string;
nextBackupReminder: string;
Expand Down

0 comments on commit e98f207

Please sign in to comment.