feat: outbox model for the following feed
This commit is contained in:
parent
df4eb10802
commit
d24e208f0b
22 changed files with 642 additions and 517 deletions
34
src/providers/NostrProvider/npub.signer.ts
Normal file
34
src/providers/NostrProvider/npub.signer.ts
Normal 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')
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue