feat: 💨

This commit is contained in:
codytseng
2025-02-07 22:56:00 +08:00
parent 5d21172017
commit ec19b9cbfe
6 changed files with 130 additions and 72 deletions

View File

@@ -23,20 +23,18 @@ export class NsecSigner implements ISigner {
}
async getPublicKey() {
if (!this.pubkey) {
throw new Error('Not logged in')
}
return this.pubkey
}
async signEvent(draftEvent: TDraftEvent) {
if (!this.privkey) {
return null
throw new Error('Not logged in')
}
try {
return finalizeEvent(draftEvent, this.privkey)
} catch (error) {
console.error(error)
return null
}
return finalizeEvent(draftEvent, this.privkey)
}
async nip04Encrypt(pubkey: string, plainText: string) {