mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 02:25:19 +00:00
Renaming.
This commit is contained in:
parent
dbd8133926
commit
4f46c6317b
@ -1026,10 +1026,10 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
} else if (isRequest && isSecondaryDevice) {
|
||||
Log.w("Loki", "Received a pairing request while being a secondary device. Ignored.");
|
||||
return false;
|
||||
} else if (isRequest && !authorisation.getPrimaryDevicePubKey().equals(ourPubKey)) {
|
||||
} else if (isRequest && !authorisation.getPrimaryDevicePublicKey().equals(ourPubKey)) {
|
||||
Log.w("Loki", "Received a pairing request addressed to another pubkey. Ignored.");
|
||||
return false;
|
||||
} else if (isRequest && authorisation.getSecondaryDevicePubKey().equals(ourPubKey)) {
|
||||
} else if (isRequest && authorisation.getSecondaryDevicePublicKey().equals(ourPubKey)) {
|
||||
Log.w("Loki", "Received a pairing request from ourselves. Ignored.");
|
||||
return false;
|
||||
}
|
||||
@ -1041,7 +1041,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
String ourNumber = TextSecurePreferences.getLocalNumber(context);
|
||||
if (authorisation.getType() == LokiPairingAuthorisation.Type.REQUEST) {
|
||||
handlePairingRequest(authorisation, envelope);
|
||||
} else if (authorisation.getSecondaryDevicePubKey().equals(ourNumber)) {
|
||||
} else if (authorisation.getSecondaryDevicePublicKey().equals(ourNumber)) {
|
||||
// If we were listed as a secondary device, it means we got a confirmation back from the primary device
|
||||
handlePairingAuthorisationForSelf(authorisation, envelope, content);
|
||||
}
|
||||
@ -1076,7 +1076,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
|
||||
// Unimplemented for REQUEST
|
||||
if (authorisation.getType() != LokiPairingAuthorisation.Type.GRANT) { return; }
|
||||
Log.d("Loki", "Receiving pairing authorisation from: " + authorisation.getPrimaryDevicePubKey());
|
||||
Log.d("Loki", "Receiving pairing authorisation from: " + authorisation.getPrimaryDevicePublicKey());
|
||||
|
||||
// Send out accept event
|
||||
LokiDeviceLinkingSession.Companion.getShared().acceptedLinkingRequest(authorisation);
|
||||
@ -1088,7 +1088,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
TextSecurePreferences.setIsSecondaryDevice(context, true);
|
||||
|
||||
// Send a background message to the primary device
|
||||
sendBackgroundMessage(authorisation.getPrimaryDevicePubKey());
|
||||
sendBackgroundMessage(authorisation.getPrimaryDevicePublicKey());
|
||||
|
||||
// Propagate the updates to the file server
|
||||
LokiStorageAPI storageAPI = LokiStorageAPI.Companion.getShared();
|
||||
|
@ -62,9 +62,9 @@ class DeviceLinkingDialog private constructor(private val context: Context, priv
|
||||
|
||||
// Send authorisation message
|
||||
retryIfNeeded(3) {
|
||||
sendAuthorisationMessage(context, pairing.secondaryDevicePubKey, signedAuthorisation)
|
||||
sendAuthorisationMessage(context, pairing.secondaryDevicePublicKey, signedAuthorisation)
|
||||
}.fail {
|
||||
Log.e("Loki", "Failed to send GRANT authorisation to ${pairing.secondaryDevicePubKey}")
|
||||
Log.e("Loki", "Failed to send GRANT authorisation to ${pairing.secondaryDevicePublicKey}")
|
||||
}
|
||||
|
||||
// Add the auth to the database
|
||||
@ -85,7 +85,7 @@ class DeviceLinkingDialog private constructor(private val context: Context, priv
|
||||
if (mode == DeviceLinkingView.Mode.Master && view.pairingAuthorisation != null) {
|
||||
val authorisation = view.pairingAuthorisation!!
|
||||
// Remove pre key bundle from the requesting device
|
||||
DatabaseFactory.getLokiPreKeyBundleDatabase(context).removePreKeyBundle(authorisation.secondaryDevicePubKey)
|
||||
DatabaseFactory.getLokiPreKeyBundleDatabase(context).removePreKeyBundle(authorisation.secondaryDevicePublicKey)
|
||||
}
|
||||
|
||||
delegate?.handleDeviceLinkingDialogDismissed()
|
||||
|
@ -115,7 +115,7 @@ class DeviceLinkingView private constructor(context: Context, attrs: AttributeSe
|
||||
titleTextView.text = resources.getString(R.string.view_device_linking_title_3)
|
||||
explanationTextView.text = resources.getString(R.string.view_device_linking_explanation_2)
|
||||
mnemonicTextView.visibility = View.VISIBLE
|
||||
val hexEncodedPublicKey = authorisation.secondaryDevicePubKey.removing05PrefixIfNeeded()
|
||||
val hexEncodedPublicKey = authorisation.secondaryDevicePublicKey.removing05PrefixIfNeeded()
|
||||
mnemonicTextView.text = MnemonicCodec(languageFileDirectory).encode(hexEncodedPublicKey).split(" ").slice(0 until 3).joinToString(" ")
|
||||
authorizeButton.visibility = View.VISIBLE
|
||||
|
||||
|
@ -166,11 +166,11 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
||||
override fun insertOrUpdatePairingAuthorisation(authorisation: LokiPairingAuthorisation) {
|
||||
val database = databaseHelper.writableDatabase
|
||||
val values = ContentValues()
|
||||
values.put(primaryDevice, authorisation.primaryDevicePubKey)
|
||||
values.put(secondaryDevice, authorisation.secondaryDevicePubKey)
|
||||
values.put(primaryDevice, authorisation.primaryDevicePublicKey)
|
||||
values.put(secondaryDevice, authorisation.secondaryDevicePublicKey)
|
||||
if (authorisation.requestSignature != null) { values.put(requestSignature, Base64.encodeBytes(authorisation.requestSignature)) }
|
||||
if (authorisation.grantSignature != null) { values.put(grantSignature, Base64.encodeBytes(authorisation.grantSignature)) }
|
||||
database.insertOrUpdate(multiDeviceAuthTable, values, "$primaryDevice = ? AND $secondaryDevice = ?", arrayOf(authorisation.primaryDevicePubKey, authorisation.secondaryDevicePubKey))
|
||||
database.insertOrUpdate(multiDeviceAuthTable, values, "$primaryDevice = ? AND $secondaryDevice = ?", arrayOf(authorisation.primaryDevicePublicKey, authorisation.secondaryDevicePublicKey))
|
||||
}
|
||||
|
||||
override fun removePairingAuthorisations(pubKey: String) {
|
||||
|
@ -233,7 +233,7 @@ class SeedActivity : BaseActionBarActivity() {
|
||||
// Send the request to the other user
|
||||
CoroutineScope(Dispatchers.Main).launch {
|
||||
retryIfNeeded(3) {
|
||||
sendAuthorisationMessage(this@SeedActivity, authorisation.primaryDevicePubKey, authorisation).get()
|
||||
sendAuthorisationMessage(this@SeedActivity, authorisation.primaryDevicePublicKey, authorisation).get()
|
||||
}.failUi {
|
||||
dialog.dismiss()
|
||||
resetRegistration()
|
||||
|
Loading…
Reference in New Issue
Block a user