mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 22:35:18 +00:00
more cleanup
This commit is contained in:
parent
6f2d46947d
commit
41055b60a7
2 changed files with 3 additions and 48 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue