Skip to content

refactor: call credits endpoint for key validation#3

Merged
Turanic merged 3 commits into
mainfrom
ada/refactor/callCreditsEndpointForKeyValidation
Jun 5, 2026
Merged

refactor: call credits endpoint for key validation#3
Turanic merged 3 commits into
mainfrom
ada/refactor/callCreditsEndpointForKeyValidation

Conversation

@Turanic

@Turanic Turanic commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

What

Refactor the auth logic to call /credits endpoint to validate the api key, and print the current balance.

Why

Just fetching the linkup app did not validate the api key properly.

Testing strategy

Added unit-tests to validate the new auth logic and credits endpoint.
I also performed a manual verification running the auth locally.

@Turanic Turanic Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Remark: Those checks are not needed anymore as the api key is now fully validated from the credits endpoint. See the new tests in credits.test.ts and auth-config.integration.test.ts

Comment thread src/config.ts

const CONFIG_DIR_NAME = '.linkup';
const KEY_PREFIX = 'api_key=';
const MIN_API_KEY_LENGTH = 10;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Remark: This length is now only used to print a masked api key. No normalisation is needed anymore, as the credits endpoint perform all the validation.

@Turanic Turanic merged commit fb53d58 into main Jun 5, 2026
2 checks passed
@Shedna

Shedna commented Jun 8, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

2 participants