LukeMathWalker / pavex

An easy-to-use Rust framework for building robust and performant APIs
https://pavex.dev
Apache License 2.0
1.67k stars 55 forks source link

chore: Remote validation for activation keys #283

Closed LukeMathWalker closed 2 months ago

LukeMathWalker commented 2 months ago

In preparation for Pavex's open beta, we must move away from the rudimental activation checks implemented in #173. This PR is a first step in that direction. We still use a "fixed" activation key (the same for all beta testers), but we move validation to a remote server, api.pavex.dev. The activation key entered by the user is forwarded to the server to:

The CLI token is cached on disk, allowing Pavex to be used offline for up to 2 days.
The cached token is refreshed in the background if it's older than 10 minutes to maximise the offline usage window. We could be more aggressive with the refreshing logic, but I don't want to overwhelm the server with unnecessary requests.

Misc:

LukeMathWalker commented 2 months ago

/ok-to-test sha=abe44b8