Skip to content

feat(ipns): server-side name search on ListKeys - #103

Merged
pcfreak30 merged 1 commit into
developfrom
feat/ipns-list-options
Aug 15, 2026
Merged

feat(ipns): server-side name search on ListKeys#103
pcfreak30 merged 1 commit into
developfrom
feat/ipns-list-options

Conversation

@pcfreak30

@pcfreak30 pcfreak30 commented Aug 15, 2026

Copy link
Copy Markdown
Member

Adds server-side name search to IPNS key listing, matching the request-editor pattern already used by portal-sdk.

The portal /api/ipns/keys endpoint is a queryutil list endpoint supporting filters[name][contains] for name substring search. The ipfs-sdk ListKeys ignored this, so name search would have to be client-side. Now it runs server-side.

Changes:

  • ListKeyOption with WithFilterName(name): threads filters[name][contains]= onto the list request query via a request editor.
  • ListKeys(ctx, opts ...ListKeyOption) preserves the no-filters call path unchanged for existing callers (no editor when empty).
  • Generated IPNSService mock updated to the variadic signature.

End-to-end test asserts the contains filter is actually sent server-side and that a plain ListKeys sends no filter. Wiring mutation-verified. All ipfs-sdk tests pass.


Summary

This PR adds server-side name search capability to the IPNS key listing functionality (ListKeys).

Changes

API Enhancement

  • ListKeys now accepts optional ListKeyOption parameters, enabling callers to filter IPNS keys by name.
  • A new ListKeyOption type with a WithFilterName(name string) method was introduced, allowing callers to narrow results to keys whose names contain a given substring.

Server-Side Filtering

  • When a name filter is provided, the SDK sends a filters[name][contains]=<name> query parameter to the portal's /api/ipns/keys endpoint.
  • This filtering is performed server-side by the portal, not by fetching all keys and filtering client-side, improving efficiency for large key lists.
  • Without a filter, the call behaves exactly as before, preserving backward compatibility for existing callers and tests.

Supporting Changes

  • The IPNSService interface signature was updated to accept variadic ListKeyOption parameters.
  • Mock implementations were regenerated to match the updated interface.
  • Added an end-to-end test verifying that:
    • A filtered ListKeys call sends the correct filters[name][contains] query parameter.
    • A plain ListKeys call sends no filters.

No portal-side changes are required since the endpoint already supports queryutil list-query filtering.

ListKeys only returned all keys. The portal /api/ipns/keys endpoint is a
queryutil list endpoint, so name substring search can run server-side via
filters[name][contains] with zero portal changes, rather than
fetch-then-filter client-side.

Add ListKeyOption/WithFilterName threading the contains filter onto the
request query as filters[name][contains]=<name>. ListKeys keeps its
no-filters call path unchanged for existing callers; the mock is updated to
the variadic signature.

End-to-end test asserts the contains filter is sent server-side and that a
plain ListKeys sends no filter; mutation-verified the query wiring.
@kody-ai

kody-ai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug
Performance
Security
Business Logic

Access your configuration settings here.

@github-actions

Copy link
Copy Markdown

Code Coverage Report

Total Coverage: 11.2%

Generated from commit: 6ccf2fc
Repository: LumeWeb/ipfs-sdk

@pcfreak30
pcfreak30 merged commit 6598914 into develop Aug 15, 2026
4 checks passed
@pcfreak30
pcfreak30 deleted the feat/ipns-list-options branch August 20, 2026 17:15
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