Skip to content

fix(cli): read token expiry as epoch seconds in auth status - #257

Merged
nakasyou merged 1 commit into
evex-dev:mainfrom
tokuzou0829:fix/cli-auth-status-expiry
Nov 4, 2026
Merged

nakasyou merged 1 commit into
evex-dev:mainfrom
tokuzou0829:fix/cli-auth-status-expiry

Conversation

@tokuzou0829

Copy link
Copy Markdown
Contributor

Description

line auth status reports expiresAt in January 1970 and expired: true right after a successful QR login, even though the session works.

Cause

tokenExpiry() in packages/cli/src/profile-store.ts treats storage.expire as milliseconds since the epoch. The login code in packages/linejs/base/login/mod.ts stores tokenInfo[3] + tokenInfo[6], which is in epoch seconds, so the value is read ~1000x too small.

Fix

Minimal CLI-side fix: values below 1e12 are treated as epoch seconds and converted to milliseconds before building the date and computing expired. Millisecond values are still accepted, so nothing breaks if the storage format ever changes. The library's storage format is untouched, and the misleading comment is corrected.

Tests

  • Added unit tests in packages/cli/test/profile-store.test.ts covering seconds/milliseconds as numbers and strings (past/now/future with a mocked clock), and missing/invalid values.
  • cd packages/cli && pnpm exec vp test: 53 passed.
  • pnpm --filter @evex-dev/linejs-cli run typecheck and pnpm exec vp check: no errors.
  • Checked against a real logged-in profile: before the fix {"expiresAt":"1970-01-21T…","expired":true}; after the fix the expiry is a date a few days in the future with expired: false.

Checklist

  • Run tests (optional)
  • Add jsdoc (optional)
  • Test in your environment (optional)

@nakasyou
nakasyou merged commit dc479d2 into evex-dev:main Nov 4, 2026
1 check passed
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