mirror of
https://github.com/tompro/sattle.git
synced 2026-08-27 07:15:59 +00:00
feat: restore Nostr backups through wallet lifecycle
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user