summaryrefslogtreecommitdiff
path: root/internal/typeutils/astointernal.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-06-13 16:47:56 +0200
committerLibravatar GitHub <noreply@github.com>2023-06-13 15:47:56 +0100
commit24fbdf2b0a820684b69b10893e82cdb1a76ca14d (patch)
treed44a092d0bffb8159e4844bfaf4ef84a82f41e2e /internal/typeutils/astointernal.go
parent[docs] Add certificates and firewalling to advanced (#1888) (diff)
downloadgotosocial-24fbdf2b0a820684b69b10893e82cdb1a76ca14d.tar.xz
[chore] Refactor AP authentication, other small bits of tidying up (#1874)
Diffstat (limited to 'internal/typeutils/astointernal.go')
-rw-r--r--internal/typeutils/astointernal.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/typeutils/astointernal.go b/internal/typeutils/astointernal.go
index 7c0b60ad5..aeb6a5917 100644
--- a/internal/typeutils/astointernal.go
+++ b/internal/typeutils/astointernal.go
@@ -196,10 +196,15 @@ func (c *converter) ASRepresentationToAccount(ctx context.Context, accountable a
// TODO: alsoKnownAs
// publicKey
- pkey, pkeyURL, err := ap.ExtractPublicKeyForOwner(accountable, uri)
+ pkey, pkeyURL, pkeyOwnerID, err := ap.ExtractPublicKey(accountable)
if err != nil {
return nil, fmt.Errorf("couldn't get public key for person %s: %s", uri.String(), err)
}
+
+ if pkeyOwnerID.String() != acct.URI {
+ return nil, fmt.Errorf("public key %s was owned by %s and not by %s", pkeyURL, pkeyOwnerID, acct.URI)
+ }
+
acct.PublicKey = pkey
acct.PublicKeyURI = pkeyURL.String()