Magicsig::generate is now static

This also fixes a problem with "initial salmon slap", which was a
problem for newly registered accounts which would have their first
salmon slap fail to distribute since there was a problem with Magicsig
keys. Apparently we have to re-read them with importKeys so the
Crypt_RSA objects publicKey and privateKey match later instances of them.

I think it may have been that generate() doesn't specify a signatureMode,
but I leave experimentation of that to the future.
This commit is contained in:
Mikael Nordfeldth
2014-06-02 21:50:40 +02:00
parent 537dff7987
commit 0bc122ff58
3 changed files with 40 additions and 32 deletions

View File

@@ -1344,9 +1344,7 @@ class OStatusPlugin extends Plugin
// Get this profile's keypair
$magicsig = Magicsig::getKV('user_id', $target->id);
if (!$magicsig instanceof Magicsig && $target->isLocal()) {
// No keypair yet, let's generate one. Only for local users.
$magicsig = new Magicsig();
$magicsig->generate($target->getUser());
$magicsig = Magicsig::generate($target->getUser());
}
if ($magicsig instanceof Magicsig) {