Skip to content

Commit

Permalink
making creating identity independent of path
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed May 29, 2024
1 parent dc4f281 commit 6c534fd
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions warp/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

0 comments on commit 6c534fd

Please sign in to comment.