Skip to content

Commit

Permalink
[fix] formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dtsiflit committed Jul 15, 2024
1 parent fd63fed commit 8a1a92d
Showing 1 changed file with 34 additions and 35 deletions.
69 changes: 34 additions & 35 deletions Sources/Entities/Issuance/AuthorizedRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,44 +36,43 @@ public extension CanExpire {
}

public enum AuthorizedRequest {
case noProofRequired(
accessToken: IssuanceAccessToken,
refreshToken: IssuanceRefreshToken?,
credentialIdentifiers: AuthorizationDetailsIdentifiers?,
timeStamp: TimeInterval
)
case proofRequired(
accessToken: IssuanceAccessToken,
refreshToken: IssuanceRefreshToken?,
cNonce: CNonce,
credentialIdentifiers: AuthorizationDetailsIdentifiers?,
timeStamp: TimeInterval
)
case noProofRequired(
accessToken: IssuanceAccessToken,
refreshToken: IssuanceRefreshToken?,
credentialIdentifiers: AuthorizationDetailsIdentifiers?,
timeStamp: TimeInterval
)
case proofRequired(
accessToken: IssuanceAccessToken,
refreshToken: IssuanceRefreshToken?,
cNonce: CNonce,
credentialIdentifiers: AuthorizationDetailsIdentifiers?,
timeStamp: TimeInterval
)


public func isAccessTokenExpired(clock: TimeInterval) -> Bool {
guard let timeStamp = self.timeStamp else {
return true
}
return accessToken?.isExpired(issued: timeStamp, at: clock) ?? false
public func isAccessTokenExpired(clock: TimeInterval) -> Bool {
guard let timeStamp = self.timeStamp else {
return true
}
return accessToken?.isExpired(issued: timeStamp, at: clock) ?? false
}

public func isRefreshTokenExpired(clock: TimeInterval) -> Bool {
guard let timeStamp = self.timeStamp else {
return true
}
return accessToken?.isExpired(
issued: timeStamp,
at: clock
) ?? false
public func isRefreshTokenExpired(clock: TimeInterval) -> Bool {
guard let timeStamp = self.timeStamp else {
return true
}

public var timeStamp: TimeInterval? {
switch self {
case .noProofRequired(_, _, _, let timeStamp):
return timeStamp
case .proofRequired(_, _, _, _, let timeStamp):
return timeStamp
return accessToken?.isExpired(
issued: timeStamp,
at: clock
) ?? false
}

public var timeStamp: TimeInterval? {
switch self {
case .noProofRequired(_, _, _, let timeStamp):
return timeStamp
case .proofRequired(_, _, _, _, let timeStamp):
return timeStamp
}
}

Expand All @@ -85,7 +84,7 @@ public enum AuthorizedRequest {
return nil
}
}

public var proofToken: IssuanceAccessToken? {
switch self {
case .noProofRequired:
Expand Down

0 comments on commit 8a1a92d

Please sign in to comment.