From aeaee388bf0bbfaf8e7a2438b7f1a86c7d5e0ea4 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sat, 24 Jan 2015 13:06:09 +0100 Subject: [PATCH] Store remote magicsig public keys locally --- plugins/OStatus/lib/magicenvelope.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/OStatus/lib/magicenvelope.php b/plugins/OStatus/lib/magicenvelope.php index 4f240cc9b8..9e02f5eab5 100644 --- a/plugins/OStatus/lib/magicenvelope.php +++ b/plugins/OStatus/lib/magicenvelope.php @@ -76,6 +76,10 @@ class MagicEnvelope $magicsig = new Magicsig(); $magicsig->user_id = $profile->id; $magicsig->importKeys($keypair); + // save the public key for this profile in our database. + // TODO: If the profile generates a new key remotely, we must be able to replace + // this (of course after callback-verification). + $magicsig->insert(); } elseif (!$magicsig instanceof Magicsig) { // No discovery request, so we'll give up. throw new ServerException(sprintf('No public key found for profile (id==%d)', $profile->id)); }