]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/lib/magicenvelope.php
Salmon posts can only be made for local users. More typing!
[quix0rs-gnu-social.git] / plugins / OStatus / lib / magicenvelope.php
index cd5efc0359054d594b2a88d488f5b2ebc3b57684..84ba2ba2965bdd091af635256357cf77cf6f0b78 100644 (file)
@@ -324,25 +324,21 @@ class MagicEnvelope
      * on some systems.
      *
      * @param string $text XML fragment to sign, assumed to be Atom
-     * @param Profile $actor Profile of a local user to use as signer
+     * @param User $user User who cryptographically signs $text
      *
      * @return string XML string representation of magic envelope
      *
      * @throws Exception on bad profile input or key generation problems
      * @fixme if signing fails, this seems to return the original text without warning. Is there a reason for this?
      */
-    public static function signForProfile($text, Profile $actor)
+    public static function signAsUser($text, User $user)
     {
-        // We only generate keys for our local users of course, so let
-        // getUser throw an exception if the profile is not local.
-        $user = $actor->getUser();
-
         // Find already stored key
         $magicsig = Magicsig::getKV('user_id', $user->id);
         if (!$magicsig instanceof Magicsig) {
             // No keypair yet, let's generate one.
             $magicsig = new Magicsig();
-            $magicsig->generate($user->id);
+            $magicsig->generate($user);
         }
 
         $magic_env = self::signMessage($text, 'application/atom+xml', $magicsig);