Store remote magicsig public keys locally

This commit is contained in:
Mikael Nordfeldth 2015-01-24 13:06:09 +01:00
parent 2d0155a50f
commit aeaee388bf

View File

@ -76,6 +76,10 @@ class MagicEnvelope
$magicsig = new Magicsig(); $magicsig = new Magicsig();
$magicsig->user_id = $profile->id; $magicsig->user_id = $profile->id;
$magicsig->importKeys($keypair); $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. } 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)); throw new ServerException(sprintf('No public key found for profile (id==%d)', $profile->id));
} }