From 5b358b8bef04bf1216a1bffb3f759a845d1952d5 Mon Sep 17 00:00:00 2001 From: Christian Risi <75698846+CnF-Gris@users.noreply.github.com> Date: Mon, 9 Dec 2024 12:58:26 +0000 Subject: [PATCH] V0.7.0 Arroyo Toad Fixed support integrating MessageUtils Library --- Package.resolved | 11 ++- Package.swift | 5 +- Private/cert.pem | 16 ----- Private/privateKey.pem | 10 ++- Private/privateKey_ASN1.pem | 8 --- .../Classes/Devices/EdgeDevice.swift | 39 +++++++---- .../Classes/Utils/Field.swift | 16 ----- .../Classes/Utils/Location3D.swift | 16 ----- .../Classes/Utils/Message.swift | 68 ------------------- .../IoT-Simulator-Core/Enums/DeviceType.swift | 4 -- .../Enums/MessageType.swift | 7 -- .../IoT_Simulator_Core.swift | 27 +++++--- .../Protocols/EdgeDeviceProtocol.swift | 12 ++-- .../Utils/FieldExtension.swift | 16 +++++ .../Devices-Tests.swift | 51 +++++++------- .../IoTCore-Tests.swift | 21 +++--- 16 files changed, 116 insertions(+), 211 deletions(-) delete mode 100644 Private/cert.pem delete mode 100644 Private/privateKey_ASN1.pem delete mode 100644 Sources/IoT-Simulator-Core/Classes/Utils/Field.swift delete mode 100644 Sources/IoT-Simulator-Core/Classes/Utils/Location3D.swift delete mode 100644 Sources/IoT-Simulator-Core/Classes/Utils/Message.swift delete mode 100644 Sources/IoT-Simulator-Core/Enums/DeviceType.swift delete mode 100644 Sources/IoT-Simulator-Core/Enums/MessageType.swift create mode 100644 Sources/IoT-Simulator-Core/Utils/FieldExtension.swift diff --git a/Package.resolved b/Package.resolved index 01475fa..0fe2987 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "a49eafc65c63e9300677cadad384d86aab484d1c10a415ec467d840aff87c075", + "originHash" : "5001bc8eac215b7cfcb9159953b561765b257824796f7e76cbc179ccc37c3e81", "pins" : [ { "identity" : "swift-asn1", @@ -18,6 +18,15 @@ "branch" : "main", "revision" : "dc4c2c14e7ff95ee3aa8d3c2a217a248f51d3688" } + }, + { + "identity" : "swift-messageutils", + "kind" : "remoteSourceControl", + "location" : "https://repositories.communitynotfound.work/PoliBa-Software-Architecture/Swift-MessageUtils.git", + "state" : { + "branch" : "main", + "revision" : "8ae58929b01bf0b1a4a8c31b81dbbf18a3876feb" + } } ], "version" : 3 diff --git a/Package.swift b/Package.swift index d7330de..4af8f5b 100644 --- a/Package.swift +++ b/Package.swift @@ -23,6 +23,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/apple/swift-crypto.git", branch: "main"), + .package(url: "https://repositories.communitynotfound.work/PoliBa-Software-Architecture/Swift-MessageUtils.git", branch: "main") ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. @@ -41,17 +42,17 @@ let package = Package( "RandomCpp", "DataAcquisition", .product(name: "Crypto", package: "swift-crypto"), + .product(name: "MessageUtils", package: "swift-messageutils"), ], swiftSettings: [ .interoperabilityMode(.Cxx), - .interoperabilityMode(.C) + ]), .testTarget( name: "IoT-Simulator-CoreTests", dependencies: ["IoT-Simulator-Core"], swiftSettings: [ - .interoperabilityMode(.C), .interoperabilityMode(.Cxx), ] diff --git a/Private/cert.pem b/Private/cert.pem deleted file mode 100644 index 86323fe..0000000 --- a/Private/cert.pem +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICeTCCAdqgAwIBAgIUeKyiiDJdVGH3ParIry5vn/YGnaowCgYIKoZIzj0EAwIw -TjELMAkGA1UEBhMCSVQxDTALBgNVBAgMBEJhcmkxDTALBgNVBAcMBEJhcmkxITAf -BgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yNDEyMDIxNjM0NDVa -Fw0yNTAxMDExNjM0NDVaME4xCzAJBgNVBAYTAklUMQ0wCwYDVQQIDARCYXJpMQ0w -CwYDVQQHDARCYXJpMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQw -gZswEAYHKoZIzj0CAQYFK4EEACMDgYYABAAAfWnGEUMElY/XIWUTPvX65HX3N5Ik -JKPdVFzDRtaTHRJKnEEvU7Z5iLAT9NpbVfCabvQXKo7LD5sjoJ1ZpSVcogDgCFCo -pmVin2ZLs5lyMtaetpVDH8m+AIlRQkkuGmkasM+OV62kzSoHl/CL4eNz1xXwqsPt -oBgvPiRFxNIE/0dz96NTMFEwHQYDVR0OBBYEFKW5mYrSXJn68diXLDjhbiEGAxJu -MB8GA1UdIwQYMBaAFKW5mYrSXJn68diXLDjhbiEGAxJuMA8GA1UdEwEB/wQFMAMB -Af8wCgYIKoZIzj0EAwIDgYwAMIGIAkIAhVgtxgnZd6KeefLjZ6Mazgr5xLDcAHyI -NsKtTw3YzT/Pztnk2ccV+NyDZyoTG72lHoPMTiB5mRSUTqORg59XQTkCQgDqHRoN -tRQlPWY3abohilRRdvYZrsoPR8FzB/M4KxT0nk10jc1wtosQ7l/XZGcKe8/k+iVs -HC5CsESzsvnp+Qslyw== ------END CERTIFICATE----- diff --git a/Private/privateKey.pem b/Private/privateKey.pem index c2a1202..fd2be10 100644 --- a/Private/privateKey.pem +++ b/Private/privateKey.pem @@ -1,7 +1,5 @@ -----BEGIN EC PRIVATE KEY----- -MIHcAgEBBEIBAQAy+3ElWUTttb9xxVDshJlGt/clGdhPkp76aJ3LJySugsnC8RRO -UracnWQi2A+XnEI1ZskzYAFUfh7G5o5ViDygBwYFK4EEACOhgYkDgYYABAAAfWnG -EUMElY/XIWUTPvX65HX3N5IkJKPdVFzDRtaTHRJKnEEvU7Z5iLAT9NpbVfCabvQX -Ko7LD5sjoJ1ZpSVcogDgCFCopmVin2ZLs5lyMtaetpVDH8m+AIlRQkkuGmkasM+O -V62kzSoHl/CL4eNz1xXwqsPtoBgvPiRFxNIE/0dz9w== ------END EC PRIVATE KEY----- +MHcCAQEEIIHjmZWSXyYrRusrK1z3TDaZY5mBeed3vODCxcwu0FsKoAoGCCqGSM49 +AwEHoUQDQgAEsszGIDjEgu6k/MkW+p5Bf+UPEU/jF9bLykzEOzP3rD/HJ2AprRpV +m+PNIaLThIdUTPsO2BBBLH2CaAJ/1x65Wg== +-----END EC PRIVATE KEY----- \ No newline at end of file diff --git a/Private/privateKey_ASN1.pem b/Private/privateKey_ASN1.pem deleted file mode 100644 index f1f5b78..0000000 --- a/Private/privateKey_ASN1.pem +++ /dev/null @@ -1,8 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIHuAgEAMBAGByqGSM49AgEGBSuBBAAjBIHWMIHTAgEBBEIBAQAy+3ElWUTttb9x -xVDshJlGt/clGdhPkp76aJ3LJySugsnC8RROUracnWQi2A+XnEI1ZskzYAFUfh7G -5o5ViDyhgYkDgYYABAAAfWnGEUMElY/XIWUTPvX65HX3N5IkJKPdVFzDRtaTHRJK -nEEvU7Z5iLAT9NpbVfCabvQXKo7LD5sjoJ1ZpSVcogDgCFCopmVin2ZLs5lyMtae -tpVDH8m+AIlRQkkuGmkasM+OV62kzSoHl/CL4eNz1xXwqsPtoBgvPiRFxNIE/0dz -9w== ------END PRIVATE KEY----- \ No newline at end of file diff --git a/Sources/IoT-Simulator-Core/Classes/Devices/EdgeDevice.swift b/Sources/IoT-Simulator-Core/Classes/Devices/EdgeDevice.swift index c0639ab..792776d 100644 --- a/Sources/IoT-Simulator-Core/Classes/Devices/EdgeDevice.swift +++ b/Sources/IoT-Simulator-Core/Classes/Devices/EdgeDevice.swift @@ -1,34 +1,36 @@ +import Foundation import Crypto import DataAcquisition -import Foundation +import MessageUtils public class EdgeDevice: EdgeDeviceP { - public let deviceID: String + + public let deviceID: UInt128 public let deviceType: DeviceType public let dataType: DataType public var disconnected: Bool public var compromised: Bool - public var location: Location3D + public var location: Location public var dutyCicle: UInt public var sensors: [Int: Sensor] - public var privateKey: P521.Signing.PrivateKey + public var privateKey: P256.Signing.PrivateKey private var numberOfSensors: Int { return sensors.count } public init( - deviceID: String, + deviceID: UInt128, dataType: DataType, disconnected: Bool, - location: Location3D, + location: Location, dutyCicle: UInt, sensors: [Int: Sensor], - privateKey: P521.Signing.PrivateKey + privateKey: P256.Signing.PrivateKey ) { self.deviceID = deviceID - self.deviceType = DeviceType.EdgeDevice + self.deviceType = DeviceType.EDGE_SENSOR self.dataType = dataType self.disconnected = disconnected self.compromised = false @@ -46,7 +48,7 @@ public class EdgeDevice: EdgeDeviceP { self.sensors.removeValue(forKey: id) } - public func work(envrionment: PhysicalEnvironment) -> Message { + public func work(envrionment: PhysicalEnvironment) throws -> Data { // UGLY: Declaring here some variables manually, remove them if you want to offere flexibility let numberOfSamples: Int = 10 @@ -70,11 +72,15 @@ public class EdgeDevice: EdgeDeviceP { let metrics: Metrics = getMetrics( rowPointer, Int32(self.sensors.count), Int32(numberOfSamples)) - // Todo: END Add Vincenzo's implementation + // UGLY: Supposing everytihing is fine let msg: Message = Message( - msgType: MessageType.Data, + version: 1, + messageType: MessageType.DATA, + devType: self.deviceType, + RESERVED: 0, + signType: SignType.P256, timestamp: Date(), - deviceID: self.deviceID, + devID: self.deviceID, location: self.location, fields: [ Field(key: "data_type", value: "\(self.dataType)"), @@ -83,9 +89,14 @@ public class EdgeDevice: EdgeDeviceP { ] ) - msg.signMessage(key: self.privateKey) + var msgData = serializeV1(msg: msg) + let signature = try signMessage(msgData: msgData, signType: msg.signType, key: self.privateKey) - return msg + msgData.append(Data(signature)) + + + + return msgData } } diff --git a/Sources/IoT-Simulator-Core/Classes/Utils/Field.swift b/Sources/IoT-Simulator-Core/Classes/Utils/Field.swift deleted file mode 100644 index 5396a4c..0000000 --- a/Sources/IoT-Simulator-Core/Classes/Utils/Field.swift +++ /dev/null @@ -1,16 +0,0 @@ - -public class Field : Codable{ - - public let key: String - public let value: String - - public init(key: String, value: String) { - self.key = key - self.value = value - } - - public var description: String { - return "\(self.key): \t\(self.value)" - } - -} \ No newline at end of file diff --git a/Sources/IoT-Simulator-Core/Classes/Utils/Location3D.swift b/Sources/IoT-Simulator-Core/Classes/Utils/Location3D.swift deleted file mode 100644 index d1f4b9b..0000000 --- a/Sources/IoT-Simulator-Core/Classes/Utils/Location3D.swift +++ /dev/null @@ -1,16 +0,0 @@ -public class Location3D { - - public let x : Float - public let y : Float - public let z : Float - - public init(_ x: Float, _ y: Float, _ z : Float) { - self.x = x - self.y = y - self.z = z - } - - public var description: String { - return "X: \(self.x)\tY: \(self.y)\tZ: \(self.z)" - } -} \ No newline at end of file diff --git a/Sources/IoT-Simulator-Core/Classes/Utils/Message.swift b/Sources/IoT-Simulator-Core/Classes/Utils/Message.swift deleted file mode 100644 index 282e808..0000000 --- a/Sources/IoT-Simulator-Core/Classes/Utils/Message.swift +++ /dev/null @@ -1,68 +0,0 @@ -import Crypto -import Foundation - -public class Message { - - public let messageType: MessageType - public let timestamp: Date - public let deviceID: String - public let location: Location3D - public let fields: [Field] - public var signature: String { - return self._signature != nil ? self._signature! : "##INVALID" - } - private var _signature: String? = nil - - public init( - msgType: MessageType, - timestamp: Date, - deviceID: String, - location: Location3D, - fields: [Field] - ) { - self.messageType = msgType - self.timestamp = timestamp - self.deviceID = deviceID - self.location = location - self.fields = fields - - } - - public func toDataCompatibleString() -> String { - var string: String = "\(self.messageType)" - string += "\(self.timestamp)" - string += "\(self.deviceID)" - string += "\(self.location.x)" - string += "\(self.location.y)" - string += "\(self.location.z)" - - for field in self.fields { - string += "\(field.key)\(field.value)" - } - - return string - } - - public func signMessage(key: P521.Signing.PrivateKey) { - do { - self._signature = try sign(string: self.toDataCompatibleString(), key: key) - } catch { - // Do nothing - } - } - - public var description: String { - - var string: String = "MessageType: \t\(self.messageType)\n" - string += "Timestamp: \t\(self.timestamp)\n" - string += "DeviceID: \t\(self.deviceID)\n" - string += "Location: \t\(self.location.description)\n" - - for field in self.fields { - string += "\(field.description)\n" - } - - return string - } - -} diff --git a/Sources/IoT-Simulator-Core/Enums/DeviceType.swift b/Sources/IoT-Simulator-Core/Enums/DeviceType.swift deleted file mode 100644 index eda7bbc..0000000 --- a/Sources/IoT-Simulator-Core/Enums/DeviceType.swift +++ /dev/null @@ -1,4 +0,0 @@ -public enum DeviceType : Sendable{ - case AsyncEdgeDevice - case EdgeDevice -} \ No newline at end of file diff --git a/Sources/IoT-Simulator-Core/Enums/MessageType.swift b/Sources/IoT-Simulator-Core/Enums/MessageType.swift deleted file mode 100644 index 4114b4e..0000000 --- a/Sources/IoT-Simulator-Core/Enums/MessageType.swift +++ /dev/null @@ -1,7 +0,0 @@ -public enum MessageType { - case KeepAlive - case Data - case Info - case Warning - case Critical -} \ No newline at end of file diff --git a/Sources/IoT-Simulator-Core/IoT_Simulator_Core.swift b/Sources/IoT-Simulator-Core/IoT_Simulator_Core.swift index be61ccd..0b8f75a 100644 --- a/Sources/IoT-Simulator-Core/IoT_Simulator_Core.swift +++ b/Sources/IoT-Simulator-Core/IoT_Simulator_Core.swift @@ -7,7 +7,7 @@ public actor IoTSimulatorCore { private static var enviroments: [String: PhysicalEnvironment] = Dictionary() private static var devices: [String: EdgeDeviceP] = Dictionary() - private static var env_dev: [String: Set] = Dictionary() + private static var env_dev: [String: Set] = Dictionary() private static var dev_tasks: [String: Task<(), Never>] = Dictionary() public static func addEnv(environment: PhysicalEnvironment) { @@ -16,7 +16,7 @@ public actor IoTSimulatorCore { public static func addDevice(location: String, device: EdgeDeviceP) throws { if let environment = IoTSimulatorCore.enviroments[location] { - IoTSimulatorCore.devices[device.deviceID] = device + IoTSimulatorCore.devices["\(device.deviceID)"] = device if IoTSimulatorCore.env_dev[location] == nil { IoTSimulatorCore.env_dev[location] = Set() @@ -26,12 +26,11 @@ public actor IoTSimulatorCore { // schedule work let task = IoTSimulatorCore.schedule(envID: environment.location, deviceID: device.deviceID) { msg in - print("\(msg.description)\n\n") + print("\(msg)\n\n") } failure: { print("Something is wrong") } - - IoTSimulatorCore.dev_tasks[device.deviceID] = task + IoTSimulatorCore.dev_tasks["\(device.deviceID)"] = task } else { throw CoreError.NoEnvironment @@ -43,6 +42,10 @@ public actor IoTSimulatorCore { return IoTSimulatorCore.enviroments[name] } + public static func getDev(devID: UInt128) -> EdgeDeviceP? { + return IoTSimulatorCore.devices["\(devID)"] + } + public static func getDev(devID: String) -> EdgeDeviceP? { return IoTSimulatorCore.devices[devID] } @@ -53,23 +56,27 @@ public actor IoTSimulatorCore { } } + + private static func schedule( envID: sending String, - deviceID: sending String, - success: sending @escaping (_ msg: Message) throws -> Void, + deviceID: UInt128, + success: sending @escaping (_ msg: Data) throws -> Void, failure: sending @escaping () -> Void ) -> Task<(), Never> { + let _devID : String = "\(deviceID)" return Task { var notCancelled: Bool = true - let dev = IoTSimulatorCore.getDev(devID: deviceID)! + let dev = IoTSimulatorCore.getDev(devID: _devID)! let env = IoTSimulatorCore.getEnv(name: envID)! while notCancelled { - - let message = dev.work(envrionment: env) + print("Device: \(dev.deviceID)") do { + let message = try dev.work(envrionment: env) + try success(message) } catch { failure() diff --git a/Sources/IoT-Simulator-Core/Protocols/EdgeDeviceProtocol.swift b/Sources/IoT-Simulator-Core/Protocols/EdgeDeviceProtocol.swift index e714a97..70eb00d 100644 --- a/Sources/IoT-Simulator-Core/Protocols/EdgeDeviceProtocol.swift +++ b/Sources/IoT-Simulator-Core/Protocols/EdgeDeviceProtocol.swift @@ -1,16 +1,18 @@ -import Crypto +import Foundation +import Crypto +import MessageUtils public protocol EdgeDeviceP { - var deviceID : String {get} + var deviceID : UInt128 {get} var deviceType : DeviceType {get} var dataType : DataType {get} - var location: Location3D {get set} + var location: Location{get set} var disconnected : Bool {get set} var compromised : Bool {get set} var dutyCicle : UInt {get set} - var privateKey: P521.Signing.PrivateKey {get} + var privateKey: P256.Signing.PrivateKey {get} - func work(envrionment: PhysicalEnvironment) -> Message + func work(envrionment: PhysicalEnvironment) throws -> Data } \ No newline at end of file diff --git a/Sources/IoT-Simulator-Core/Utils/FieldExtension.swift b/Sources/IoT-Simulator-Core/Utils/FieldExtension.swift new file mode 100644 index 0000000..930e7ae --- /dev/null +++ b/Sources/IoT-Simulator-Core/Utils/FieldExtension.swift @@ -0,0 +1,16 @@ +import MessageUtils + +extension Field { + + public init( + key: String, + value: String + ) { + + self.init( + key: Array(key.utf8), + value: Array(value.utf8) + ) + } + +} diff --git a/Tests/IoT-Simulator-CoreTests/Devices-Tests.swift b/Tests/IoT-Simulator-CoreTests/Devices-Tests.swift index 1e6eb4f..bc72b84 100644 --- a/Tests/IoT-Simulator-CoreTests/Devices-Tests.swift +++ b/Tests/IoT-Simulator-CoreTests/Devices-Tests.swift @@ -2,6 +2,7 @@ import Testing import RandomCpp import Foundation import Crypto +import MessageUtils @testable import IoT_Simulator_Core @@ -82,13 +83,13 @@ import Crypto let signKeyPath = "./Private/privateKey.pem" - let privateKey = try pem2key(filePath: signKeyPath) + let privateKey = try pem2_P256key(filePath: signKeyPath) let dev: EdgeDevice = EdgeDevice( - deviceID: "EDG-001", + deviceID: 1, dataType: .Temperature, disconnected: false, - location: Location3D(20, 10, 0), + location: Location(x: 20, y: 10, z: 0), dutyCicle: 100098, sensors: [ 0: Sensor(id: 0, sensorType: DataType.Temperature), @@ -98,22 +99,19 @@ import Crypto privateKey: privateKey ) - let message = dev.work(envrionment: env) - message.signMessage(key: dev.privateKey) + let message = try dev.work(envrionment: env) + let signedMessage = try deserializeV1(serializedData: message) - #expect(message != nil, "If this is nil, I don't knwo what's going on") - #expect(message.signature != nil, "If signature is nil, something is wrong") + print(signedMessage.toString()) + print(signedMessage.signature) + + #expect(signedMessage != nil, "If this is nil, I don't knwo what's going on") + #expect(signedMessage.signature != nil, "If signature is nil, something is wrong") - print(message.description) - print(message.signature) #expect( - try verifySignature( - signature:message.signature, - string: message.toDataCompatibleString(), - key: dev.privateKey.publicKey - ), + try verifyMessageSignature(message: signedMessage, key: privateKey.publicKey) , "Let's see that signatures match" ) } @@ -127,13 +125,13 @@ import Crypto let signKeyPath = "./Private/privateKey.pem" - let privateKey = try pem2key(filePath: signKeyPath) + let privateKey = try pem2_P256key(filePath: signKeyPath) let dev: EdgeDevice = EdgeDevice( - deviceID: "EDG-001", + deviceID: 1, dataType: .Temperature, disconnected: false, - location: Location3D(20, 10, 0), + location: Location(x: 20, y: 10, z: 0), dutyCicle: 100098, sensors: [ 0: RealSensor(sensorID: 0, sensorType: .Temperature, faulty: false, meanNoise: 1, stdNoise: 3, quantizationBits: 3), @@ -143,22 +141,19 @@ import Crypto privateKey: privateKey ) - let message = dev.work(envrionment: env) - message.signMessage(key: dev.privateKey) + let message = try dev.work(envrionment: env) + let signedMessage = try deserializeV1(serializedData: message) - #expect(message != nil, "If this is nil, I don't knwo what's going on") - #expect(message.signature != nil, "If signature is nil, something is wrong") + print(signedMessage.toString()) + print(signedMessage.signature) + + #expect(signedMessage != nil, "If this is nil, I don't knwo what's going on") + #expect(signedMessage.signature != nil, "If signature is nil, something is wrong") - print(message.description) - print(message.signature) #expect( - try verifySignature( - signature:message.signature, - string: message.toDataCompatibleString(), - key: dev.privateKey.publicKey - ), + try verifyMessageSignature(message: signedMessage, key: privateKey.publicKey) , "Let's see that signatures match" ) } diff --git a/Tests/IoT-Simulator-CoreTests/IoTCore-Tests.swift b/Tests/IoT-Simulator-CoreTests/IoTCore-Tests.swift index 8d958a2..09344c7 100644 --- a/Tests/IoT-Simulator-CoreTests/IoTCore-Tests.swift +++ b/Tests/IoT-Simulator-CoreTests/IoTCore-Tests.swift @@ -1,6 +1,7 @@ import DataAcquisition import Foundation import Testing +import MessageUtils @testable import IoT_Simulator_Core @@ -15,13 +16,13 @@ import Testing let signKeyPath = "./Private/privateKey.pem" - let privateKey = try pem2key(filePath: signKeyPath) + let privateKey = try pem2_P256key(filePath: signKeyPath) let dev: EdgeDevice = EdgeDevice( - deviceID: "EDG-001", + deviceID: 1, dataType: .Temperature, disconnected: false, - location: Location3D(20, 10, 0), + location: Location(x: 20, y: 10, z: 0), dutyCicle: 3000, sensors: [ 0: RealSensor( @@ -38,10 +39,10 @@ import Testing ) let dev2: EdgeDevice = EdgeDevice( - deviceID: "EDG-002", + deviceID: 2, dataType: .Temperature, disconnected: false, - location: Location3D(20, 10, 0), + location: Location(x: 20, y: 10, z: 0), dutyCicle: 1000, sensors: [ 0: RealSensor( @@ -66,7 +67,7 @@ import Testing @Test func stressLoop1() async throws { - let devices: Int = 1000 + let devices: UInt128 = 600 let env = PhysicalEnvironment("Delta") let truth = PhysicalData(.Temperature, 22) @@ -77,15 +78,15 @@ import Testing let signKeyPath = "./Private/privateKey.pem" - let privateKey = try pem2key(filePath: signKeyPath) + let privateKey = try pem2_P256key(filePath: signKeyPath) - for i in 0..