feat(mobile): bind device identities and bound voice usage in 0.1.4 dev
This commit is contained in:
1 parent
ac6687181e
commit
5f75dcc99a
24 files changed
+909
-47
No files matched your search
@@ -1,11 +1,14 @@
|
||||
import { normalizeFingerprint } from './peer-identity.mjs'
|
||||
|
||||
export function parseInvite(raw, now = Date.now()) {
|
||||
if (typeof raw !== 'string' || raw.length > 800) throw new Error('Bu bir AITURK eşleştirme QR kodu değil.')
|
||||
let data
|
||||
try { data = JSON.parse(raw) } catch { throw new Error('Bu bir AITURK eşleştirme QR kodu değil.') }
|
||||
if (!data || data.kind !== 'aiturk-mobile-invite' || data.version !== 1 ||
|
||||
if (!data || data.kind !== 'aiturk-mobile-invite' || data.version !== 2 ||
|
||||
!/^[0-9a-f-]{36}$/.test(data.inviteId) || !/^[0-9a-f-]{36}$/.test(data.desktopId) ||
|
||||
!/^[A-Za-z0-9_-]{43}$/.test(data.secret) || !Number.isFinite(Date.parse(data.expiresAt)) ||
|
||||
Date.parse(data.expiresAt) <= now || Date.parse(data.expiresAt) > now + 11 * 60000)
|
||||
throw new Error('QR geçersiz veya süresi dolmuş. Bilgisayarda yeni kod oluşturun.')
|
||||
return { inviteId: data.inviteId, desktopId: data.desktopId, secret: data.secret }
|
||||
return { inviteId: data.inviteId, desktopId: data.desktopId, secret: data.secret,
|
||||
desktopFingerprint: normalizeFingerprint(data.desktopFingerprint) }
|
||||
}
|
||||
Reference in new issue
Block a user