Skip to content

Fix NIP-05 verification for domain-only identifiers#1049

Closed
markocic wants to merge 1 commit into
mainfrom
fix/nip05-domain-only-identifier
Closed

Fix NIP-05 verification for domain-only identifiers#1049
markocic wants to merge 1 commit into
mainfrom
fix/nip05-domain-only-identifier

Conversation

@markocic
Copy link
Copy Markdown
Collaborator

Summary

NIP-05 verification was failing for users whose nip05 metadata field is a bare domain (e.g. dergigi.com) instead of _@dergigi.com. The previous performVerification split on @, required exactly 2 parts, and returned FAILED otherwise — so any domain-only identifier never received a verification badge.

Per the NIP-05 spec, when the local-part is omitted the client should look up the _ entry in /.well-known/nostr.json. Reproduced live against wss://nos.lol / wss://relay.dergigi.com: dergigi's current kind-0 metadata literally contains "nip05": "dergigi.com".

Change

Routes domain-only (dergigi.com) and @domain (@dergigi.com) inputs to localPart="_" before the existing domain-validation + _ lookup, while keeping truly malformed inputs (foo@bar@baz, empty) on the FAILED path.

  • data/caching/repository/.../nip05/Nip05VerificationServiceImpl.kt — accept domain and @domain as _@domain
  • data/caching/repository/.../nip05/Nip05VerificationServiceTest.kt — 3 new tests covering domain-only, @domain, and invalid-domain shorthand; updated the existing invalid-format test to a still-failing case (foo@bar@baz)

Test plan

  • ./gradlew :data:caching:repository:desktopTest --tests "net.primal.data.repository.nip05.Nip05VerificationServiceTest" — 25 tests / 0 failures, including the three new cases
  • ./gradlew :data:caching:repository:ktlintCheck — BUILD SUCCESSFUL
  • ./gradlew :data:caching:repository:detekt (JDK 21) — BUILD SUCCESSFUL
  • Manual: open a profile whose nip05 is a bare domain (e.g. dergigi.com) and confirm the verified badge appears

Not security-sensitive: NIP-05 is informational (badge only); no auth/crypto/signer/wallet touch points.

Some users (e.g. dergigi.com) publish a NIP-05 metadata field that
contains only a domain, without the "_@" prefix. Per the NIP-05 spec,
when the local-part is omitted the client should look up the "_" entry
in /.well-known/nostr.json.

The previous implementation split on "@" and returned FAILED whenever
the result did not have exactly two parts, so any domain-only or
"@Domain" identifier was incorrectly marked as failed verification and
the verified badge was hidden.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@markocic markocic closed this May 13, 2026
@markocic markocic deleted the fix/nip05-domain-only-identifier branch May 13, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant