Skip to content

Add tests for did:nostr to WebID resolution #39

Closed

Description

@melvincarvalho

Summary

Add unit and integration tests for the did:nostr → WebID resolution feature added in v0.0.58.

Test Coverage Needed

Unit Tests (src/auth/did-nostr.js)

  • resolveDidNostrToWebId()

    • Returns null for invalid pubkey
    • Returns null when DID document not found (404)
    • Returns null when no alsoKnownAs in DID doc
    • Returns null when WebID doesn't link back (no bidirectional proof)
    • Returns WebID when bidirectional link exists
    • Caches results for 5 minutes
    • Handles network timeouts gracefully
  • checkSameAsLink()

    • Finds owl:sameAs string value
    • Finds sameAs string value
    • Finds owl:sameAs as object with @id
    • Finds sameAs in array
    • Case-insensitive DID matching

Integration Tests

  • Full flow: Nostr NIP-98 auth → DID resolution → WebID authentication
  • Mock nostr.social DID endpoint
  • Verify fallback to did:nostr when no WebID linked

Files

  • test/did-nostr.test.js (new)
  • Update test/auth.test.js if needed

Activity

  1. added
    nostr
    on May 9, 2026
  2. melvincarvalho commented on May 9, 2026

    @melvincarvalho
    ContributorAuthor

    The existing checkSameAsLink() resolver tests stay relevant — the WebID-side owl:sameAs is still emitted (#386 keeps it as a back-compat shim for the existing src/auth/did-nostr.js path). What's new: pods now also carry verificationMethod triples that need their own coverage as part of #386 Phase 1.

  3. melvincarvalho commented on Jun 10, 2026

    @melvincarvalho
    ContributorAuthor

    Closing as shipped: did:nostr → WebID resolution now has dedicated coverage — test/did-nostr.test.js (resolver unit tests) and test/nostr-cid-vm.test.js (the NIP-98 + CID verificationMethod upgrade path, #399, including subdomain/path/single-user deployment shapes, forwarded-header handling, and oversized-profile rejection). test/well-known-did-nostr.test.js covers the DID-document publication side.

  4. added
    stale-fixed
    on Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    nostrstale-fixed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions