diff options
author | Mario <mario@mariovavti.com> | 2024-02-01 16:00:17 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-02-01 16:00:17 +0000 |
commit | 2e155892fe88c877c226fc5a10402a05c05fe8cd (patch) | |
tree | 819d7eb0d982ad715823a3171dcc54b29f70eabe /Zotlabs | |
parent | decc8f21621f6c0bb129285757e6d24f278216d2 (diff) | |
download | volse-hubzilla-2e155892fe88c877c226fc5a10402a05c05fe8cd.tar.gz volse-hubzilla-2e155892fe88c877c226fc5a10402a05c05fe8cd.tar.bz2 volse-hubzilla-2e155892fe88c877c226fc5a10402a05c05fe8cd.zip |
testing JcsEddsa2022 sigs
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Lib/ActivityStreams.php | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php index b37efdd26..b3b58af89 100644 --- a/Zotlabs/Lib/ActivityStreams.php +++ b/Zotlabs/Lib/ActivityStreams.php @@ -524,16 +524,22 @@ class ActivityStreams { $signer = $this->get_property_obj('verificationMethod', $this->sig); $parseUrl = parse_url($signer); - if (!empty($parseUrl['fragment']) && str_starts_with($parseUrl['fragment'],'z6Mk')) { - $publicKey = $parseUrl['fragment']; + + if (isset($parseUrl['fragment'])) { + if (str_starts_with($parseUrl['fragment'], 'z6Mk')) { + $publicKey = $parseUrl['fragment']; + } unset($parseUrl['fragment']); + } + + if (isset($parseUrl['query'])) { unset($parseUrl['query']); } $url = unparse_url($parseUrl); - //$this->signer = [ 'id' => $url ]; $hublocs = Activity::get_actor_hublocs($url); + $hasStoredKey = false; if ($hublocs) { foreach ($hublocs as $hubloc) { @@ -543,14 +549,26 @@ class ActivityStreams { } } } + if (!$hasStoredKey) { $this->signer = Activity::get_actor($url); - if ($this->signer - && !empty($this->signer['assertionMethod']) - && !empty($this->signer['assertionMethod']['publicKeyMultibase'])) { - $publicKey = $this->signer['assertionMethod']['publicKeyMultibase']; + + if (isset($this->signer['assertionMethod'])) { + if (!isset($this->signer['assertionMethod'][0])) { + $this->signer['assertionMethod'] = [$this->signer['assertionMethod']]; + } + + foreach($this->signer['assertionMethod'] as $am) { + if ($url === $am['controller'] && + $am['type'] === 'Multikey' && + str_starts_with($am['publicKeyMultibase'], 'z6Mk') + ) { + $publicKey = $am['publicKeyMultibase']; + } + } } } + if ($publicKey) { $this->sigok = (new JcsEddsa2022)->verify($this->data, $publicKey); } |