more cleanup
This commit is contained in:
parent
d1256b547f
commit
ab8bb4d79e
|
@ -1305,7 +1305,7 @@ class Ostatus_profile extends Memcached_DataObject
|
|||
case Discovery::UPDATESFROM:
|
||||
$feedUrl = $link['href'];
|
||||
break;
|
||||
case Webfinger::HCARD:
|
||||
case Discovery::HCARD:
|
||||
$hcardUrl = $link['href'];
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -111,6 +111,10 @@ class Discovery
|
|||
}
|
||||
|
||||
public static function getService($links, $service) {
|
||||
if (!is_array($links)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($links as $link) {
|
||||
if ($link['rel'] == $service) {
|
||||
return $link;
|
||||
|
|
|
@ -52,12 +52,17 @@ class MagicEnvelope
|
|||
{
|
||||
$disco = new Discovery();
|
||||
|
||||
$xrd = $disco->lookup($signer_uri);
|
||||
if ($link = Discovery::getService($xrd->links, Magicsig::PUBLICKEYREL)) {
|
||||
list($type, $keypair) = explode(';', $link['href']);
|
||||
return $keypair;
|
||||
try {
|
||||
$xrd = $disco->lookup($signer_uri);
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
if ($xrd->links) {
|
||||
if ($link = Discovery::getService($xrd->links, Magicsig::PUBLICKEYREL)) {
|
||||
list($type, $keypair) = explode(';', $link['href']);
|
||||
return $keypair;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception('Unable to locate signer public key');
|
||||
}
|
||||
|
||||
|
@ -70,7 +75,11 @@ class MagicEnvelope
|
|||
throw new Exception("Unable to determine entry author.");
|
||||
}
|
||||
|
||||
$signature_alg = Magicsig::fromString($this->getKeyPair($signer_uri));
|
||||
$keypair = $this->getKeyPair($signer_uri);
|
||||
if (!$keypair) {
|
||||
throw new Exception("Unable to retrive keypair for ". $signer_uri);
|
||||
}
|
||||
$signature_alg = Magicsig::fromString($keypair);
|
||||
$armored_text = base64_encode($text);
|
||||
|
||||
return array(
|
||||
|
|
Loading…
Reference in New Issue
Block a user