feat: restore Nostr backups through wallet lifecycle

This commit is contained in:
2026-08-22 16:56:37 +02:00
parent 99e6ae1b12
commit 3f6010b312
+2 -5
View File
@@ -7,7 +7,6 @@ import {
createBackupPublisher, createBackupPublisher,
deriveBackupKey, deriveBackupKey,
publishBackup, publishBackup,
restoreFromNostr,
} from '@/lnurlcash/nostrBackup'; } from '@/lnurlcash/nostrBackup';
import type { NostrRestoreResult } from '@/lnurlcash/nostrBackup'; import type { NostrRestoreResult } from '@/lnurlcash/nostrBackup';
import { loadSettings, persistSettings, readEncryptedBearers } from '@/lnurlcash/storage'; import { loadSettings, persistSettings, readEncryptedBearers } from '@/lnurlcash/storage';
@@ -65,7 +64,7 @@ export const useNostrBackupStore = defineStore('nostrBackup', () => {
const currentPayload = (): BackupPartPayload => ({ const currentPayload = (): BackupPartPayload => ({
notes: readEncryptedBearers(), notes: readEncryptedBearers(),
mints: readTrustedMints(), mints: readTrustedMints(wallet.pubkey ?? undefined),
settings: loadSettings(), settings: loadSettings(),
}); });
@@ -148,9 +147,7 @@ export const useNostrBackupStore = defineStore('nostrBackup', () => {
// pulls the newest backup for THIS wallet's key and merges it through the // pulls the newest backup for THIS wallet's key and merges it through the
// same applyBackup path as a file restore, then reloads the live list // same applyBackup path as a file restore, then reloads the live list
const restore = async (): Promise<NostrRestoreResult> => { const restore = async (): Promise<NostrRestoreResult> => {
const result = await restoreFromNostr(wallet.requireLinkingKey(), relays.value); return wallet.restoreCurrentFromNostr(relays.value);
await wallet.reloadBearers();
return result;
}; };
return { return {