API сессий: добавить sessionType и clientPlatform

This commit is contained in:
AidarKC
2026-06-13 14:15:42 +04:00
parent 3b8ea70d3c
commit 919387f581
21 changed files with 446 additions and 15 deletions
+9
View File
@@ -53,6 +53,7 @@ const CHANNEL_TYPE_PUBLIC = 1;
const CHANNEL_TYPE_PERSONAL = 100;
const CHANNEL_TYPE_GROUP = 200;
const CHANNEL_TYPE_VERSION_DEFAULT = 1;
const SESSION_TYPE_CLIENT = 1;
const CONNECTION_SUBTYPES = Object.freeze({
// Legacy alias: friend == close_friend. Оба ключа ведут на один и тот же код 10/11.
@@ -110,6 +111,10 @@ function makeClientInfo() {
return ua.slice(0, 50);
}
function makeClientPlatform() {
return 'Web';
}
function hexToBytes(hex) {
const clean = String(hex || '').trim().toLowerCase();
if (!clean || clean.length % 2 !== 0) throw new Error('Некорректный hex');
@@ -794,6 +799,8 @@ export class AuthService {
authNonce,
deviceKey: keyBundle.devicePair.publicKeyB64,
signatureB64,
sessionType: SESSION_TYPE_CLIENT,
clientPlatform: makeClientPlatform(),
clientInfo: makeClientInfo(),
});
if (createResp.status !== 200) throw opError('CreateAuthSession', createResp);
@@ -932,6 +939,8 @@ export class AuthService {
sessionKey: sessionMaterial.sessionKey,
timeMs,
signatureB64,
sessionType: SESSION_TYPE_CLIENT,
clientPlatform: makeClientPlatform(),
clientInfo: makeClientInfo(),
});
if (loginResp.status !== 200) throw opError('SessionLogin', loginResp);