diff --git a/Code/Lib/AbConfig.php b/Code/Lib/AbConfig.php index 3a3f05ae7..e09425f74 100644 --- a/Code/Lib/AbConfig.php +++ b/Code/Lib/AbConfig.php @@ -7,15 +7,12 @@ class AbConfig public static function Load($chan, $xhash, $family = '') { - if ($family) { - $where = sprintf(" and cat = '%s' ", dbesc($family)); - } - $r = q( + $where = ($family) ? sprintf(" and cat = '%s' ", dbesc($family)) : ''; + return q( "select * from abconfig where chan = %d and xchan = '%s' $where", intval($chan), dbesc($xhash) ); - return $r; } @@ -70,15 +67,12 @@ class AbConfig public static function Delete($chan, $xhash, $family, $key) { - - $r = q( + return q( "delete from abconfig where chan = %d and xchan = '%s' and cat = '%s' and k = '%s' ", intval($chan), dbesc($xhash), dbesc($family), dbesc($key) ); - - return $r; } } diff --git a/Code/Lib/LDSignatures.php b/Code/Lib/LDSignatures.php index 99a8dd372..253284c35 100644 --- a/Code/Lib/LDSignatures.php +++ b/Code/Lib/LDSignatures.php @@ -24,13 +24,6 @@ class LDSignatures return $x; } - public static function dopplesign(&$data, $channel) - { - // remove for the time being - performance issues - // $data['magicEnv'] = self::salmon_sign($data,$channel); - return self::sign($data, $channel); - } - public static function sign($data, $channel) { @@ -95,7 +88,6 @@ class LDSignatures } jsonld_set_document_loader('jsonld_document_loader'); - try { $d = jsonld_normalize($data, ['algorithm' => 'URDNA2015', 'format' => 'application/nquads']); } catch (Exception $e) { @@ -103,37 +95,6 @@ class LDSignatures // logger('normalise error:' . print_r($e,true)); logger('normalise error: ' . print_r($data, true)); } - return $d; } - - public static function salmon_sign($data, $channel) - { - - $arr = $data; - $data = json_encode($data, JSON_UNESCAPED_SLASHES); - $data = base64url_encode($data, false); // do not strip padding - $data_type = 'application/activity+json'; - $encoding = 'base64url'; - $algorithm = 'RSA-SHA256'; - $keyhash = base64url_encode(Channel::url($channel)); - - $data = str_replace(array(" ", "\t", "\r", "\n"), array("", "", "", ""), $data); - - // precomputed base64url encoding of data_type, encoding, algorithm concatenated with periods - - $precomputed = '.' . base64url_encode($data_type, false) . '.YmFzZTY0dXJs.UlNBLVNIQTI1Ng=='; - - $signature = base64url_encode(Crypto::sign($data . $precomputed, $channel['channel_prvkey'])); - - return ([ - 'id' => $arr['id'], - 'meData' => $data, - 'meDataType' => $data_type, - 'meEncoding' => $encoding, - 'meAlgorithm' => $algorithm, - 'meCreator' => Channel::url($channel), - 'meSignatureValue' => $signature - ]); - } }