See #150
Adding Nostr support #151
quokka/doipjs:add-nostr into dev @quokka I’m not sure why your change includes changes to the mediawiki provider. If it’s needed can you unpick it and put it in a separate PR please.
I’ll need to load this properly to read how the new fetcher works. Otherwise looks good to me.
91f5b7b068
to da3cd7a861
@chimbosonic wrote in #151 (comment):
@quokka I’m not sure why your change includes changes to the mediawiki provider. If it’s needed can you unpick it and put it in a separate PR please.
Fixed 👍
Looks good to me tho I'm not a fan of try catch syntax. @Ryuno-Ki does it look ok?
Looks largely okay. I'm missing some comments mainly.
@ -0,0 +36,4 @@
* @function
* @param {object} data - Data used in the request
* @param {string} data.eventId - The ID of the event containing the proof
* @param {string[]} data.relays - Relays to fall back on in case NIP-19 does not contain any
Nitpick: I prefer Array<string> over string[] (see the return type in line 42).
This isn't blocking the PR.
@ -0,0 +37,4 @@
* @param {object} data - Data used in the request
* @param {string} data.eventId - The ID of the event containing the proof
* @param {string[]} data.relays - Relays to fall back on in case NIP-19 does not contain any
* @param {number} [data.fetcherTimeout] - Optional timeout for the fetcher
Would be great to have the unit. But we don't mention it elsewhere so this isn't blocking here.
@ -0,0 +79,4 @@
const result = { event }
result.npub = nip19.npubEncode(event.pubkey)
return pool.get(relays, { kinds: [0], authors: [event.pubkey] })
The 0 has a special meaning in Nostr land. Can you declare a const and refer to it here?
As in
const profileKind = 0
// ...
return pool.get(relays, { kinds: [profileKind], authors: [event.pubkey] })
?
Maybe I'm misunderstanding what you mean, but I don't see why it should be a seperate constant. Events of kind 0 just means it's profile metadata, e.g. display name and NIP-05 handle.
Exactly that.
@ -0,0 +86,4 @@
}
let profileContent
try {
Hm, nested try/catch constructs. If it fails, the outer catch ought to handle it.
@ -0,0 +91,4 @@
profile.content = profileContent
} catch (_) { }
// if there’s a nip05 field, look it up
s/there’s/there's/
(you used the „wrong" typographic character here - you used single quotation mark U+2019 whereas apostrophe U+0027 would have been correct).
@ -0,0 +92,4 @@
} catch (_) { }
// if there’s a nip05 field, look it up
if (profileContent && profileContent.nip05) {
Can be shortened to if (profileContent?.nip05) { /*...*/ }.
@ -0,0 +33,4 @@
*/
export function processURI (uri) {
const match = uri.match(reURI)
const relays = [
Please add a comment pointing to the source from which you extracted these relays.
@ -0,0 +65,4 @@
},
proof: {
request: {
uri: `https://njump.me/${match[1]}`,
Might be worth to have a comment here that explains that this is a bridge between Nostr-land and HTTP world. Also: where / how could we find an alternative if this service shuts down?
You're a rebase / merge away from integration here.
Excellent!
Archived
Archived
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?