summaryrefslogtreecommitdiffstats
path: root/activities
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-20 18:32:55 -0700
committerAndrew Godwin2022-11-20 18:32:55 -0700
commit97a841d1bbbc105124e9c0f2b8d8629573743b36 (patch)
tree73ebe2b784e6f6a1734c4ab753b78919f9d70ee7 /activities
parent5ddce16213a8e7b4e9d052a14ed8d7e37ac5f068 (diff)
downloadtakahe-97a841d1bbbc105124e9c0f2b8d8629573743b36.tar.gz
takahe-97a841d1bbbc105124e9c0f2b8d8629573743b36.tar.bz2
takahe-97a841d1bbbc105124e9c0f2b8d8629573743b36.zip
Move signed request onto Identity as a shortcut
Diffstat (limited to 'activities')
-rw-r--r--activities/models/fan_out.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/activities/models/fan_out.py b/activities/models/fan_out.py
index 6ebbe0a..285ecc2 100644
--- a/activities/models/fan_out.py
+++ b/activities/models/fan_out.py
@@ -3,7 +3,6 @@ from django.db import models
from activities.models.timeline_event import TimelineEvent
from core.ld import canonicalise
-from core.signatures import HttpSignature
from stator.models import State, StateField, StateGraph, StatorModel
@@ -31,11 +30,10 @@ class FanOutStates(StateGraph):
# Send it to the remote inbox
post = await fan_out.subject_post.afetch_full()
# Sign it and send it
- await HttpSignature.signed_request(
+ await post.author.signed_request(
+ method="post",
uri=fan_out.identity.inbox_uri,
body=canonicalise(post.to_create_ap()),
- private_key=post.author.private_key,
- key_id=post.author.public_key_id,
)
# Handle boosts/likes
elif fan_out.type == FanOut.Types.interaction:
@@ -48,11 +46,10 @@ class FanOutStates(StateGraph):
)
else:
# Send it to the remote inbox
- await HttpSignature.signed_request(
+ await interaction.identity.signed_request(
+ method="post",
uri=fan_out.identity.inbox_uri,
body=canonicalise(interaction.to_ap()),
- private_key=interaction.identity.private_key,
- key_id=interaction.identity.public_key_id,
)
# Handle undoing boosts/likes
elif fan_out.type == FanOut.Types.undo_interaction:
@@ -65,11 +62,10 @@ class FanOutStates(StateGraph):
)
else:
# Send an undo to the remote inbox
- await HttpSignature.signed_request(
+ await interaction.identity.signed_request(
+ method="post",
uri=fan_out.identity.inbox_uri,
body=canonicalise(interaction.to_undo_ap()),
- private_key=interaction.identity.private_key,
- key_id=interaction.identity.public_key_id,
)
else:
raise ValueError(f"Cannot fan out with type {fan_out.type}")