bitwarden / passwordless-python

Bitwarden Passwordless.dev Python SDK.
https://bitwarden.com/
Apache License 2.0
18 stars 3 forks source link

Default expires_at evaluated at compile time #3

Closed oskarnordborg closed 10 months ago

oskarnordborg commented 11 months ago

https://github.com/bitwarden/passwordless-python/blob/d39227ed393c5aceea1481d38d7f595672e5df62/src/passwordless/models.py#L77C68-L77C68

When having this in a dataclass, it seems to be evaluated when the file is compiled. Therefore, when using that class you have to set the expires_at yourself. Not a problem but you think you don't have to if you want 2min. When I deployed my code, the expires_at-time became two minutes after deployment.

expires_at: datetime = datetime.utcnow() + timedelta(minutes=2)

Easy fix: remove default value so you have to set it manually?

WaciX commented 10 months ago

Fixed in version 0.1.1