kdbxtool.models.times

Timestamp handling for KDBX elements.

Classes

Times([creation_time, ...])

Timestamps associated with entries and groups.

class kdbxtool.models.times.Times(creation_time=<factory>, last_modification_time=<factory>, last_access_time=<factory>, expiry_time=None, expires=False, usage_count=0, location_changed=None)[source]

Bases: object

Timestamps associated with entries and groups.

All times are stored as timezone-aware UTC datetimes.

Parameters:
creation_time

When the element was created

Type:

datetime.datetime

last_modification_time

When the element was last modified

Type:

datetime.datetime

last_access_time

When the element was last accessed

Type:

datetime.datetime

expiry_time

When the element expires (if expires is True)

Type:

datetime.datetime | None

expires

Whether the element can expire

Type:

bool

usage_count

Number of times the element has been used

Type:

int

location_changed

When the element was moved to a different group

Type:

datetime.datetime | None

creation_time: datetime
last_modification_time: datetime
last_access_time: datetime
expiry_time: datetime | None = None
expires: bool = False
usage_count: int = 0
location_changed: datetime | None = None
property expired: bool

Check if the element has expired.

Returns:

True if expires is True and expiry_time is in the past

touch(modify=False)[source]

Update access time, and optionally modification time.

Parameters:

modify (bool) – If True, also update modification time

Return type:

None

increment_usage()[source]

Increment usage count and update access time.

Return type:

None

update_location()[source]

Update location_changed timestamp when element is moved.

Return type:

None

classmethod create_new(expires=False, expiry_time=None)[source]

Create timestamps for a new element.

Parameters:
  • expires (bool) – Whether the element can expire

  • expiry_time (datetime | None) – When the element expires

Returns:

New Times instance with current timestamps

Return type:

Times

__init__(creation_time=<factory>, last_modification_time=<factory>, last_access_time=<factory>, expiry_time=None, expires=False, usage_count=0, location_changed=None)
Parameters:
Return type:

None