Return time of last usage for SSH public keys and tokens in API #14422

Closed
opened 2025-11-02 11:12:31 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @tobiasbp on GitHub (Apr 29, 2025).

Feature Description

In the GUI, the user can see the time tokens and SSH public keys were last used. This information is not returned by the /users/{username}/tokens and /user/keys endpoints in the API. Let's add it.

I suggest these fields be added to data returned by the API:

  • PublicKey:

    • last_used_at: string($date-time)
  • AccessToken:

    • created_at: string($date-time) (for parity with public keys)
    • last_used_at: string($date-time)

I can make a PR to add the feature.

Originally created by @tobiasbp on GitHub (Apr 29, 2025). ### Feature Description In the GUI, the user can see the time _tokens_ and _SSH public keys_ were last used. This information is not returned by the _/users/{username}/tokens_ and _/user/keys_ endpoints in the API. Let's add it. I suggest these fields be added to data returned by the API: * PublicKey: * _last_used_at_: `string($date-time)` * AccessToken: * _created_at_: `string($date-time)` (for parity with public keys) * _last_used_at_: `string($date-time)` I can make a _PR_ to add the feature.
GiteaMirror added the type/proposal label 2025-11-02 11:12:31 -06:00
Author
Owner

@tobiasbp commented on GitHub (Apr 29, 2025):

I have a PR in my own fork of the repo here: https://github.com/tobiasbp/gitea-return-last-usage-keys-tokens-api/pull/1

@tobiasbp commented on GitHub (Apr 29, 2025): I have a PR in my own fork of the repo here: https://github.com/tobiasbp/gitea-return-last-usage-keys-tokens-api/pull/1
Author
Owner

@techknowlogick commented on GitHub (Apr 29, 2025):

I have a PR in my own fork of the repo here: tobiasbp#1

amazing, thanks! If you create a PR here, even in draft mode, then you can use our CI.

@techknowlogick commented on GitHub (Apr 29, 2025): > I have a PR in my own fork of the repo here: [tobiasbp#1](https://github.com/tobiasbp/gitea-return-last-usage-keys-tokens-api/pull/1) amazing, thanks! If you create a PR here, even in draft mode, then you can use our CI.
Author
Owner

@tobiasbp commented on GitHub (Apr 30, 2025):

Sounds good. I have created the PR here: https://github.com/go-gitea/gitea/pull/34323
I have a question about the name of the new field in the PR description.

@tobiasbp commented on GitHub (Apr 30, 2025): Sounds good. I have created the PR here: https://github.com/go-gitea/gitea/pull/34323 I have a question about the name of the new field in the PR description.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14422