Skip to content

feat(identity): add token lifespan percentage - #8

Merged
zmoog merged 6 commits into
mainfrom
zmoog/feat/refresh-token
Sep 29, 2025
Merged

feat(identity): add token lifespan percentage #8
zmoog merged 6 commits into
mainfrom
zmoog/feat/refresh-token

Conversation

@zmoog

@zmoog zmoog commented Sep 29, 2025

Copy link
Copy Markdown
Owner

Goal

Refresh the token a little earlier to reduce the chances of using an expired token.

@zmoog zmoog self-assigned this Sep 29, 2025
@zmoog zmoog changed the title Refresh token feat(identity) refresh token Sep 29, 2025
@zmoog zmoog changed the title feat(identity) refresh token feat(identity): refresh token Sep 29, 2025
# Conflicts:
#	ws/identity/retriever.go
Instead of individual fields
Reduces chances to use an expired token when close to the expiration
time.
@zmoog
zmoog force-pushed the zmoog/feat/refresh-token branch from 3552ade to fe39171 Compare September 29, 2025 20:37
@zmoog
zmoog requested a review from Copilot September 29, 2025 20:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Implements refresh token functionality for the identity management system, refactoring the token structure and improving expiration handling.

  • Introduces a Config struct to replace individual parameter passing in constructors
  • Updates Token structure to use int type for ExpiresIn field and adds RefreshToken support
  • Adds calculateExpiresAt helper function that implements 90% token lifespan usage to prevent expiration during requests

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ws/identity/config.go New configuration struct for identity manager parameters
ws/identity/identity.go Updated Token struct with int ExpiresIn and simplified IsExpired logic
ws/identity/retriever.go Refactored token retrieval with proper response parsing and shared expiration calculation
ws/identity/manager.go Updated constructors to use Config struct instead of individual parameters
ws/identity/manager_test.go Updated test to use new Config-based constructor
cmd/rooms.go Updated to use Config struct and removed commented code
cmd/login.go Updated to use Config struct and consistent output function
cmd/devices.go Updated to use Config struct

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread ws/identity/manager.go Outdated
Comment thread ws/identity/retriever.go Outdated
@zmoog
zmoog requested a review from Copilot September 29, 2025 20:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread ws/identity/retriever.go
@zmoog zmoog changed the title feat(identity): refresh token feat(identity): add token lifespan percentage Sep 29, 2025
@zmoog
zmoog merged commit 95172a2 into main Sep 29, 2025
6 checks passed
@zmoog
zmoog deleted the zmoog/feat/refresh-token branch September 29, 2025 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants