Skip to content

Commit 608feea

Browse files
committed
feat(crl): add CrlValidationStatus backed enum
Replaces ad-hoc 'valid'/'revoked'/... string literals with a typed PHP 8.1 backed enum. Makes invalid states impossible to represent and enables exhaustive pattern-matching across the CRL pipeline. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 7705f6a commit 608feea

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

lib/Enum/CrlValidationStatus.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCA\Libresign\Enum;
11+
12+
/**
13+
* Represents the outcome of a CRL revocation check performed by
14+
* {@see \OCA\Libresign\Service\Crl\CrlRevocationChecker}.
15+
*/
16+
enum CrlValidationStatus: string {
17+
/** CRL fetched and certificate serial not listed as revoked. */
18+
case VALID = 'valid';
19+
/** Certificate serial found in the CRL – certificate is revoked. */
20+
case REVOKED = 'revoked';
21+
/** Admin disabled external CRL validation; local CRLs were not checked. */
22+
case DISABLED = 'disabled';
23+
/** All CRL Distribution Point URLs were unreachable. */
24+
case URLS_INACCESSIBLE = 'urls_inaccessible';
25+
/** A download or parse error occurred while fetching the CRL. */
26+
case VALIDATION_ERROR = 'validation_error';
27+
/** CRL was parsed but the check was inconclusive. */
28+
case VALIDATION_FAILED = 'validation_failed';
29+
/** The crlDistributionPoints extension is present but contains no URLs. */
30+
case NO_URLS = 'no_urls';
31+
/** The certificate has no crlDistributionPoints extension at all. */
32+
case MISSING = 'missing';
33+
}

0 commit comments

Comments
 (0)