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

Exposes ISO8601Datetime so that users can import it #62

Merged
merged 2 commits into from
May 8, 2024

Conversation

KasparPeterson
Copy link
Contributor

@KasparPeterson KasparPeterson commented May 7, 2024

It is currently quite confusing to get this issued_at correct. Would propose to make it able to import the ISO8601Datetime that you defined in the siwe.py for the end user.

The example usage would be like this then:

from datetime import datetime

from siwe import SiweMessage
from siwe import ISO8601Datetime

issued_at = ISO8601Datetime.from_datetime(datetime.now())

message = SiweMessage(
    issued_at=issued_at,
)

The current user experience as I understand is like this:

from datetime import datetime

from siwe import SiweMessage
from siwe import ISO8601Datetime

timespec: str = "milliseconds"
dt = datetime.now()
issued_at = (dt.astimezone(tz=timezone.utc)
             .isoformat(timespec=timespec)
             .replace("+00:00", "Z"))
             
message = SiweMessage(
    issued_at=issued_at,
)

@sbihel sbihel merged commit 774b11e into spruceid:main May 8, 2024
8 checks passed
@sbihel
Copy link
Member

sbihel commented May 8, 2024

Thank you very much, published as v4.1.0

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