Skip to content

fix(base): Key.Expires() returns 1970-01-01 for keys with no expiration #244

Closed

Description

@ffumero2003

Problem

b2_create_key and b2_list_keys return expirationTimestamp: null for an application key with no expiration (b2_list_keys). Blazer decodes that as 0, and millitime (base/base.go:367) converts it to time.Unix(0, 0). Both paths use it: base/base.go:2089 (create) and base/base.go:2126 (list).

So Key.Expires() returns 1970-01-01T00:00:00Z with IsZero() == false. A caller can't tell "never expires" from "expired in 1970". Code that checks k.Expires().IsZero() for "no expiration" treats every such key as expired.

Reproduction

A b2_list_keys response with "expirationTimestamp": null for a key, then Client.ListKeys: Expires() on that key returns 1970-01-01, not the zero time.Time.

Expected

A key with no expiration returns the zero time.Time from Key.Expires().

Acceptance criteria

  • A null or missing expirationTimestamp maps to time.Time{} in both the create and the list paths.
  • A wire test with the documented null fixture asserts Expires().IsZero(), and it fails before the fix.
  • The Key.Expires() godoc says what the zero value means.
  • Changelog entry under Fixed.

Out of scope

Other millitime call sites (upload timestamps and so on), unless the same null case applies there; note them if found.

Links

Activity

  1. added this to the 0.10.0 milestone on Oct 30, 2026
  2. self-assigned this
    on Oct 30, 2026
  3. added theissue type on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions