Skip to content

Add 'expired' method to Signed class #1305

Closed

Description

@sechkova

Description of issue or feature request:
Add a method of Signed metadata class returning information about metadata expiration given a reference time.

Current behavior:
Signed class already contains expires, a metadata expiration datetime object.

Expected behavior:
A method exists that checks the 'expires' attribute against a reference time.
def is_expired(self, reference_time: float) -> bool

Activity

  1. added this to the Client Refactor milestone on Mar 12, 2021
  2. joshuagl commented on Mar 29, 2021

    @joshuagl
    Member

    Is a UNIX timestamp the preferred type for reference_time? Rather than a raw expiration string or a Python datetime object?

  3. lukpueh commented on Mar 29, 2021

    @lukpueh
    Member

    What's the intended use case? Would any of the datatypes be more convenient for the caller, that is which datatype would require the least preliminary conversion?

    I lean towards making reference_time a datetime object, for consistency with the type of the Metadata expires field. And I'd also make reference_time optional and default to datetime.now().

  4. joshuagl commented on Mar 29, 2021

    @joshuagl
    Member

    Fully agreed with both comments. I have a WIP patch that takes a datetime object for reference_time and defaults to datetime.now() when no reference_time is passed.

    I believe the motivating use-case is expiration checks in the experimental client, so I'll wait for @sechkova to comment on whether a datetime object is useful.

  5. sechkova commented on Mar 29, 2021

    @sechkova
    ContributorAuthor

    No strong preferences, the client will use whatever we choose :)
    I agree with using datetime objects plus the datetime module seems to be less platform dependent than time (which can be used to return UNIX time).

    Let's make sure we enforce UTC times everywhere.

  6. added
    good first issue
    on Apr 7, 2021
  7. added
    experimental-client
    on Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementexperimental-clientgood first issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions