mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: align channel PSK Base64 flags with other platforms
closes #937
This commit is contained in:
parent
d3d4b960c8
commit
f633ed74cb
1 changed files with 2 additions and 3 deletions
|
|
@ -53,9 +53,8 @@ fun EditChannelDialog(
|
|||
modifier: Modifier = Modifier,
|
||||
modemPresetName: String = "Default",
|
||||
) {
|
||||
val base64Flags = Base64.URL_SAFE + Base64.NO_WRAP
|
||||
fun encodeToString(input: ByteString) =
|
||||
Base64.encodeToString(input.toByteArray() ?: ByteArray(0), base64Flags)
|
||||
Base64.encodeToString(input.toByteArray() ?: ByteArray(0), Base64.DEFAULT)
|
||||
|
||||
var channelInput by remember(channelSettings) { mutableStateOf(channelSettings) }
|
||||
var pskString by remember(channelInput) { mutableStateOf(encodeToString(channelInput.psk)) }
|
||||
|
|
@ -97,7 +96,7 @@ fun EditChannelDialog(
|
|||
onValueChange = {
|
||||
try {
|
||||
pskString = it // empty (no crypto), 128 or 256 bit only
|
||||
val decoded = Base64.decode(it, base64Flags).toByteString()
|
||||
val decoded = Base64.decode(it, Base64.DEFAULT).toByteString()
|
||||
val fullPsk = Channel(channelSettings { psk = decoded }).psk
|
||||
if (fullPsk.size() in setOf(0, 16, 32)) {
|
||||
channelInput = channelInput.copy { psk = decoded }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue