diff --git a/warp/account.go b/warp/account.go index 78132d7b2..9d5e4c446 100644 --- a/warp/account.go +++ b/warp/account.go @@ -88,6 +88,19 @@ func LoadIdentity(path string) (Identity, error) { } func CreateIdentity(l *slog.Logger, path, license string) (Identity, error) { + i, err := CreateIdentityOnly(l, license) + if err != nil { + return Identity{}, err + } + err = saveIdentity(i, path) + if err != nil { + return Identity{}, err + } + + return i, nil +} + +func CreateIdentityOnly(l *slog.Logger, license string) (Identity, error) { priv, err := GeneratePrivateKey() if err != nil { return Identity{}, err @@ -112,10 +125,5 @@ func CreateIdentity(l *slog.Logger, path, license string) (Identity, error) { i.PrivateKey = privateKey - err = saveIdentity(i, path) - if err != nil { - return Identity{}, err - } - return i, nil }