mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:55:15 +00:00
recover jsalmon unpacking - we'll need that for backward compatibility
This commit is contained in:
parent
868d8a3e7c
commit
e7240a9867
1 changed files with 27 additions and 0 deletions
|
@ -73,8 +73,35 @@ class ActivityStreams
|
|||
$this->valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
// verify and unpack JSalmon signature if present
|
||||
// This will only be the case for Zot6 packets
|
||||
// JSalmon will be deprecated going forward.
|
||||
|
||||
if ($this->valid && is_array($this->data) && array_key_exists('signed', $this->data)) {
|
||||
$ret = JSalmon::verify($this->data);
|
||||
$tmp = JSalmon::unpack($this->data['data']);
|
||||
if ($ret && $ret['success'] && $tmp) {
|
||||
if ($ret['signer']) {
|
||||
logger('Unpacked: ' . json_encode($tmp, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT), LOGGER_DATA, LOG_DEBUG);
|
||||
$saved = json_encode($this->data, JSON_UNESCAPED_SLASHES);
|
||||
$this->data = $tmp;
|
||||
$this->raw = json_encode($tmp, JSON_UNESCAPED_SLASHES);
|
||||
$this->meta['signer'] = $ret['signer'];
|
||||
$this->meta['signed_data'] = $saved;
|
||||
if ($ret['hubloc']) {
|
||||
$this->meta['hubloc'] = $ret['hubloc'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
logger('JSalmon verification failure.');
|
||||
$this->valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Attempt to assemble an Activity from what we were given.
|
||||
|
||||
if ($this->is_valid()) {
|
||||
|
|
Loading…
Reference in a new issue