Skip to content

Conversation

@jcabrero
Copy link
Member

@jcabrero jcabrero commented Jun 11, 2025

This PR adds support for public key updates and service subscriptions on nilAI. For that:

  • It modifies all the existing nuc-helpers to receive pubkey as requiered.
  • Modifies the required auth libraries for nilAI that require nucs for that.
  • Applies changes to verify the command is a subcommand of /nil/ai.
  • Adapts tests to work with the new infrastructure and also includes new tests to test the subcommand behaviour.

@jcabrero jcabrero marked this pull request as ready for review June 12, 2025 12:54
@jcabrero jcabrero requested a review from Copilot June 12, 2025 13:08
Copy link
Contributor

Copilot AI left a comment

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 introduces support for public key updates and service subscriptions for nilAI by updating the NUC token creation flow and related helper functions. Key changes include:

  • Refactoring NUC token generation in nuc-helpers to require and propagate public keys and support different blind modules.
  • Adding new tests and fixtures to verify NILDB commands and subcommand behavior.
  • Updating configuration files (Docker, pyproject.toml) to lock dependencies and select specific image tags.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/e2e/test_openai.py Added fixture and test for NILDB client and command handling.
tests/e2e/test_http.py Added fixture and test for NILDB HTTP client with updated headers.
tests/e2e/nuc.py Refactored token creation functions to include public key checks and delegation token logic.
nilai-auth/nuc-helpers/src/nuc_helpers/types.py Added pydantic models for token types.
nilai-auth/nuc-helpers/src/nuc_helpers/main.py Updated subscription payment to use public keys from server_private_key.
nilai-auth/nuc-helpers/src/nuc_helpers/helpers.py Adjusted helper functions to pass additional parameters (chain_id, blind_module) and context to validators.
nilai-auth/nuc-helpers/pyproject.toml Locked nuc dependency version with a git tag.
nilai-auth/nilai-auth-server/src/nilai_auth_server/app.py Updated subscription payment to use public key from server_private_key.
nilai-auth/nilai-auth-client/examples/tutorial.ipynb Updated messaging and key representation to reflect public key usage.
nilai-api/src/nilai_api/auth/nuc.py Added a function to check Nilai subcommand and enforced it in token validation.
nilai-api/pyproject.toml Updated nuc dependency configuration with version locking.
docker/nilauth/config.yaml Modified subscription cost structure to support multiple keys.
docker-compose.dev.yml Updated nilauth Docker image to a specific version tag.
Comments suppressed due to low confidence (1)

nilai-api/src/nilai_api/auth/nuc.py:84

  • The raised AuthenticationError is not imported or defined within this file; please ensure that the appropriate exception is imported or defined to avoid unresolved reference errors.
raise AuthenticationError("NUC token namespace is not a /nil/ai attenuation")

@jcabrero jcabrero requested review from lumasepa and mfontanini June 12, 2025 14:38
get_unil_balance(wallet.address(), grpc_endpoint=grpc_endpoint)
< nilauth_client.subscription_cost()
):
if get_unil_balance(
Copy link
Member

Choose a reason for hiding this comment

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

Should this check be done further down when you realize you need to pay because you're not subscribed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. Made the changes to do that

@jcabrero jcabrero merged commit 4e1119b into main Jun 13, 2025
4 checks passed
@jcabrero jcabrero deleted the feat/update_nucs branch July 1, 2025 07:42
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.

4 participants