Skip to content

fix(auth): acknowledge QR login before authentication completes - #21

Draft
Namnarak wants to merge 27 commits into
masterfrom
fix/qr-login-rpc-lifecycle
Draft

Namnarak wants to merge 27 commits into
masterfrom
fix/qr-login-rpc-lifecycle

Conversation

@Namnarak

@Namnarak Namnarak commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Summary

Fix the QR login RPC lifecycle independently from PR #20.

  • Acknowledge auth.qr.start as soon as LINEJS emits the QR URL or PIN challenge, instead of waiting for the full authentication promise.
  • Keep authentication completion asynchronous; auth.ready remains the success signal.
  • Emit auth.error when authentication fails after the startup RPC has already been acknowledged, and display that error in the UI.
  • Invalidate stale login completions on logout while retaining the single-login guard until the underlying LINEJS promise settles, preventing overlapping login attempts against shared storage.

Verification

QR expiry / lock lifecycle audit

Inspected the exact pinned upstream LINEJS v3.5.0 implementation:

  • Login.requestSQR2 and checkQrCodeVerified
  • ForSecure QR polling uses server-provided longPollingMaxCount and longPollingIntervalSec; the implementation retries timed-out polls only up to that count, then throws. It is not an unbounded wait under the normal request-timeout path.
  • The in-flight guard is deliberately retained until that underlying promise settles, so a second login cannot overlap shared storage while the previous LINEJS operation is still alive.

Live QA is still outstanding. CI does not prove authentication with a real LINE account. Test only with a separate test account. This PR remains Draft until that test is completed.

Related: #17. Separate from transport-status PR #20.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Deploying liney with  Cloudflare Pages  Cloudflare Pages

Latest commit: d20b87d
Status: ✅  Deploy successful!
Preview URL: https://1fa5b91e.liney.pages.dev
Branch Preview URL: https://fix-qr-login-rpc-lifecycle.liney.pages.dev

View logs

Copy link
Copy Markdown
Member Author

Additional QR-expiry audit: inspected the pinned upstream LINEJS v3.5.0 implementation at https://github.com/evex-dev/linejs/blob/v3.5.0/packages/linejs/base/login/mod.ts. requestSQR2() uses the server-provided longPollingMaxCount and longPollingIntervalSec; checkQrCodeVerified() retries timed-out polls only up to that count, then throws. Thus the LINEJS login promise is bounded under its normal request-timeout path, and retaining loginInFlight until settlement prevents overlapping shared-storage operations without creating an unbounded wait. This source audit is not a substitute for separate-account Live QA.

Namnarak commented Nov 10, 2026 •

Copy link
Copy Markdown
Member Author

CI update — 2026-11-10

Latest PR head: 5bf0bcaae0d90c6ba38814fe4bb0c773f61cdddd

Artifact: liney-electron-linux-preview
Size: 142,059,935 bytes
ZIP SHA-256: e442ac545fa8b5e5f65f35321fee8b5384a8a013a19f820c83ffc6b49db02459
Expires: 2026-11-17T20:56:39Z

Scope note: CI smoke tests run without a LINE account. They verify app/worker boot and packaging, not actual QR authentication, token restore, or message delivery. Live QA with a separate test LINE account is still required before merge.

This branch has not been deployed

No deployments
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.

1 participant