• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LibreSign / libresign / 21017658638

15 Jan 2026 02:36AM UTC coverage: 44.433%. First build
21017658638

Pull #6436

github

web-flow
Merge 59a8413e3 into db0316516
Pull Request #6436: feat: async parallel signing

415 of 961 new or added lines in 46 files covered. (43.18%)

7036 of 15835 relevant lines covered (44.43%)

4.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.33
/lib/Service/TsaValidationService.php
1
<?php
2

3
declare(strict_types=1);
4
/**
5
 * SPDX-FileCopyrightText: 2024 LibreCode coop and contributors
6
 * SPDX-License-Identifier: AGPL-3.0-or-later
7
 */
8

9
namespace OCA\Libresign\Service;
10

11
use OCA\Libresign\AppInfo\Application;
12
use OCA\Libresign\Exception\LibresignException;
13
use OCP\IAppConfig;
14

15
class TsaValidationService {
16
        public function __construct(
17
                private IAppConfig $appConfig,
18
        ) {
19
        }
53✔
20

21
        /**
22
         * Validate TSA configuration
23
         *
24
         * @throws LibresignException if TSA is misconfigured
25
         */
26
        public function validateConfiguration(): void {
27
                $tsaUrl = $this->getTsaUrl();
6✔
28
                if (empty($tsaUrl)) {
6✔
29
                        return;
1✔
30
                }
31

32
                $this->validateTsaUrlFormat($tsaUrl);
5✔
33
                $this->validateTsaHostResolution($tsaUrl);
3✔
34
        }
35

36
        private function getTsaUrl(): string {
37
                return $this->appConfig->getValueString(Application::APP_ID, 'tsa_url', '');
6✔
38
        }
39

40
        private function validateTsaUrlFormat(string $tsaUrl): void {
41
                if (!filter_var($tsaUrl, FILTER_VALIDATE_URL)) {
5✔
42
                        throw new LibresignException('Invalid TSA URL format: ' . $tsaUrl);
2✔
43
                }
44

45
                $tsaUrlParsed = parse_url($tsaUrl);
3✔
46
                if (!isset($tsaUrlParsed['host'])) {
3✔
NEW
47
                        throw new LibresignException('Invalid TSA URL: ' . $tsaUrl);
×
48
                }
49
        }
50

51
        private function validateTsaHostResolution(string $tsaUrl): void {
52
                $host = (string)parse_url($tsaUrl, PHP_URL_HOST);
3✔
53
                if (!@gethostbyname($host) || gethostbyname($host) === $host) {
3✔
54
                        throw new LibresignException('Timestamp Authority (TSA) service is unavailable or misconfigured: ' . $tsaUrl);
1✔
55
                }
56
        }
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc