Files
Zoltan Papp 85f865d179 fix: preserve peer identity on re-login (#163)
* fix(ios): preserve peer identity on re-login, stop creating duplicate peers

Every interactive re-authentication registered a brand-new peer on the
management server (named after the fallback hostname) instead of re-using the
existing one. Root cause was in the netbird-core iOS SDK: NewAuth built a fresh
in-memory config that generated a new WireGuard private key, and performLogin()
wrote that config (with the new key) back to netbird.cfg on login success —
replacing the peer's persisted identity. Regression from the login flow moving
into the main-app process (#138), where OAuth switched from the config-reading
IPC path to NewAuth.

- Bump netbird-core to fix/ios-relogin: NewAuth now loads the existing config
  (preserving the private key) when a config file is present, only generating a
  fresh key for first-time login / after logout when no file exists.
- Update the stale performLogin() comment that claimed NewAuth does not read the
  config file.

* fix(ios): log when re-login falls back to the default cloud server

managementURL(for:) already recovers the server URL from the config file, the
logout-surviving server URL file, and the connection cache in turn, so a nil
result means no URL is persisted anywhere. Passing "" to NewAuth is harmless for
a re-login now that the SDK reads the existing config (its apply() keeps the
config URL unless a non-empty one is provided), but a nil URL on an own-server
profile that lost every URL source would silently log in against the default
cloud. Log that case so it is visible in diagnostics; keep the "" fallback so a
genuine first-time login still works.

* fix(ios): register peer under device name, not hostname, on interactive login

The interactive OAuth login called the SDK's plain login() path, which passes an
empty device name; the management server then registers the peer under the
machine hostname fallback instead of the user's device name (UIDevice.current.name).
Every other iOS registration path (extension Run/LoginForMobile, setup-key login)
already passes Device.getName(), so the same device could appear under two
different names depending on the entry point.

Switch both interactive login call sites to login(withDeviceName:) with
Device.getName():
- NetworkExtensionAdapter.performLogin() (main-app OAuth flow)
- NetBirdAdapter.loginAsync() iOS branch (was tvOS-only; now unified since both
  branches pass the device name)

Uses the existing LoginWithDeviceName SDK binding — no netbird-core change needed.
Affects first-time registration; a re-login reuses the persisted identity.

* Update submodule to the release branch

* Fix submodule version

* Update submodule to the release branch

* Update submodule
2026-07-15 15:41:48 +02:00
..
2026-04-22 10:06:51 +02:00