-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathRevocableCredential.swift
31 lines (25 loc) · 1.18 KB
/
RevocableCredential.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import Foundation
/// `RevocableCredential` is a protocol that defines the attributes and behaviors
/// of a credential that can be revoked or suspended.
public protocol RevocableCredential {
/// Indicates whether the credential can be revoked.
var canBeRevoked: Bool { get }
/// Indicates whether the credential can be suspended.
var canBeSuspended: Bool { get }
/// Checks if the credential is currently revoked.
///
/// - Returns: A Boolean value indicating whether the credential is revoked.
/// - Throws: An error if the status cannot be determined.
var isRevoked: Bool { get async throws }
/// Checks if the credential is currently suspended.
///
/// - Returns: A Boolean value indicating whether the credential is suspended.
/// - Throws: An error if the status cannot be determined.
var isSuspended: Bool { get async throws }
}
public extension Credential {
/// A Boolean value indicating whether the credential can verify revocability.
var isRevocable: Bool { self is RevocableCredential }
/// Returns the revocable representation of the credential.
var revocable: RevocableCredential? { self as? RevocableCredential }
}