diff --git a/Sources/TelemetryDeck/Signals/Signal.swift b/Sources/TelemetryDeck/Signals/Signal.swift index d95f6e1..d327e03 100644 --- a/Sources/TelemetryDeck/Signals/Signal.swift +++ b/Sources/TelemetryDeck/Signals/Signal.swift @@ -17,7 +17,7 @@ struct SignalPostBody: Codable, Equatable { let receivedAt: Date /// The App ID of this signal - let appID: UUID + let appID: String /// A user identifier. This should be hashed on the client, and will be hashed + salted again /// on the server to break any connection to personally identifiable data. diff --git a/Sources/TelemetryDeck/Signals/SignalManager.swift b/Sources/TelemetryDeck/Signals/SignalManager.swift index 20ff12b..25a7cbb 100644 --- a/Sources/TelemetryDeck/Signals/SignalManager.swift +++ b/Sources/TelemetryDeck/Signals/SignalManager.swift @@ -93,7 +93,7 @@ final class SignalManager: SignalManageable, @unchecked Sendable { let signalPostBody = SignalPostBody( receivedAt: Date(), - appID: UUID(uuidString: configuration.telemetryAppID)!, + appID: configuration.telemetryAppID, clientUser: CryptoHashing.sha256(string: customUserID ?? defaultUserIdentifier, salt: configuration.salt), sessionID: configuration.sessionID.uuidString, type: "\(signalName)", diff --git a/Tests/TelemetryDeckTests/TelemetryDeckTests.swift b/Tests/TelemetryDeckTests/TelemetryDeckTests.swift index 4466973..9655892 100644 --- a/Tests/TelemetryDeckTests/TelemetryDeckTests.swift +++ b/Tests/TelemetryDeckTests/TelemetryDeckTests.swift @@ -19,21 +19,21 @@ struct TelemetryDeckTests { let signalCache = SignalCache(logHandler: nil) let signals: [SignalPostBody] = [ - .init(receivedAt: Date(), appID: UUID(), clientUser: "01", sessionID: "01", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), - .init(receivedAt: Date(), appID: UUID(), clientUser: "02", sessionID: "02", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), - .init(receivedAt: Date(), appID: UUID(), clientUser: "03", sessionID: "03", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), - .init(receivedAt: Date(), appID: UUID(), clientUser: "04", sessionID: "04", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), - .init(receivedAt: Date(), appID: UUID(), clientUser: "05", sessionID: "05", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), - .init(receivedAt: Date(), appID: UUID(), clientUser: "06", sessionID: "06", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), - .init(receivedAt: Date(), appID: UUID(), clientUser: "07", sessionID: "07", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), - .init(receivedAt: Date(), appID: UUID(), clientUser: "08", sessionID: "08", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), - .init(receivedAt: Date(), appID: UUID(), clientUser: "09", sessionID: "09", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), - .init(receivedAt: Date(), appID: UUID(), clientUser: "10", sessionID: "10", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), - .init(receivedAt: Date(), appID: UUID(), clientUser: "11", sessionID: "11", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), - .init(receivedAt: Date(), appID: UUID(), clientUser: "12", sessionID: "12", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), - .init(receivedAt: Date(), appID: UUID(), clientUser: "13", sessionID: "13", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), - .init(receivedAt: Date(), appID: UUID(), clientUser: "14", sessionID: "14", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), - .init(receivedAt: Date(), appID: UUID(), clientUser: "15", sessionID: "15", type: "test", floatValue: nil, payload: [:], isTestMode: "true") + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "01", sessionID: "01", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "02", sessionID: "02", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "03", sessionID: "03", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "04", sessionID: "04", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "05", sessionID: "05", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "06", sessionID: "06", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "07", sessionID: "07", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "08", sessionID: "08", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "09", sessionID: "09", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "10", sessionID: "10", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "11", sessionID: "11", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "12", sessionID: "12", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "13", sessionID: "13", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "14", sessionID: "14", type: "test", floatValue: nil, payload: [:], isTestMode: "true"), + .init(receivedAt: Date(), appID: UUID().uuidString, clientUser: "15", sessionID: "15", type: "test", floatValue: nil, payload: [:], isTestMode: "true") ] for signal in signals { @@ -194,7 +194,7 @@ private class FakeSignalManager: @preconcurrency SignalManageable { let signalPostBody = SignalPostBody( receivedAt: Date(), - appID: UUID(uuidString: configuration.telemetryAppID)!, + appID: configuration.telemetryAppID, clientUser: customUserID ?? "no user", sessionID: configuration.sessionID.uuidString, type: "\(signalType)",