aboutsummaryrefslogtreecommitdiff
path: root/database.go
diff options
context:
space:
mode:
authorFChannel <>2021-07-03 19:18:29 -0700
committerFChannel <>2021-07-03 19:18:29 -0700
commit02d55188670a599048486c36e896416d917e831c (patch)
treedf26a6eb1d977a97eaf66aaf1342400159301068 /database.go
parentcf86acee94652ac7cd8e8f313e6abf6c9901c398 (diff)
fixed error with CreatePublicKeyFromPrivate with empty actor
Diffstat (limited to 'database.go')
-rw-r--r--database.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/database.go b/database.go
index edab4f6..954ec0f 100644
--- a/database.go
+++ b/database.go
@@ -31,7 +31,7 @@ func GetActorFromDB(db *sql.DB, id string) Actor {
}
nActor.PublicKey = GetActorPemFromDB(db, publicKeyPem)
- if nActor.PublicKey.PublicKeyPem == ""{
+ if nActor.Id != "" && nActor.PublicKey.PublicKeyPem == ""{
err = CreatePublicKeyFromPrivate(db, &nActor, publicKeyPem)
CheckError(err, "error creating public key from private")
}
@@ -57,8 +57,7 @@ func GetActorByNameFromDB(db *sql.DB, name string) Actor {
CheckError(err, "error with actor from db scan ")
}
- nActor.PublicKey = GetActorPemFromDB(db, publicKeyPem)
- if nActor.PublicKey.PublicKeyPem == ""{
+ if nActor.Id != "" && nActor.PublicKey.PublicKeyPem == ""{
err = CreatePublicKeyFromPrivate(db, &nActor, publicKeyPem)
CheckError(err, "error creating public key from private")
}