-
Notifications
You must be signed in to change notification settings - Fork 10
feat: NUC authentication #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dd29f47 to
e62bd32
Compare
6d40da9 to
558617b
Compare
558617b to
c918b4b
Compare
c5c0c6a to
f5fe0a6
Compare
664cf00 to
b756f27
Compare
| @@ -0,0 +1,56 @@ | |||
| # Nilai Auth Server | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this server meant to be ran? Is this running somewhere privately (locally?) that nobody else can hit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is never run by Nillion on a production environment. It is just meant to be an example for FEs on how to run an intermediate service that delegates the subscription to users. I will introduce a better clarification to say this is just a demo example.
| Returns: | ||
| The balance of the user in UNIL | ||
| """ | ||
| print("grpc_endpoint", grpc_endpoint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: leftover print
| grpc_endpoint: The endpoint of the grpc server | ||
| """ | ||
|
|
||
| if get_unil_balance(wallet.address(), grpc_endpoint=grpc_endpoint) < 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use nilauth_client.subscription_cost to get the cost and compare more accurately against that (probably add a leeway because of gas).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point!
| @@ -0,0 +1,138 @@ | |||
| from nuc_helpers import ( | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this file should be called tests, and invoked using pytest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, with the following PR, I do this, I integrated this code as part of the e2e tests so that all the tests are executing under this scenario.
| @@ -0,0 +1,56 @@ | |||
| # Nilai Auth Server | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if this should be a dev/testing helper library instead of a service, why is it a service?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is meant to be a dev/testing helper library. It is not a service in itself, but is meant to be a guide for FEs or others to implement a B2B2C scenario where a subscription is delegated.
Co-authored-by: Sergio Medina <lumasepa@gmail.com>
This PR includes all the required changes to make sure that nilAI supports authentication with NUCs: