order not logged in - create keypair

This commit is contained in:
Tiago Vasconcelos 2023-03-10 12:03:24 +00:00
parent d192fd6dfc
commit e9f37f4a6b
2 changed files with 23 additions and 4 deletions

View file

@ -80,13 +80,17 @@
</li>
<li>use a Nostr Signer Extension (NIP07)</li>
<li>
fill out the required fields, with your publickey, download
the order and send as a direct message to the merchant on any
Nostr client
generate a key pair to make the order (you should backup up
your keys)
</li>
<li>
fill out the required fields and with your public key,
download the order and send as a direct message to the
merchant on any Nostr client
</li>
</ol>
</q-card-section>
<q-card-actions v-if="hasNip07" align="right">
<q-card-actions align="right">
<q-btn
v-if="hasNip07"
unelevated
@ -95,6 +99,14 @@
label="Get from Extension"
><q-tooltip>Use a Nostr browser extension</q-tooltip></q-btn
>
<q-btn
v-if="!this.account && !this.customerPubkey && !this.customerPrivkey"
unelevated
@click="generateKeyPair"
color="primary"
label="Generate Keys"
><q-tooltip>Generate a new key pair</q-tooltip></q-btn
>
</q-card-actions>
</q-card>
</q-expansion-item>

View file

@ -163,6 +163,13 @@ async function customerStall(path) {
this.customerUseExtension = true
this.checkoutDialog.data.pubkey = this.customerPubkey
},
async generateKeyPair() {
this.customerPrivkey = NostrTools.generatePrivateKey()
this.customerPubkey = NostrTools.getPublicKey(this.customerPrivkey)
this.customerUseExtension = false
this.checkoutDialog.data.pubkey = this.customerPubkey
this.checkoutDialog.data.privkey = this.customerPrivkey
},
openCheckout() {
// Check if user is logged in
if (this.customerPubkey) {