Skip to content

Commit

Permalink
Provide better errors for invalid identities in UpgradeIdentity
Browse files Browse the repository at this point in the history
  • Loading branch information
tux3 authored and jeremad committed Jul 22, 2021
1 parent 951d336 commit 499be5c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion identity/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ func UpgradeIdentity(b64Identity string) (*string, error) {

_, isPrivate := identity.Get("private_encryption_key")
target, found := identity.Get("target")
if found && target == "email" && !isPrivate {
if !found {
return nil, errors.New("invalid provisional identity (missing target field)")
}
if target == "email" && !isPrivate {
identity.Set("target", "hashed_email")
value, valueFound := identity.Get("value")
if !valueFound {
Expand Down

0 comments on commit 499be5c

Please sign in to comment.