LINE Protocol & E2EE
The current structure of @vyline/protocol, which owns communication with LINE.
Device mode
| Value | Role |
|---|---|
IOSIPAD | Default. Intended to coexist as a secondary device with official Desktop/mobile clients. |
ANDROIDSECONDARY | Alternative secondary-device mode. |
DESKTOPWIN | Windows Desktop header/login patches. It can conflict with an official Windows Desktop session. |
DESKTOPMAC | Mac Desktop-equivalent mode. Simultaneous use with the official Mac Desktop client is not assumed. |
Inside Protocol
VylineUpdater
└─ DesktopProfile (UA / X-Line-Application / hosts)
↓
VylineClient
├─ patchDesktopTransport
├─ patchDesktopLogin
├─ ensureValidE2EEIdentity
└─ TalkService / domain facade
@vyline/protocol is not a thin HTTP wrapper. It owns device identity, login RPC, transport headers and paths, Letter Sealing E2EE, TalkService, Desktop-version tracking, and the domain facade exposed to Backend.
Login
QR
loginWithQR → protocol stack → secure QR login. Desktop modes patch systemName/modelName to match the selected device identity.
Email + E2EE
- Fetch the RSA key.
- Run
loginV2/ E2EE confirmation. - Fetch the keychain.
- Persist the local identity key.
- Reconcile it with the latest server-side key state.
Token
After loginWithToken restores an access token, Protocol still validates the transport profile and E2EE identity.
Transport
Protocol builds user-agent, x-line-application, locale, hosts, and RPC paths from observed Desktop data. Profile resolution order is: running Desktop extraction → installed-version/OS synthesis → cache → fallback.
| Purpose | Main path | Role |
|---|---|---|
| Talk RPC | /S4 | TalkService operations such as messages, chats, contacts, and E2EE keys |
| Desktop login | /api/v3p/rs | loginV2, E2EE login confirmation, and related calls |
| RSA key | /api/v3/TalkService.do | RSA material fetched before email login |
| Keychain | /LF1 | E2EE keychain retrieval during login |
Paths are not selected by guessing an endpoint that looks plausible. Protocol patches and the RPC dictionary are matched against Desktop evidence. If a Desktop update may have changed a header or path, start from modules.map.ts and trace the related binary/string evidence.
E2EE
Older history can remain undecryptable if the local identity key that was used at the time is no longer available. Sending also requires the private key corresponding to the server's current keyId; missing state can result in sender-key update errors.
Receiving
- Receive message operations through Talk sync.
- Determine from message metadata whether the payload uses E2EE.
- Resolve the required self, peer, or group keys and decrypt the Letter Sealing payload.
- Normalize the result into a UI-facing message in Backend and persist it to the account-specific SQLite database.
Sending
- Check the destination and current E2EE key state.
- Warm or refresh the group/public key state when necessary.
- Encrypt text or media metadata and send through the Talk/OBS path.
- If LINE requests a sender-key update, refresh key state and retry only through the permitted retry path.
Media content is not carried entirely inside the Talk message; object storage is also involved. The Protocol RPC dictionary includes the corresponding E2EE media upload/download operations, while Backend lineService coordinates message metadata and binary handling.
Talk sync
Backend clientManager continuously fetches operations through base.talk.sync on a logged-in Protocol client. Operations are passed to lineService.processFetchedOperations for decryption, persistence, and insertion into the Frontend event buffer.
TalkService sync (/S4)
↓ operations
clientManager
↓
processFetchedOperations
├─ E2EE decrypt
├─ message/chat normalize
├─ SQLite persist
└─ frontend event buffer
Domain facade
wrapSession(client) wraps a logged-in client and exposes Profile / Contacts / Chat / Talk as feature-level APIs to Backend. This boundary keeps raw Protocol RPC calls from spreading through the rest of Backend.
Modules Map and RPC dictionary
src/modules.map.ts maps features to source files, Desktop binaries, search strings, analysis documents, and recheck priorities. Current feature entries cover QR/email login, transport, E2EE key/send/decrypt, Talk send, profiles, chat administration, sync, stickers, calls, and related areas.
src/dictionary/rpcMap.ts maps each RPC's canonical name, Desktop evidence, path, stack API, domain API, Backend API, category, and notes. For new work, follow the chain below instead of skipping layers.
Desktop evidence / RPC_DICTIONARY
↓
stack API (Thrift / transport)
↓
domain facade
↓
backend service
↓
BFF route
↓
frontend client
When a Desktop update breaks something
- Identify the feature matching the symptom in
modules.map.ts. - Check the current RPC/path/Backend mapping in
rpcMap.ts. - Use the version, unpack, find-native, and delta tools to collect the current Desktop values.
- Separate a transport-only change from a change to an RPC signature or E2EE flow.
- Verify Protocol first, then Backend integration, then the UI.
@evex/linejs names may remain in the dictionary as comparison hints, but Vyline's Protocol implementation has no runtime dependency on it.