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