Skip to content

Commit

Permalink
shop copy nsec button
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Sep 3, 2024
1 parent 6edac72 commit d0404dc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
27 changes: 25 additions & 2 deletions src/components/SettingsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,25 @@
<q-item-label caption
>Generate nostr key pair from wallet seed
</q-item-label>
<q-item-label
caption
v-if="signerType === 'SEED' && seedSignerPrivateKeyNsec"
>
<q-badge
class="cursor-pointer q-mt-xs"
@click="copyText(seedSignerPrivateKeyNsec)"
outline
color="grey"
>
<q-icon
name="content_copy"
size="0.8em"
color="grey"
class="q-mr-xs"
></q-icon
>Copy nsec
</q-badge>
</q-item-label>
</q-item-section>
</q-item>
<!-- Nip46Signer -->
Expand Down Expand Up @@ -888,7 +907,6 @@ export default defineComponent({
confirmMnemonic: false,
confirmNuke: false,
nip46Token: "",
nostrPrivateKey: "",
nip07SignerAvailable: false,
};
},
Expand All @@ -907,7 +925,12 @@ export default defineComponent({
"proofs",
]),
...mapState(useNPCStore, ["npcLoading"]),
...mapState(useNostrStore, ["pubkey", "mintRecommendations", "signerType"]),
...mapState(useNostrStore, [
"pubkey",
"mintRecommendations",
"signerType",
"seedSignerPrivateKeyNsec",
]),
...mapState(useWalletStore, ["mnemonic"]),
...mapWritableState(useNPCStore, ["npcAddress"]),
...mapWritableState(useNPCStore, ["npcEnabled", "automaticClaim"]),
Expand Down
2 changes: 2 additions & 0 deletions src/stores/nostr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const useNostrStore = defineStore("nostr", {
nip46signer: {} as NDKNip46Signer,
privateKeySignerPrivateKey: useLocalStorage<string>("cashu.ndk.privateKeySignerPrivateKey", ""),
seedSignerPrivateKey: useLocalStorage<string>("cashu.ndk.seedSignerPrivateKey", ""),
seedSignerPrivateKeyNsec: useLocalStorage<string>("cashu.ndk.seedSignerPrivateKeyNsec", ""),
privateKeySigner: {} as NDKPrivateKeySigner,
signer: {} as NDKSigner,
mintRecommendations: useLocalStorage<MintRecommendation[]>("cashu.ndk.mintRecommendations", []),
Expand Down Expand Up @@ -165,6 +166,7 @@ export const useNostrStore = defineStore("nostr", {
const walletPublicKeyHex = getPublicKey(sk) // `pk` is a hex string
const walletPrivateKeyHex = bytesToHex(sk)
this.seedSignerPrivateKey = walletPrivateKeyHex;
this.seedSignerPrivateKeyNsec = nip19.nsecEncode(sk);
this.privateKeySigner = new NDKPrivateKeySigner(walletPrivateKeyHex)
this.signerType = SignerType.SEED;
this.setSigner(this.privateKeySigner);
Expand Down

0 comments on commit d0404dc

Please sign in to comment.