implement channel password management at local and /pass command handling.

This commit is contained in:
alpermelkeli
2025-07-10 18:56:55 +03:00
parent f391b163ee
commit 85f23c23fd
2 changed files with 64 additions and 4 deletions
@@ -284,9 +284,21 @@ class ChannelManager(
state.setShowPasswordPrompt(false)
state.setPasswordPromptChannel(null)
}
fun setChannelPassword(channel: String, password: String): Boolean {
return verifyChannelPassword(channel, password)
fun setChannelPassword(channel: String, password: String) {
channelPasswords[channel] = password
channelKeys[channel] = deriveChannelKey(password, channel)
state.setPasswordProtectedChannels(
state.getPasswordProtectedChannelsValue().toMutableSet().apply { add(channel) }
)
dataManager.saveChannelData(
state.getJoinedChannelsValue(),
state.getPasswordProtectedChannelsValue()
)
}
// MARK: - Emergency Clear