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

fix(appstore): Use consistent timestamp for issued_at and expired_at #285

Conversation

abby-knitta
Copy link
Contributor

docs: https://developer.apple.com/documentation/appstoreserverapi/generating_json_web_tokens_for_api_requests

In the existing code, time.Now() is called twice separately for issued_at and expired_at. This introduces the possibility of a time gap between these two calls. As a result, the difference between expired_at and issued_at might exceed 60 minutes.

By calling time.Now() only once and storing its value in a variable, we ensure that both issued_at and expired_at refer to the exact same point in time, thus maintaining the expected 60-minute difference between them.

- Store the result of time.Now() in a variable and use it for
calculating both issued_at and expired_at
- This ensures that issued_at and expired_at are calculated based on the
same timestamp
@abby-knitta abby-knitta force-pushed the fix/consistent-timestamp-for-issued-at-and-expired-at branch from d479cbf to 78d0163 Compare June 3, 2024 04:33
@abby-knitta abby-knitta changed the title fix(appsotre): Use consistent timestamp for issued_at and expired_at fix(appstore): Use consistent timestamp for issued_at and expired_at Jun 3, 2024
Copy link
Member

@takecy takecy left a comment

Choose a reason for hiding this comment

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

Thanks for your PR :)
Nice catch 👍
LGTM.

@takecy takecy merged commit 4c74f3f into awa:master Jun 3, 2024
2 checks passed
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