generated from Nodarx/template
feat: implement initial read only access
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user