gizatechxyz / giza-cli

Giza Platform CLI
https://cli.gizatech.xyz/welcome/readme
MIT License
16 stars 8 forks source link

Prove time > token expired time #51

Open alejandromartinezgotor opened 8 months ago

alejandromartinezgotor commented 8 months ago

when I try to generate a proof with the command:

Gonmeso commented 8 months ago

JWT tokens are short-lived (4 hours) so if you start a process that could take more than the time that it has left, at some point it will fail, for long lived tasks is better to use API KEYs, as JWT are short lived for security reasons.

The token validity is checked before every command that hits the API, not at runtime. For example, if you start a proving job for that we start a loop to check the status every 10 seconds, each 10 seconds an outgoing request is sent, but before sending it the token is validated, so if the proving job takes 2 hours, but you only have one hour left in the token at some point in the loop the token will be unsuable, thats why we created API keys, to deal with long tasks.

We could add for anything that could last more than X amount of time, the time left in the JWT to warn the user @alejandromartinezgotor