mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-12 17:59:06 +02:00
ConfigFromJSON still promised a "fully initialized" config after this PR moved key generation out of apply() into EnsureIdentity, but identity stopped being one of the defaults it applies. Its two callers both connect with what they get back: the iOS SDK's Client.SetConfigFromJSON keeps it as the preloaded config Run() uses on tvOS, and Auth.SetConfigFromJSON as the config it authenticates with. No caller feeds it a document without keys today — every stored document comes from Auth.GetConfigJSON, whose config is provisioned by DirectUpdateOrCreateConfig or CreateInMemoryConfig, and the tvOS app only ever edits fields of a document it already has. This is a safety net for the next caller, not a live bug. Provisioning the identity here would be the wrong net. Neither caller can hand a generated key back to the store the document came from — Client exports no config at all — so the peer would connect under an identity nothing persists and register anew on every launch, which is the failure the EnsureIdentity split exists to prevent. A document with no identity means nobody has logged in yet, and saying so is the only useful answer. Both keys are required because both are dead ends when missing: an empty WireGuard key fails the management login on its size, and an empty SSH key fails ssh.GeneratePublicKey in ConnectClient before the engine starts.
15 lines
543 B
Go
15 lines
543 B
Go
package profilemanager
|
|
|
|
import "errors"
|
|
|
|
var (
|
|
ErrProfileNotFound = errors.New("profile not found")
|
|
ErrProfileAlreadyExists = errors.New("profile already exists")
|
|
ErrNoActiveProfile = errors.New("no active profile set")
|
|
|
|
// ErrConfigWithoutIdentity is returned for a serialized config that carries
|
|
// no WireGuard or SSH key. See ConfigFromJSON for why it is refused rather
|
|
// than provisioned.
|
|
ErrConfigWithoutIdentity = errors.New("config carries no peer identity: log in to provision one before loading a stored config")
|
|
)
|