feat: implement initial read only access

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-09-07 21:58:35 -04:00
parent 661e0e1213
commit 92e85aed47
17 changed files with 863 additions and 4 deletions
+8 -2
View File
@@ -14,7 +14,7 @@ final readonly class DiscoveryDocument
public const MAX_BYTES = 2 * 1024 * 1024;
/** @param list<Action> $actions */
private function __construct(public array $actions, public bool $hasProofKeys) {}
private function __construct(public array $actions, public bool $hasProofKeys, public array $proofKeys = []) {}
public static function parse(string $xml, ServerAddress $server): self
{
@@ -52,8 +52,14 @@ final readonly class DiscoveryDocument
throw new RuntimeException('Discovery has no external view/edit actions. Check WOPI enablement and forwarded HTTPS headers.');
}
$proof = $xpath->query('/wopi-discovery/proof-key')->item(0);
$keys = [];
if ($proof instanceof DOMElement) {
foreach (['modulus', 'exponent', 'oldmodulus', 'oldexponent'] as $attribute) {
$keys[$attribute] = $proof->getAttribute($attribute);
}
}
return new self($actions, $proof instanceof DOMElement
&& $proof->getAttribute('modulus') !== '' && $proof->getAttribute('exponent') !== '');
&& $proof->getAttribute('modulus') !== '' && $proof->getAttribute('exponent') !== '', $keys);
} finally {
libxml_clear_errors();
libxml_use_internal_errors($previous);