Compare commits

..

1 Commits

Author SHA1 Message Date
fiatjaf
84e4fb1f92 update noble secp256k1 and ensure we always return hex. 2022-02-11 16:20:47 -03:00
4 changed files with 10 additions and 6 deletions

View File

@@ -52,7 +52,7 @@ export function verifySignature(event) {
} }
export async function signEvent(event, key) { export async function signEvent(event, key) {
return Buffer.from( return Buffer.from(secp256k1.schnorr.sign(getEventHash(event), key)).toString(
await secp256k1.schnorr.sign(getEventHash(event), key) 'hex'
).toString('hex') )
} }

View File

@@ -15,7 +15,11 @@ export async function searchDomain(domain, query = '') {
export async function queryName(fullname) { export async function queryName(fullname) {
try { try {
let [name, domain] = fullname.split('@') let [name, domain] = fullname.split('@')
if (!domain) return null
if (!domain) {
domain = name
name = '_'
}
let res = await ( let res = await (
await fetch(`https://${domain}/.well-known/nostr.json?name=${name}`) await fetch(`https://${domain}/.well-known/nostr.json?name=${name}`)

View File

@@ -1,6 +1,6 @@
{ {
"name": "nostr-tools", "name": "nostr-tools",
"version": "0.22.2", "version": "0.22.0",
"description": "Tools for making a Nostr client.", "description": "Tools for making a Nostr client.",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@@ -160,7 +160,7 @@ export function relayConnect(url, onNotice = () => {}, onError = () => {}) {
unsub() unsub()
clearTimeout(willUnsub) clearTimeout(willUnsub)
}, },
filter: {ids: [event.id]} filter: {id: event.id}
}, },
`monitor-${event.id.slice(0, 5)}` `monitor-${event.id.slice(0, 5)}`
) )