- return true;
- }
-
- public function createMagicEnv($text, $actor)
- {
- $magic_env = new MagicEnvelope();
-
- $user = User::staticGet('id', $actor->id);
- if ($user->id) {
- // Use local key
- $magickey = Magicsig::staticGet('user_id', $user->id);
- if (!$magickey) {
- // No keypair yet, let's generate one.
- $magickey = new Magicsig();
- $magickey->generate($user->id);
- }
- } else {
- // @todo i18n FIXME: added i18n and use sprintf when using parameters.
- throw new Exception("Salmon invalid actor for signing.");
- }
-
- try {
- $env = $magic_env->signMessage($text, 'application/atom+xml', $magickey->toString());
- } catch (Exception $e) {
- return $text;
- }
- return $magic_env->toXML($env);
- }
-