feat: validate merchant pubkeys

This commit is contained in:
Vlad Stan 2023-07-06 12:41:40 +03:00
parent 8061894057
commit 99a98f0df9
4 changed files with 41 additions and 16 deletions

View file

@ -14,12 +14,20 @@ async function marketConfig(path) {
}
},
methods: {
addMerchant: async function() {
addMerchant: async function () {
console.log('### market config', this.merchants)
this.$emit('add-merchant', this.inputPubkey)
if (!isValidKey(this.inputPubkey, 'npub')) {
this.$q.notify({
message: 'Invalid Public Key!',
type: 'warning'
})
return
}
const publicKey = isValidKeyHex(this.inputPubkey) ? this.inputPubkey : NostrTools.nip19.decode(this.inputPubkey).data
this.$emit('add-merchant', publicKey)
this.inputPubkey = null
},
removeMerchant: async function(publicKey) {
removeMerchant: async function (publicKey) {
this.$emit('remove-merchant', publicKey)
},
// async addPubkey(pubkey) {