Skip to content

Commit

Permalink
Fix swiftlint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dcaunt committed Sep 20, 2024
1 parent 02dc358 commit 92c9646
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,12 @@ internal final class AppUID2Client: Sendable {
func decryptResponse(_ b64Secret: String, _ responseData: Data, _ isRefresh: Bool = false) -> Data? {

// Confirm that responseData is Base64
// swiftlint:disable:next non_optional_string_data_conversion
guard let base64String = String(data: responseData, encoding: .utf8),
let decodedData = Data(base64Encoded: base64String, options: .ignoreUnknownCharacters) else {
return responseData
}

// Parse Reponse Envelope
// Parse Response Envelope
// https://github.com/UnifiedID2/uid2docs/blob/main/api/v2/encryption-decryption.md#encrypted-response-envelope

// Decrypt Data
Expand Down Expand Up @@ -212,7 +211,6 @@ internal final class AppUID2Client: Sendable {
payload = decryptedData.subdata(in: 16..<decryptedData.count)
}

// swiftlint:disable:next non_optional_string_data_conversion
guard let _ = String(data: payload, encoding: .utf8) else {
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ extension TokenGenerationError: LocalizedError {
if let message,
let jsonObject = try? JSONSerialization.jsonObject(with: Data(message.utf8)),
let jsonString = try? JSONSerialization.data(withJSONObject: jsonObject, options: .prettyPrinted) {
// swiftlint:disable:next non_optional_string_data_conversion
formattedMessage = String(data: jsonString, encoding: .utf8)
} else {
formattedMessage = message
Expand Down
2 changes: 0 additions & 2 deletions Sources/UID2/Networking/DataEnvelope.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ internal enum DataEnvelope {
extension Data {
/// A convenience initializer for converting from a Data representation of a base64 encoded string to its decoded Data.
init?(base64EncodedData: Data, options: Data.Base64DecodingOptions = []) {
// https://github.com/realm/SwiftLint/issues/5263#issuecomment-2115182747
// swiftlint:disable:next non_optional_string_data_conversion
guard let base64String = String(data: base64EncodedData, encoding: .utf8) else {
return nil
}
Expand Down
2 changes: 0 additions & 2 deletions Sources/UID2/UID2Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ internal final class UID2Client: Sendable {
let decoder = JSONDecoder.apiDecoder()
guard response.statusCode == 200 else {
let statusCode = response.statusCode
// https://github.com/realm/SwiftLint/issues/5263#issuecomment-2115182747
// swiftlint:disable:next non_optional_string_data_conversion
let responseText = String(data: data, encoding: .utf8) ?? "<none>"
os_log("Request failure (%d) %@", log: log, type: .error, statusCode, responseText)
if !environment.isProduction {
Expand Down
2 changes: 1 addition & 1 deletion Sources/UID2/UID2Manager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import Combine
import Foundation
import OSLog

// swiftlint:disable:next type_body_length
@available(iOS 13, tvOS 13, *)
// swiftlint:disable:next type_body_length
public final actor UID2Manager {
private enum InitializationState {
case pending
Expand Down

0 comments on commit 92c9646

Please sign in to comment.