Skip to content
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

Verify an API key is valid when it is set #56 #186

Open
KPreisner opened this issue Dec 9, 2024 · 0 comments
Open

Verify an API key is valid when it is set #56 #186

KPreisner opened this issue Dec 9, 2024 · 0 comments

Comments

@KPreisner
Copy link
Member

What?

When an API key is set, the SDK instance should hit the /team/me API endpoint to quickly determine_ if the initialized SDK instance will have authentication issues.

Why?

This will catch any authentication issues immediately instead of waiting until a particular method is used, such as circuit-create.

Notably, the circuit-create method, which uploads a local directory to the Sindri API, will compress the directory into a tar.gz archive in memory before it attempts to make the API request. With large circuits that include sizable data, this compression phase can take several minutes. Very often, especially with examples and demos, the circuit-create method is the first call that is made with the SDK. If the API key is invalid, it is possible that the user will wait several minutes for this compression process to complete before the API endpoint returns an error.

Sindri already introduced this pattern in other analogous Sindri SDKs they maintain.

Implementation Notes

This additional API call to /team/me would most likely go in the authorize() method instead of just in the SDK constructor. This way, a user can reuse an existing SDK instance to modify its authorization.

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

No branches or pull requests

1 participant