diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9f28ee9..d16c095 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,12 +10,14 @@ on: jobs: lint: name: Lint Code - runs-on: macos-latest + runs-on: ubuntu-latest steps: - name: Repository checkout uses: actions/checkout@v4 - name: Lint - run: swiftlint + uses: norio-nomura/action-swiftlint@3.2.1 + with: + args: --strict test: name: Test Xcode ${{ matrix.xcode }} - ${{ matrix.xcodebuildCommand }} runs-on: "macos-latest" diff --git a/Sources/TelemetryClient/SignalManager.swift b/Sources/TelemetryClient/SignalManager.swift index 0432733..a30aac9 100644 --- a/Sources/TelemetryClient/SignalManager.swift +++ b/Sources/TelemetryClient/SignalManager.swift @@ -86,7 +86,7 @@ internal class SignalManager: SignalManageable { let signalPostBody = SignalPostBody( receivedAt: Date(), appID: UUID(uuidString: configuration.telemetryAppID)!, - clientUser: CryptoHashing.sha256(str: customUserID ?? self.defaultUserIdentifier, salt: configuration.salt), + clientUser: CryptoHashing.sha256(string: customUserID ?? self.defaultUserIdentifier, salt: configuration.salt), sessionID: configuration.sessionID.uuidString, type: "\(signalName)", floatValue: floatValue, @@ -203,7 +203,7 @@ private extension SignalManager { #if os(macOS) /// A custom ``UserDefaults`` instance specific to TelemetryDeck and the current application. private var customDefaults: UserDefaults? { - let appIdHash = CryptoHashing.sha256(str: self.configuration.telemetryAppID, salt: "") + let appIdHash = CryptoHashing.sha256(string: self.configuration.telemetryAppID, salt: "") return UserDefaults(suiteName: "com.telemetrydeck.\(appIdHash.suffix(12))") } #endif diff --git a/Tests/TelemetryClientTests/CryptoHashingTests.swift b/Tests/TelemetryClientTests/CryptoHashingTests.swift index 4428021..78472ce 100644 --- a/Tests/TelemetryClientTests/CryptoHashingTests.swift +++ b/Tests/TelemetryClientTests/CryptoHashingTests.swift @@ -12,7 +12,7 @@ final class CryptoHashingTests: XCTestCase { let expectedDigestString = "5b8fab7cf45fcece0e99a05950611b7b355917e4fb6daa73fd3d7590764fa53b" - XCTAssertEqual(expectedDigestString, CryptoHashing.sha256(str: stringToHash, salt: "")) + XCTAssertEqual(expectedDigestString, CryptoHashing.sha256(string: stringToHash, salt: "")) XCTAssertEqual(expectedDigestString, CryptoHashing.commonCryptoSha256(strData: dataToHash)) // even though we already test if we can import CryptoKit, somehow this still fails on iOS 12, @@ -31,9 +31,9 @@ final class CryptoHashingTests: XCTestCase { let secondSalt = "x21MTSq3MRSmLjVFsYIe" let expectedSecondDigestString = "acb027bb031c0f73de26c6b8d0441d9c98449d582a538014c44ca49b4c299aa8" - XCTAssertEqual(expectedDigestString, CryptoHashing.sha256(str: stringToHash, salt: salt)) - XCTAssertEqual(expectedSecondDigestString, CryptoHashing.sha256(str: stringToHash, salt: secondSalt)) - XCTAssertNotEqual(CryptoHashing.sha256(str: stringToHash, salt: salt), CryptoHashing.sha256(str: stringToHash, salt: secondSalt)) + XCTAssertEqual(expectedDigestString, CryptoHashing.sha256(string: stringToHash, salt: salt)) + XCTAssertEqual(expectedSecondDigestString, CryptoHashing.sha256(string: stringToHash, salt: secondSalt)) + XCTAssertNotEqual(CryptoHashing.sha256(string: stringToHash, salt: salt), CryptoHashing.sha256(string: stringToHash, salt: secondSalt)) } #endif }