Merge pull request #747 from meshtastic/remove_192bit_channel_keys

Remove 192bit channel keys, fix channel delete bug
This commit is contained in:
Garth Vander Houwen 2024-07-03 11:11:08 -07:00 committed by GitHub
commit f0c343f768
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 15 deletions

View file

@ -196,9 +196,6 @@
},
"128 bit" : {
},
"192 bit" : {
},
"256 bit" : {

View file

@ -154,14 +154,12 @@ struct Channels: View {
var channel = Channel()
channel.index = channelIndex
channel.role = ChannelRoles(rawValue: channelRole)?.protoEnumValue() ?? .secondary
if channel.role != Channel.Role.disabled {
channel.index = channelIndex
channel.settings.name = channelName
channel.settings.psk = Data(base64Encoded: channelKey) ?? Data()
channel.settings.uplinkEnabled = uplink
channel.settings.downlinkEnabled = downlink
channel.settings.moduleSettings.positionPrecision = UInt32(positionPrecision)
selectedChannel!.role = Int32(channelRole)
selectedChannel!.index = channelIndex
selectedChannel!.name = channelName
@ -180,6 +178,7 @@ struct Channels: View {
}
node?.myInfo?.channels = mutableChannels.copy() as? NSOrderedSet
context.refresh(selectedChannel!, mergeChanges: true)
if channel.role != Channel.Role.disabled {
do {
try context.save()
Logger.data.info("💾 Saved Channel: \(channel.settings.name)")
@ -189,19 +188,14 @@ struct Channels: View {
Logger.data.error("Unresolved Core Data error in the channel editor. Error: \(nsError)")
}
} else {
guard let channelEntities = node?.myInfo?.channels as? [ChannelEntity],
let channelEntity = channelEntities.first(where: { $0.index == channelIndex }) else {
return
}
let objects = channelEntity.allPrivateMessages
let objects = selectedChannel?.allPrivateMessages ?? []
for object in objects {
context.delete(object)
}
for node in nodes where node.channel == channelEntity.index {
for node in nodes where node.channel == channel.index {
context.delete(node)
}
context.delete(channelEntity)
context.delete(selectedChannel!)
do {
try context.save()
Logger.data.info("💾 Deleted Channel: \(channel.settings.name)")
@ -211,7 +205,6 @@ struct Channels: View {
Logger.data.error("Unresolved Core Data error in the channel editor. Error: \(nsError)")
}
}
let adminMessageId = bleManager.saveChannel(channel: channel, fromUser: node!.user!, toUser: node!.user!)
if adminMessageId > 0 {

View file

@ -57,7 +57,6 @@ struct ChannelForm: View {
Text("Default").tag(-1)
Text("1 byte").tag(1)
Text("128 bit").tag(16)
Text("192 bit").tag(24)
Text("256 bit").tag(32)
}
.pickerStyle(DefaultPickerStyle())