mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
fix: return error early if the public key is not expected length or format with an appropriate message
This commit is contained in:
parent
95657195e6
commit
4f84b976c5
@ -1,5 +1,4 @@
|
|||||||
/*
|
/* Copyright (C) 2013 Open Whisper Systems
|
||||||
* Copyright (C) 2013 Open Whisper Systems
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -29,6 +29,7 @@ import org.session.libsession.utilities.DistributionTypes
|
|||||||
import org.session.libsession.utilities.recipients.Recipient
|
import org.session.libsession.utilities.recipients.Recipient
|
||||||
import org.session.libsession.utilities.GroupUtil
|
import org.session.libsession.utilities.GroupUtil
|
||||||
import org.session.libsignal.utilities.Log
|
import org.session.libsignal.utilities.Log
|
||||||
|
import org.session.libsignal.utilities.PublicKeyValidation
|
||||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||||
import org.thoughtcrime.securesms.conversation.ConversationActivity
|
import org.thoughtcrime.securesms.conversation.ConversationActivity
|
||||||
@ -37,7 +38,6 @@ import org.thoughtcrime.securesms.loki.api.OpenGroupManager
|
|||||||
import org.thoughtcrime.securesms.loki.fragments.ScanQRCodeWrapperFragment
|
import org.thoughtcrime.securesms.loki.fragments.ScanQRCodeWrapperFragment
|
||||||
import org.thoughtcrime.securesms.loki.fragments.ScanQRCodeWrapperFragmentDelegate
|
import org.thoughtcrime.securesms.loki.fragments.ScanQRCodeWrapperFragmentDelegate
|
||||||
import org.thoughtcrime.securesms.loki.protocol.MultiDeviceProtocol
|
import org.thoughtcrime.securesms.loki.protocol.MultiDeviceProtocol
|
||||||
import org.thoughtcrime.securesms.loki.utilities.OpenGroupUtilities
|
|
||||||
import org.thoughtcrime.securesms.loki.viewmodel.DefaultGroupsViewModel
|
import org.thoughtcrime.securesms.loki.viewmodel.DefaultGroupsViewModel
|
||||||
import org.thoughtcrime.securesms.loki.viewmodel.State
|
import org.thoughtcrime.securesms.loki.viewmodel.State
|
||||||
|
|
||||||
@ -86,6 +86,9 @@ class JoinPublicChatActivity : PassphraseRequiredActionBarActivity(), ScanQRCode
|
|||||||
val room = url.pathSegments().firstOrNull()
|
val room = url.pathSegments().firstOrNull()
|
||||||
val publicKey = url.queryParameter("public_key")
|
val publicKey = url.queryParameter("public_key")
|
||||||
val isV2OpenGroup = !room.isNullOrEmpty()
|
val isV2OpenGroup = !room.isNullOrEmpty()
|
||||||
|
if (isV2OpenGroup && (publicKey == null || !PublicKeyValidation.isValid(publicKey, 64,false))) {
|
||||||
|
return Toast.makeText(this, R.string.invalid_public_key, Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
showLoader()
|
showLoader()
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
try {
|
try {
|
||||||
|
@ -842,5 +842,6 @@
|
|||||||
<string name="activity_prompt_passphrase_tap_to_unlock">Tap to Unlock</string>
|
<string name="activity_prompt_passphrase_tap_to_unlock">Tap to Unlock</string>
|
||||||
|
|
||||||
<string name="fragment_user_details_bottom_sheet_edit_text_hint">Enter a nickname</string>
|
<string name="fragment_user_details_bottom_sheet_edit_text_hint">Enter a nickname</string>
|
||||||
|
<string name="invalid_public_key">Invalid Public Key</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user