Auto-provision merchant from account keypair on first access

The LNbits user account IS the merchant identity. GET /api/v1/merchant
now auto-creates the merchant record using the account's existing Nostr
keypair if one doesn't exist yet, so the extension is immediately
usable without any setup screen.

- Extract _auto_create_merchant() helper used by both GET and POST
- Remove welcome/key-generation screen (replaced with loading spinner)
- Remove dead frontend code (generateKeys, importKeys dialogs)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-04-27 12:14:40 +02:00
commit 5c38947fc6
3 changed files with 62 additions and 136 deletions

View file

@ -13,19 +13,6 @@ window.app = Vue.createApp({
orderPubkey: null,
showKeys: false,
stallCount: 0,
importKeyDialog: {
show: false,
data: {
privateKey: null
}
},
generateKeyDialog: {
show: false,
privateKey: null,
nsec: null,
npub: null,
showNsec: false
},
wsConnection: null,
nostrStatus: {
connected: false,
@ -49,23 +36,6 @@ window.app = Vue.createApp({
}
},
methods: {
generateKeys: async function () {
// No longer need to generate keys here - the backend will use user's existing keypairs
await this.createMerchant()
},
importKeys: async function () {
this.importKeyDialog.show = false
// Import keys functionality removed since we use user's native keypairs
// Show a message that this is no longer needed
this.$q.notify({
type: 'info',
message: 'Merchants now use your account Nostr keys automatically. Key import is no longer needed.',
timeout: 3000
})
},
showImportKeysDialog: async function () {
this.importKeyDialog.show = true
},
toggleShowKeys: function () {
this.showKeys = !this.showKeys
},
@ -379,7 +349,11 @@ window.app = Vue.createApp({
}
},
created: async function () {
await this.getMerchant()
const merchant = await this.getMerchant()
if (!merchant) {
// Auto-create merchant using the account's existing Nostr keypair
await this.createMerchant()
}
await this.checkNostrStatus()
setInterval(async () => {
if (