First unstable federation release

This commit is contained in:
Diogo Cordeiro
2018-07-31 20:09:47 +01:00
parent 20738f48cd
commit f8048c7565
14 changed files with 348 additions and 1904 deletions

View File

@@ -68,6 +68,23 @@ class Activitypub_rsa extends Managed_DataObject
];
}
public function get_private_key($profile)
{
$this->profile_id = $profile->getID();
$apRSA = self::getKV('profile_id', $this->profile_id);
if (!$apRSA instanceof Activitypub_rsa) {
// No existing key pair for this profile
if ($profile->isLocal()) {
self::generate_keys($this->private_key, $this->public_key);
$this->store_keys();
} else {
throw new Exception('This is a remote Profile, there is no Private Key for this Profile.');
}
}
return $apRSA->private_key;
}
/**
* Guarantees a Public Key for a given profile.
*