Commit graph

7 commits

Author SHA1 Message Date
Niko Marmeladkov
50344a350a handleAuthCert: look up identity by cert CommonName, not pubkey
Use cert's Subject.CommonName (the phone number) to find identity instead of extracting pubkey and iterating DB. Each cert is bound to a number; the cert tells us which number directly. Also verify cert pubkey matches stored identity pubkey.
2026-07-01 15:41:54 +03:00
Niko Marmeladkov
48143cdbf5 Allocate: deduplicate by pubkey, GetByPubKey: return latest
Allocate now checks if pubkey already has an identity and returns it. Prevents duplicate identities for same pubkey (was causing random number assignment on cert auth). GetByPubKey returns identity with highest CreatedAt for deterministic behavior.
2026-07-01 15:41:00 +03:00
Niko Marmeladkov
22e33f0e5f NormalizeNumber: accept numbers without + prefix
Strips all non-digit chars, removes leading 0, formats as +0 XXX YYY ZZZZ.
2026-06-30 15:17:19 +03:00
Niko Marmeladkov
69990d7661 Fix target offline: normalize number in HandleDial
Clients may send dial target without spaces (+07491552819 vs +0 749 155 2819). Normalize both formats in HandleDial and extend NormalizeNumber.
2026-06-30 15:08:41 +03:00
Niko Marmeladkov
73f09c29ab Add cert-based re-authentication (OpAuthCert)
New flow: connect -> OpGetChallenge -> OpAuthCert (signature + certDER) -> server verifies cert chain + Ed25519 signature over challenge data -> reuses existing identity. No re-registration on reconnect.
2026-06-30 14:56:29 +03:00
Niko Marmeladkov
53e877393d
Fix panic in marshalIdentity: dynamic number buffer instead of hardcoded 8
Number format is +0XXXYYYZZZ (11 chars), plus 2-byte length prefix = 13 bytes.
Buffer was hardcoded to 8 bytes, causing slice bounds panic at runtime.
2026-06-30 13:51:38 +03:00
Niko Marmeladkov
4f88a7eab1
Initial commit: QuiC Call server 2026-06-30 12:52:09 +03:00