// NodeInfoEntityToNodeInfo.swift // Meshtastic // // Utility to convert NodeInfoEntity (Core Data) to NodeInfo (protobuf) import Foundation import MeshtasticProtobufs extension NodeInfoEntity { func toProto() -> NodeInfo { var userProto = User() if let user = self.user { userProto.id = user.userId ?? "" userProto.longName = user.longName ?? "" userProto.shortName = user.shortName ?? "" userProto.hwModel = HardwareModel(rawValue: Int(user.hwModelId)) ?? .unset userProto.isLicensed = user.isLicensed userProto.isUnmessagable = false userProto.role = Config.DeviceConfig.Role(rawValue: Int(user.role)) ?? .client userProto.publicKey = user.publicKey?.subdata(in: 0..