Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making creating identity independent of path #140

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}