Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit 5d2c221

Browse files
committed
Use NIP-07 extension
1 parent d54147b commit 5d2c221

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

src/logic/mutinyWalletSetup.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,16 @@ export async function setupMutinyWallet(
262262
}
263263
}
264264

265+
// if we didn't get an nsec from storage, try to use extension
266+
let extension_key;
267+
if (!nsec) {
268+
try {
269+
extension_key = await window.nostr.getPublicKey();
270+
} catch (_) {
271+
console.log("No NIP-07 extension")
272+
}
273+
}
274+
265275
console.log("Initializing Mutiny Manager");
266276
console.log("Using network", network);
267277
console.log("Using proxy", proxy);
@@ -304,7 +314,8 @@ export async function setupMutinyWallet(
304314
safeMode || undefined,
305315
// Skip hodl invoices? (defaults to true, so if shouldZapHodl is true that's when we pass false)
306316
shouldZapHodl ? false : undefined,
307-
nsec
317+
nsec,
318+
extension_key ? extension_key : undefined
308319
);
309320

310321
sessionStorage.setItem("MUTINY_WALLET_INITIALIZED", Date.now().toString());

src/routes/settings/SyncNostrContacts.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,19 +128,6 @@ export function SyncNostrContacts() {
128128
}
129129
}
130130

131-
const [hasNsec] = createResource(async () => {
132-
if (Capacitor.isNativePlatform()) {
133-
try {
134-
await SecureStoragePlugin.get({ key: "nsec" });
135-
return true;
136-
} catch (_e) {
137-
return false;
138-
}
139-
} else {
140-
return false;
141-
}
142-
});
143-
144131
async function resync() {
145132
setError(undefined);
146133
setLoading(true);

0 commit comments

Comments
 (0)