From 97a841d1bbbc105124e9c0f2b8d8629573743b36 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sun, 20 Nov 2022 18:32:55 -0700 Subject: Move signed request onto Identity as a shortcut --- users/models/follow.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'users/models/follow.py') diff --git a/users/models/follow.py b/users/models/follow.py index e741c56..5f0d6ab 100644 --- a/users/models/follow.py +++ b/users/models/follow.py @@ -3,7 +3,6 @@ from typing import Optional from django.db import models, transaction from core.ld import canonicalise -from core.signatures import HttpSignature from stator.models import State, StateField, StateGraph, StatorModel from users.models.identity import Identity @@ -38,11 +37,10 @@ class FollowStates(StateGraph): if not follow.source.local: return cls.remote_requested # Sign it and send it - await HttpSignature.signed_request( + await follow.source.signed_request( + method="post", uri=follow.target.inbox_uri, body=canonicalise(follow.to_ap()), - private_key=follow.source.private_key, - key_id=follow.source.public_key_id, ) return cls.local_requested @@ -58,11 +56,10 @@ class FollowStates(StateGraph): source server. """ follow = await instance.afetch_full() - await HttpSignature.signed_request( + await follow.target.signed_request( + method="post", uri=follow.source.inbox_uri, body=canonicalise(follow.to_accept_ap()), - private_key=follow.target.private_key, - key_id=follow.target.public_key_id, ) return cls.accepted @@ -72,11 +69,10 @@ class FollowStates(StateGraph): Delivers the Undo object to the target server """ follow = await instance.afetch_full() - await HttpSignature.signed_request( + await follow.source.signed_request( + method="post", uri=follow.target.inbox_uri, body=canonicalise(follow.to_undo_ap()), - private_key=follow.source.private_key, - key_id=follow.source.public_key_id, ) return cls.undone_remotely -- cgit v1.2.3