feat: outbox model for the following feed

This commit is contained in:
codytseng 2025-03-27 22:37:06 +08:00
parent df4eb10802
commit d24e208f0b
22 changed files with 642 additions and 517 deletions

View file

@ -0,0 +1,34 @@
import { ISigner } from '@/types'
import { nip19 } from 'nostr-tools'
export class NpubSigner implements ISigner {
private pubkey: string | null = null
login(npub: string) {
const { type, data } = nip19.decode(npub)
if (type !== 'npub') {
throw new Error('invalid nsec')
}
this.pubkey = data
return this.pubkey
}
async getPublicKey() {
if (!this.pubkey) {
throw new Error('Not logged in')
}
return this.pubkey
}
async signEvent(): Promise<any> {
throw new Error('Not logged in')
}
async nip04Encrypt(): Promise<any> {
throw new Error('Not logged in')
}
async nip04Decrypt(): Promise<any> {
throw new Error('Not logged in')
}
}