Page MenuHomePhabricator

[identity] add ttl to nonces tables
ClosedPublic

Authored by varun on Aug 16 2023, 12:20 AM.
Tags
None
Referenced Files
F3351592: D8830.id29938.diff
Sat, Nov 23, 2:41 AM
Unknown Object (File)
Thu, Nov 21, 7:38 AM
Unknown Object (File)
Thu, Nov 21, 7:38 AM
Unknown Object (File)
Thu, Nov 21, 7:38 AM
Unknown Object (File)
Thu, Nov 21, 7:37 AM
Unknown Object (File)
Oct 22 2024, 6:37 AM
Unknown Object (File)
Oct 22 2024, 6:37 AM
Unknown Object (File)
Oct 22 2024, 6:36 AM
Subscribers

Details

Summary

Added an expiration time as an RFC 3339 date-and-time string and as a UNIX timestamp to DynamoDB. I added the RFC 3339 version to preserve precision, since UNIX timestamps only go to the second. Open to removing it, though.

The UNIX timestamp lets us set a TTL on the DDB table with Terraform (see next diff). DynamoDB will then remove expired nonces, saving us from having to implement a cron job ourselves.

Depends on D8825

Test Plan

verified that the expirationTime and expirationTimeUnix attributes appeared in my local DDB table.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek requested changes to this revision.Aug 16 2023, 5:31 AM

Looks good, I just want to make sure: should the expiration timestamp be in seconds or milliseconds?
It's about nonce_data.expiration_time.timestamp() vs timestamp_millis()

The term "UNIX timestamp" usually is used for both

This revision now requires changes to proceed.Aug 16 2023, 5:31 AM

Never mind, I found it here: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/time-to-live-ttl-before-you-start.html

The TTL attribute’s value must be a timestamp in Unix epoch time format in seconds.

This revision is now accepted and ready to land.Aug 16 2023, 6:08 AM
This revision was automatically updated to reflect the committed changes.