10
45
Fork
You've already forked doipjs
28

Adding Nostr support #151

Merged
Ryuno-Ki merged 7 commits from quokka/doipjs:add-nostr into dev 2025年06月11日 09:41:27 +02:00
Contributor
Copy link

See #150

See https://codeberg.org/keyoxide/doipjs/issues/150

@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.

@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.

I’ll need to load this properly to read how the new fetcher works. Otherwise looks good to me.
Author
Contributor
Copy link

@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 👍

@chimbosonic wrote in https://codeberg.org/keyoxide/doipjs/pulls/151#issuecomment-4989294: > @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 good to me tho I'm not a fan of try catch syntax. @Ryuno-Ki does it look ok?
Ryuno-Ki requested changes 2025年06月10日 12:32:04 +02:00
Dismissed
Ryuno-Ki left a comment
Copy link

Looks largely okay. I'm missing some comments mainly.

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
Owner
Copy link

Nitpick: I prefer Array<string> over string[] (see the return type in line 42).
This isn't blocking the PR.

Nitpick: I prefer `Array<string>` over `string[]` (see the return type in line 42). This isn't blocking the PR.
quokka marked this conversation as resolved
@ -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
Owner
Copy link

Would be great to have the unit. But we don't mention it elsewhere so this isn't blocking here.

Would be great to have the unit. But we don't mention it elsewhere so this isn't blocking here.
quokka marked this conversation as resolved
@ -0,0 +79,4 @@
const result = { event }
result.npub = nip19.npubEncode(event.pubkey)
return pool.get(relays, { kinds: [0], authors: [event.pubkey] })
Owner
Copy link

The 0 has a special meaning in Nostr land. Can you declare a const and refer to it here?

The `0` has a special meaning in Nostr land. Can you declare a const and refer to it here?
Author
Contributor
Copy link

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.

As in ```js 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.
Owner
Copy link

Exactly that.

Exactly that.
quokka marked this conversation as resolved
@ -0,0 +86,4 @@
}
let profileContent
try {
Owner
Copy link

Hm, nested try/catch constructs. If it fails, the outer catch ought to handle it.

Hm, nested try/catch constructs. If it fails, the outer catch ought to handle it.
quokka marked this conversation as resolved
@ -0,0 +91,4 @@
profile.content = profileContent
} catch (_) { }
// if theres a nip05 field, look it up
Owner
Copy link

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).

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).
quokka marked this conversation as resolved
@ -0,0 +92,4 @@
} catch (_) { }
// if theres a nip05 field, look it up
if (profileContent && profileContent.nip05) {
Owner
Copy link

Can be shortened to if (profileContent?.nip05) { /*...*/ }.

Can be shortened to `if (profileContent?.nip05) { /*...*/ }`.
quokka marked this conversation as resolved
@ -0,0 +33,4 @@
*/
export function processURI (uri) {
const match = uri.match(reURI)
const relays = [
Owner
Copy link

Please add a comment pointing to the source from which you extracted these relays.

Please add a comment pointing to the source from which you extracted these relays.
quokka marked this conversation as resolved
@ -0,0 +65,4 @@
},
proof: {
request: {
uri: `https://njump.me/${match[1]}`,
Owner
Copy link

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?

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?
quokka marked this conversation as resolved
Ryuno-Ki approved these changes 2025年06月10日 18:51:13 +02:00
Dismissed
Ryuno-Ki left a comment
Copy link

You're a rebase / merge away from integration here.

You're a rebase / merge away from integration here.
Ryuno-Ki left a comment
Copy link

Excellent!

Excellent!
Sign in to join this conversation.
Labels
Clear labels
bug
Something is not working

Archived

enhancement
New feature

Archived

Contribution welcome
Get started contributing here
Good first issue
Good if you are new to the project or to open source contributions
Impact
External
Affects the people using the project
Impact
Internal
Affects on the people working on the project
Priority
Critical
Work on right now
Priority
High
Work on at earliest convenience
Priority
Low
Work on in spare time
Priority
Medium
Work on regularly
Review
Duplicate
Already exists
Review
Off Topic
Does not fall within the scope of the repo/project
Status
Backlog
Is not being worked on yet
Status
Blocked
Is waiting on something or someone
Status
Completed
Is done
Status
In Progress
Is being worked on
Status
Investigating
Is waiting on research or questions
Status
Needs Decision
Is waiting on a decision by the devs/contributors
Status
Needs Info
Is waiting on additional information before it can be solved
Status
Needs Triage
Is new issue that needs reviewing
Status
Testing
Is being checked and verified
Status
Waiting For Review
Is waiting on reviewers to approve
Status
Won't Fix
Won't be fixed
Type
Bug
Related to something not working as intended
Type
CI
Related to continuous integration
Type
Documentation
Related to documentation
Type
Enhancement
Related to a new feature or an improved one
Type
New Claim
Related to a new identity claim/proof
Type
Security
Related to security
Type
Tests
Related to code tests
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
keyoxide/doipjs!151
Reference in a new issue
keyoxide/doipjs
No description provided.
Delete branch "quokka/doipjs:add-nostr"

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?