add nip-26 support

This commit is contained in:
pablof7z
2023-03-15 12:19:00 -03:00
committed by fiatjaf_
parent 185ee772e1
commit e96683d235
4 changed files with 18 additions and 3 deletions
+6 -1
View File
@@ -6,7 +6,7 @@ import {
getPublicKey,
nip19
} from 'nostr-tools'
import {nip04} from 'nostr-tools'
import {nip04, nip26} from 'nostr-tools'
import {Mutex} from 'async-mutex'
import {
@@ -142,6 +142,11 @@ async function handleContentScriptMessage({type, params, host}) {
let {peer, ciphertext} = params
return decrypt(sk, peer, ciphertext)
}
case 'nip26.delegate': {
let { delegateePubkey, conditionsJson } = params
let parameters = { pubkey: delegateePubkey, ...conditionsJson }
return nip26.createDelegation(sk, parameters)
}
}
} catch (error) {
return {error: {message: error.message, stack: error.stack}}