10
45
Fork
You've already forked doipjs
28

[NEW CLAIM] Nostr #150

Closed
opened 2025年05月27日 18:31:14 +02:00 by quokka · 2 comments
Contributor
Copy link

Service provider

Name: Nostr

Short description: Notes and other stuff transmitted by relays.

Website: https://nostr.com/

API documentation: N/A

Proposed verification mechanism

The user should create a note with the content being the proof, and then copy the event ID in the NIP-19 format, and the claim is formatted as an NIP-21 URI.

A new fetcher is needed, that is basically just a wrapper for the wonderful nostr-tools library.

Fetcher

  1. Decodes the eventId using nip19.decode(). It ensures the type is 'nevent' and extracts:
    • the underlying hex event ID (data.id)
    • any relay URLs listed inside the NIP-19 data (data.relays)
  2. Merges relay lists from the eventId and fallback list, deduplicating them.
  3. Queries relays using a SimplePool:
    • First, it requests the specific event (ids: [eventIdHex])
    • If successful, it encodes the author’s pubkey as an NIP-19 npub1 string
  4. Fetches the author profile (kind 0) to look for attached metadata.
    • If the profile’s content contains a nip05 field, it queries it with nip05.queryProfile() to check if the declared pubkey matches the event’s author.
  5. Assembles a result object with:
    • the raw event
    • the encoded npub of the author
    • the profile (if available)
    • the nip05 identifier (if validated)

Service provider

  1. Regex check:
    The claim is validated using the RegEx /^nostr:(nevent1[ac-hj-np-z02-9]+)$/.
    This ensures:

    • The claim follows the NIP-21 URI format (nostr: prefix).
    • The embedded NIP-19 identifier is of type nevent1 (event reference).
    • Note: Bech32 encoding used in NIP-19 excludes characters 1, b, i, and o.
  2. Fallback Relays:
    A predefined set of relay URLs is provided as a fallback:

    • wss://nostr-pub.wellorder.net
    • wss://saltivka.org
    • wss://relay.damus.io
    • wss://relay.nostr.bg
    • wss://nostr.wine
    • wss://nos.lol
    • wss://nostr.mom
    • wss://atlas.nostr.land
    • wss://relay.snort.social
    • wss://offchain.pub
    • wss://relay.primal.net
    • wss://relay.nostr.band
    • wss://public.relaying.io
  3. Service provider object:
    The object includes:

    • Profile info: Display name initially set as 'Unknown username', and profile URI initially set as null, updated later
    • Proof setup:
      • The proof link points to the event on https://njump.me
      • Retrieval is handled using the newly created Fetcher.NOSTR, passing the NIP-19 event ID and fallback relays
      • Validation checks that the fetched event.content equals the expected proof string
  4. Postprocessing:
    In the postprocess phase:

    • We determine a unique userId:
      • If the profile contains a valid NIP-05 identifier, we use that.
      • Otherwise, we fall back to the NIP-19 encoded public key (npub1...).
    • The profile's display name is updated to this userId.
    • The profile URI is set to the user ID on njump.me.

Remarks

  • NIP-19 event IDs MAY contain additional metadata such as relays
  • List of fallback relays taken directly from relay-config.json on the fiatjaf/njump repo on GitHub.
  • Nostr has no official logos, but the community has made some. I will use the icons from mbarulli/nostr-logo on GitHub for keyoxide-brands

Tasks

### Service provider Name: Nostr Short description: **N**otes and **o**ther **s**tuff **t**ransmitted by **r**elays. Website: https://nostr.com/ API documentation: N/A ### Proposed verification mechanism The user should create a note with the content being the proof, and then copy the event ID in the [NIP-19](https://github.com/nostr-protocol/nips/blob/master/19.md) format, and the claim is formatted as an [NIP-21](https://github.com/nostr-protocol/nips/blob/master/21.md) URI. A new fetcher is needed, that is basically just a wrapper for the wonderful [`nostr-tools`](https://github.com/nbd-wtf/nostr-tools/tree/master) library. #### Fetcher 1. **Decodes the `eventId`** using `nip19.decode()`. It ensures the type is `'nevent'` and extracts: * the underlying hex event ID (`data.id`) * any relay URLs listed inside the NIP-19 data (`data.relays`) 2. **Merges relay lists** from the `eventId` and fallback list, deduplicating them. 3. **Queries relays** using a [`SimplePool`](https://github.com/nbd-wtf/nostr-tools/blob/924075b803dc75c8ebfd5278bce20d8175400fbd/pool.ts#L16): * First, it requests the specific event (`ids: [eventIdHex]`) * If successful, it encodes the author’s pubkey as an NIP-19 `npub1` string 4. **Fetches the author profile** (kind `0`) to look for attached metadata. * If the profile’s `content` contains a `nip05` field, it queries it with `nip05.queryProfile()` to check if the declared pubkey matches the event’s author. 5. **Assembles a result object** with: * the raw event * the encoded `npub` of the author * the profile (if available) * the `nip05` identifier (if validated) #### Service provider 1. **Regex check:** The claim is validated using the RegEx `/^nostr:(nevent1[ac-hj-np-z02-9]+)$/`. This ensures: * The claim follows the NIP-21 URI format (`nostr:` prefix). * The embedded NIP-19 identifier is of type `nevent1` (event reference). * **Note:** [Bech32 encoding ](https://river.com/learn/terms/b/bech32/) used in NIP-19 excludes characters `1`, `b`, `i`, and `o`. 2. **Fallback Relays:** A predefined set of relay URLs is provided as a fallback: * wss://nostr-pub.wellorder.net * wss://saltivka.org * wss://relay.damus.io * wss://relay.nostr.bg * wss://nostr.wine * wss://nos.lol * wss://nostr.mom * wss://atlas.nostr.land * wss://relay.snort.social * wss://offchain.pub * wss://relay.primal.net * wss://relay.nostr.band * wss://public.relaying.io 3. **Service provider object:** The object includes: * **Profile info:** Display name initially set as `'Unknown username'`, and profile URI initially set as `null`, updated later * **Proof setup:** - The proof link points to the event on https://njump.me - Retrieval is handled using the newly created `Fetcher.NOSTR`, passing the NIP-19 event ID and fallback relays - Validation checks that the fetched `event.content` equals the expected proof string 4. **Postprocessing:** In the postprocess phase: * We determine a unique `userId`: * If the profile contains a valid NIP-05 identifier, we use that. * Otherwise, we fall back to the NIP-19 encoded public key (`npub1...`). * The profile's display name is updated to this `userId`. * The profile URI is set to the user ID on [njump.me](https://njump.me). ### Remarks * NIP-19 event IDs [MAY](https://www.rfc-editor.org/rfc/rfc2119.html) contain additional metadata such as relays * List of fallback relays taken directly from [`relay-config.json`](https://github.com/fiatjaf/njump/blob/master/relay-config.json.sample) on the [`fiatjaf/njump`](https://github.com/fiatjaf/njump) repo on GitHub. * Nostr has no official logos, but the community has made some. I will use the icons from [`mbarulli/nostr-logo`](https://github.com/mbarulli/nostr-logo) on GitHub for `keyoxide-brands` ### Tasks <!-- Leave the following unchecked --> - [ ] Verification mechanism tested - [ ] Added to [doip-js](https://codeberg.org/keyoxide/doipjs) - [ ] Added to [doip-rs](https://codeberg.org/keyoxide/doip-rs) - [ ] Added proxy routes (if needed) - [ ] Added to [keyoxide-brands](https://codeberg.org/keyoxide/keyoxide-brands) - [ ] Added to [documentation](https://codeberg.org/keyoxide/keyoxide-docs)
Author
Contributor
Copy link
* `doipjs` PR: https://codeberg.org/keyoxide/doipjs/pulls/151 * `keyoxide-docs` PR: https://codeberg.org/keyoxide/keyoxide-docs/pulls/48 * `keyoxide-brands` PR: https://codeberg.org/keyoxide/keyoxide-brands/pulls/15
Author
Contributor
Copy link

Resolved

Resolved
Sign in to join this conversation.
dev
main
dev
fix-irc-fetcher
new-claim-eveonline-143
prepare-new-release
fix-jsdoc-types
yarn-to-npm
support-openpgp-aspe-claims
support-html-alias
improve-activitypub-support
v1-restructure
into-es-module
support-aspe
fix-js-lsp-issues
improve-linting
add-markers
support-opencollective-claim
support-entity-decoding
use-rome-tools
support-cloudflare-buster
support-fediverse-posts
matrix-room-verification
2.1.0
2.1.0-rc.3
2.1.0-rc.2
2.1.0-rc.1
2.0.1
2.0.0
2.0.0-rc.1
1.2.9
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.1.1
1.1.0
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
v0.19.1-alpha.0
0.19.0
0.18.3
0.18.2
0.18.1
0.18.0
0.17.5
0.17.4
0.17.3
0.17.2
0.17.1
0.17.0
0.16.4
0.16.3
0.16.2
0.16.1
0.16.0
0.15.7
0.15.6
0.15.5
0.15.4
0.15.3
0.15.2
0.15.1
0.15.0
0.14.0
0.13.0
0.12.9
0.12.8
0.12.7
0.12.6
0.12.5
0.12.4
0.12.3
0.12.2
0.12.1
0.12.0
0.11.2
0.11.1
0.11.0
0.10.5
0.10.4
0.10.3
0.10.2
0.10.1
0.10.0
0.9.4
0.9.3
0.9.2
0.9.1
0.9.0
0.8.5
0.8.4
0.8.3
0.8.1
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.0
0.5.1
0.5.0
0.4.2
0.4.1
0.4.0
0.3.0
0.2.0
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
1 participant
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#150
Reference in a new issue
keyoxide/doipjs
No description provided.
Delete branch "%!s()"

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?