Skip to content

Add support for aggregator API keys - #17

Merged
MastaP merged 10 commits into
mainfrom
aggregator-subscription-support
Oct 6, 2025
Merged

MastaP merged 10 commits into
mainfrom
aggregator-subscription-support

Conversation

@ristoalas

Copy link
Copy Markdown
Contributor

This adds support for sending API keys to the subscription proxy of aggregators. It also adds a couple of exceptions for error cases.

@ristoalas
ristoalas requested a review from martti007 September 26, 2025 07:20
@martti007
martti007 requested a review from Copilot September 26, 2025 08:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for sending API keys to the subscription proxy of aggregators, enabling authentication for protected endpoints. It also introduces new exception types for handling authorization and rate limiting errors.

Key changes:

  • Adds API key support to AggregatorClient with optional authentication
  • Introduces UnauthorizedException and RateLimitExceededException for error handling
  • Updates JsonRpcHttpTransport to handle API key headers and HTTP error responses

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
TestApiKeyIntegration.java Comprehensive test suite for API key authentication scenarios
MockAggregatorServer.java Test mock server with API key validation and rate limiting simulation
UnauthorizedException.java New exception for HTTP 401 unauthorized errors
RateLimitExceededException.java New exception for HTTP 429 rate limit errors with retry information
JsonRpcHttpTransport.java Enhanced transport layer with API key support and error handling
AggregatorClient.java Updated client with optional API key constructor and authentication

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/main/java/org/unicitylabs/sdk/jsonrpc/RateLimitExceededException.java Outdated
Comment thread src/test/java/org/unicitylabs/sdk/MockAggregatorServer.java
Comment thread src/main/java/org/unicitylabs/sdk/jsonrpc/JsonRpcHttpTransport.java Outdated
Comment thread src/main/java/org/unicitylabs/sdk/api/AggregatorClient.java
Comment thread src/test/java/org/unicitylabs/sdk/MockAggregatorServer.java
@MastaP MastaP added this to Unicity Oct 6, 2025
@MastaP MastaP moved this to In Dev in Unicity Oct 6, 2025
@MastaP
MastaP merged commit 548700e into main Oct 6, 2025
2 checks passed
@MastaP
MastaP deleted the aggregator-subscription-support branch October 6, 2025 10:33
@github-project-automation github-project-automation Bot moved this from In Dev to Done in Unicity Oct 6, 2025
@MastaP MastaP moved this from Done to Test in Unicity Oct 6, 2025
@b3y0urs3lf

Copy link
Copy Markdown
Contributor

Tested locally using Java SDK commit 548700e (HEAD, tag: 1.3.0) and locally running subscription service commit 125113e360cd0039ef1de3ebb36beba912ddf057 which is pointing to https://goggregator-test.unicity.network.

Now if requests sent directly to subscription service without api key, then response would be 401 Unauthorized.
image
And for successfully submit SDK user should provide api key as AggregatorClient aggregatorClient = new AggregatorClient(aggregatorUrl, apiKey).

Moving task to done.

@b3y0urs3lf b3y0urs3lf moved this from Test to Done in Unicity Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants