Skip to content

Commit

Permalink
option to nuke wallet (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Aug 16, 2024
1 parent f098897 commit 858c070
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/components/SettingsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,51 @@
</row>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<row>
<q-btn
v-if="!confirmNuke"
dense
flat
outline
click
@click="confirmNuke = !confirmNuke"
>
Reset wallet data
</q-btn></row
><row v-if="!confirmNuke">
<q-item-label class="q-px-sm" caption
>Reset your wallet data. Warning: This will delete
everything! Make sure you create a backup first.
</q-item-label>
</row>
<row v-if="confirmNuke">
<span
>Are you sure you want to delete your wallet data?</span
>
<q-btn
flat
dense
class="q-ml-sm"
color="warning"
@click="confirmNuke = false"
>Cancel</q-btn
>
<q-btn
flat
dense
class="q-ml-sm"
color="secondary"
@click="
confirmNuke = false;
nukeWallet();
"
>Delete wallet</q-btn
>
</row>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<row>
Expand Down Expand Up @@ -841,6 +886,7 @@ export default defineComponent({
discoveringMints: false,
hideMnemonic: true,
confirmMnemonic: false,
confirmNuke: false,
nip46Token: "",
nostrPrivateKey: "",
nip07SignerAvailable: false,
Expand Down Expand Up @@ -944,6 +990,7 @@ export default defineComponent({
"removeMint",
"activateMintUrl",
"updateMint",
"restoreFromBackup",
]),
...mapActions(useWalletStore, [
"newMnemonic",
Expand Down Expand Up @@ -1072,6 +1119,13 @@ export default defineComponent({
await this.resetNip46Signer();
await this.generateNPCConnection();
},
nukeWallet: async function () {
// create a backup just in case
await this.getLocalstorageToFile();
localStorage.clear();
this.$router.push("/");
this.$emit("close");
},
},
created: async function () {
this.nip07SignerAvailable = await this.checkNip07Signer();
Expand Down

0 comments on commit 858c070

Please sign in to comment.