From 24fbdf2b0a820684b69b10893e82cdb1a76ca14d Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Tue, 13 Jun 2023 16:47:56 +0200 Subject: [chore] Refactor AP authentication, other small bits of tidying up (#1874) --- internal/typeutils/astointernal.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'internal/typeutils/astointernal.go') 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() -- cgit v1.2.3