mirror of
https://github.com/apple/swift-certificates
synced 2026-11-29 05:04:21 +00:00
* Adopt `apple/swift-format` * install swift-format * set `UseSynthesizedInitializer` to `false` until bug is fixed https://github.com/apple/swift-format/issues/591 * fix license header * Fix license header
45 lines
1.1 KiB
Swift
45 lines
1.1 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftCertificates open source project
|
|
//
|
|
// Copyright (c) 2022 Apple Inc. and the SwiftCertificates project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftCertificates project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
struct OCSPVersion {
|
|
var rawValue: Int
|
|
|
|
init(rawValue: Int) {
|
|
self.rawValue = rawValue
|
|
}
|
|
|
|
static let v1 = Self(rawValue: 0)
|
|
}
|
|
|
|
extension OCSPVersion: Hashable {}
|
|
|
|
extension OCSPVersion: Sendable {}
|
|
|
|
extension OCSPVersion: Comparable {
|
|
static func < (lhs: Self, rhs: Self) -> Bool {
|
|
lhs.rawValue < rhs.rawValue
|
|
}
|
|
}
|
|
|
|
extension OCSPVersion: CustomStringConvertible {
|
|
var description: String {
|
|
switch self {
|
|
case .v1:
|
|
return "OCSPv1"
|
|
case let unknown:
|
|
return "OCSPv\(unknown.rawValue + 1)"
|
|
}
|
|
}
|
|
}
|