mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-30 13:35:18 +00:00
Move files
This commit is contained in:
parent
ce3b32c03e
commit
40d2fd25d9
@ -25,7 +25,7 @@ import org.thoughtcrime.securesms.loki.database.LokiAPIDatabase
|
|||||||
import org.thoughtcrime.securesms.loki.database.LokiBackupFilesDatabase
|
import org.thoughtcrime.securesms.loki.database.LokiBackupFilesDatabase
|
||||||
import org.thoughtcrime.securesms.util.BackupUtil
|
import org.thoughtcrime.securesms.util.BackupUtil
|
||||||
import org.session.libsession.utilities.Util
|
import org.session.libsession.utilities.Util
|
||||||
import org.session.libsignal.libsignal.kdf.HKDFv3
|
import org.session.libsignal.crypto.kdf.HKDFv3
|
||||||
import org.session.libsignal.libsignal.util.ByteUtil
|
import org.session.libsignal.libsignal.util.ByteUtil
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import java.lang.Exception
|
import java.lang.Exception
|
||||||
|
@ -19,7 +19,7 @@ import org.session.libsession.messaging.sending_receiving.attachments.Attachment
|
|||||||
import org.session.libsession.messaging.threads.Address
|
import org.session.libsession.messaging.threads.Address
|
||||||
import org.session.libsession.utilities.Conversions
|
import org.session.libsession.utilities.Conversions
|
||||||
import org.session.libsession.utilities.Util
|
import org.session.libsession.utilities.Util
|
||||||
import org.session.libsignal.libsignal.kdf.HKDFv3
|
import org.session.libsignal.crypto.kdf.HKDFv3
|
||||||
import org.session.libsignal.libsignal.util.ByteUtil
|
import org.session.libsignal.libsignal.util.ByteUtil
|
||||||
|
|
||||||
import java.io.*
|
import java.io.*
|
||||||
|
@ -29,7 +29,7 @@ import org.session.libsession.utilities.GroupUtil
|
|||||||
import org.session.libsession.utilities.IdentityKeyUtil
|
import org.session.libsession.utilities.IdentityKeyUtil
|
||||||
import org.session.libsession.utilities.TextSecurePreferences
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
import org.session.libsession.utilities.preferences.ProfileKeyUtil
|
import org.session.libsession.utilities.preferences.ProfileKeyUtil
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
import org.session.libsignal.libsignal.util.KeyHelper
|
import org.session.libsignal.libsignal.util.KeyHelper
|
||||||
import org.session.libsignal.libsignal.util.guava.Optional
|
import org.session.libsignal.libsignal.util.guava.Optional
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceAttachmentPointer
|
import org.session.libsignal.service.api.messages.SignalServiceAttachmentPointer
|
||||||
|
@ -5,7 +5,7 @@ import androidx.annotation.NonNull;
|
|||||||
|
|
||||||
import org.session.libsession.messaging.utilities.Data;
|
import org.session.libsession.messaging.utilities.Data;
|
||||||
import org.session.libsession.utilities.DownloadUtilities;
|
import org.session.libsession.utilities.DownloadUtilities;
|
||||||
import org.session.libsignal.service.api.crypto.AttachmentCipherInputStream;
|
import org.session.libsignal.streams.AttachmentCipherInputStream;
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
import org.thoughtcrime.securesms.database.GroupDatabase;
|
import org.thoughtcrime.securesms.database.GroupDatabase;
|
||||||
import org.session.libsession.messaging.threads.GroupRecord;
|
import org.session.libsession.messaging.threads.GroupRecord;
|
||||||
|
@ -13,7 +13,7 @@ import org.session.libsession.utilities.DownloadUtilities;
|
|||||||
import org.session.libsession.utilities.TextSecurePreferences;
|
import org.session.libsession.utilities.TextSecurePreferences;
|
||||||
import org.session.libsession.utilities.Util;
|
import org.session.libsession.utilities.Util;
|
||||||
import org.session.libsignal.service.api.SignalServiceMessageReceiver;
|
import org.session.libsignal.service.api.SignalServiceMessageReceiver;
|
||||||
import org.session.libsignal.service.api.crypto.ProfileCipherInputStream;
|
import org.session.libsignal.streams.ProfileCipherInputStream;
|
||||||
import org.session.libsignal.service.api.push.exceptions.PushNetworkException;
|
import org.session.libsignal.service.api.push.exceptions.PushNetworkException;
|
||||||
import org.session.libsignal.utilities.Log;
|
import org.session.libsignal.utilities.Log;
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
|
@ -19,7 +19,7 @@ import com.goterl.lazycode.lazysodium.utils.KeyPair
|
|||||||
import kotlinx.android.synthetic.main.activity_register.*
|
import kotlinx.android.synthetic.main.activity_register.*
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.session.libsession.utilities.TextSecurePreferences
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
import org.session.libsignal.libsignal.util.KeyHelper
|
import org.session.libsignal.libsignal.util.KeyHelper
|
||||||
import org.session.libsignal.service.loki.utilities.hexEncodedPublicKey
|
import org.session.libsignal.service.loki.utilities.hexEncodedPublicKey
|
||||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||||
|
@ -4,9 +4,9 @@ import android.content.ContentValues
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import org.session.libsession.utilities.IdentityKeyUtil
|
import org.session.libsession.utilities.IdentityKeyUtil
|
||||||
import org.session.libsession.utilities.TextSecurePreferences
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
import org.session.libsignal.libsignal.ecc.DjbECPrivateKey
|
import org.session.libsignal.crypto.ecc.DjbECPrivateKey
|
||||||
import org.session.libsignal.libsignal.ecc.DjbECPublicKey
|
import org.session.libsignal.crypto.ecc.DjbECPublicKey
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
import org.session.libsignal.service.loki.Snode
|
import org.session.libsignal.service.loki.Snode
|
||||||
import org.session.libsignal.service.loki.LokiAPIDatabaseProtocol
|
import org.session.libsignal.service.loki.LokiAPIDatabaseProtocol
|
||||||
import org.session.libsignal.service.loki.utilities.PublicKeyValidation
|
import org.session.libsignal.service.loki.utilities.PublicKeyValidation
|
||||||
|
@ -7,9 +7,9 @@ import org.thoughtcrime.securesms.loki.utilities.getAll
|
|||||||
import org.thoughtcrime.securesms.loki.utilities.getString
|
import org.thoughtcrime.securesms.loki.utilities.getString
|
||||||
import org.thoughtcrime.securesms.loki.utilities.insertOrUpdate
|
import org.thoughtcrime.securesms.loki.utilities.insertOrUpdate
|
||||||
import org.session.libsignal.utilities.Hex
|
import org.session.libsignal.utilities.Hex
|
||||||
import org.session.libsignal.libsignal.ecc.DjbECPrivateKey
|
import org.session.libsignal.crypto.ecc.DjbECPrivateKey
|
||||||
import org.session.libsignal.libsignal.ecc.DjbECPublicKey
|
import org.session.libsignal.crypto.ecc.DjbECPublicKey
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
import org.session.libsignal.service.loki.utilities.PublicKeyValidation
|
import org.session.libsignal.service.loki.utilities.PublicKeyValidation
|
||||||
import org.session.libsignal.service.loki.utilities.removing05PrefixIfNeeded
|
import org.session.libsignal.service.loki.utilities.removing05PrefixIfNeeded
|
||||||
import org.session.libsignal.service.loki.utilities.toHexString
|
import org.session.libsignal.service.loki.utilities.toHexString
|
||||||
|
@ -4,9 +4,9 @@ import android.content.Context
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.google.protobuf.ByteString
|
import com.google.protobuf.ByteString
|
||||||
import org.session.libsession.messaging.sending_receiving.*
|
import org.session.libsession.messaging.sending_receiving.*
|
||||||
import org.session.libsignal.libsignal.ecc.DjbECPrivateKey
|
import org.session.libsignal.crypto.ecc.DjbECPrivateKey
|
||||||
import org.session.libsignal.libsignal.ecc.DjbECPublicKey
|
import org.session.libsignal.crypto.ecc.DjbECPublicKey
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceGroup
|
import org.session.libsignal.service.api.messages.SignalServiceGroup
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.DataMessage
|
import org.session.libsignal.service.internal.push.SignalServiceProtos.DataMessage
|
||||||
|
@ -9,7 +9,7 @@ import com.bumptech.glide.load.data.DataFetcher;
|
|||||||
import org.session.libsignal.utilities.Log;
|
import org.session.libsignal.utilities.Log;
|
||||||
import org.session.libsignal.libsignal.InvalidMessageException;
|
import org.session.libsignal.libsignal.InvalidMessageException;
|
||||||
import org.session.libsignal.libsignal.util.guava.Optional;
|
import org.session.libsignal.libsignal.util.guava.Optional;
|
||||||
import org.session.libsignal.service.api.crypto.AttachmentCipherInputStream;
|
import org.session.libsignal.streams.AttachmentCipherInputStream;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -19,7 +19,7 @@ import org.session.libsession.messaging.sending_receiving.quotes.QuoteModel
|
|||||||
import org.session.libsession.messaging.threads.Address
|
import org.session.libsession.messaging.threads.Address
|
||||||
import org.session.libsession.messaging.threads.GroupRecord
|
import org.session.libsession.messaging.threads.GroupRecord
|
||||||
import org.session.libsession.messaging.threads.recipients.Recipient.RecipientSettings
|
import org.session.libsession.messaging.threads.recipients.Recipient.RecipientSettings
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceAttachmentPointer
|
import org.session.libsignal.service.api.messages.SignalServiceAttachmentPointer
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceGroup
|
import org.session.libsignal.service.api.messages.SignalServiceGroup
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import org.session.libsession.messaging.sending_receiving.attachments.Attachment
|
|||||||
import org.session.libsession.messaging.utilities.Data
|
import org.session.libsession.messaging.utilities.Data
|
||||||
import org.session.libsession.messaging.utilities.DotNetAPI
|
import org.session.libsession.messaging.utilities.DotNetAPI
|
||||||
import org.session.libsession.utilities.DownloadUtilities
|
import org.session.libsession.utilities.DownloadUtilities
|
||||||
import org.session.libsignal.service.api.crypto.AttachmentCipherInputStream
|
import org.session.libsignal.streams.AttachmentCipherInputStream
|
||||||
import org.session.libsignal.utilities.Base64
|
import org.session.libsignal.utilities.Base64
|
||||||
import org.session.libsignal.utilities.Log
|
import org.session.libsignal.utilities.Log
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
@ -13,14 +13,14 @@ import org.session.libsession.messaging.open_groups.OpenGroupAPIV2
|
|||||||
import org.session.libsession.messaging.sending_receiving.MessageSender
|
import org.session.libsession.messaging.sending_receiving.MessageSender
|
||||||
import org.session.libsession.messaging.utilities.Data
|
import org.session.libsession.messaging.utilities.Data
|
||||||
import org.session.libsession.messaging.utilities.DotNetAPI
|
import org.session.libsession.messaging.utilities.DotNetAPI
|
||||||
import org.session.libsignal.service.api.crypto.AttachmentCipherOutputStream
|
import org.session.libsignal.streams.AttachmentCipherOutputStream
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceAttachmentStream
|
import org.session.libsignal.service.api.messages.SignalServiceAttachmentStream
|
||||||
import org.session.libsignal.service.internal.crypto.PaddingInputStream
|
import org.session.libsignal.streams.PaddingInputStream
|
||||||
import org.session.libsignal.service.internal.push.PushAttachmentData
|
import org.session.libsignal.service.internal.push.PushAttachmentData
|
||||||
import org.session.libsignal.service.internal.push.http.AttachmentCipherOutputStreamFactory
|
import org.session.libsignal.service.internal.push.http.AttachmentCipherOutputStreamFactory
|
||||||
import org.session.libsignal.service.internal.push.http.DigestingRequestBody
|
import org.session.libsignal.service.internal.push.http.DigestingRequestBody
|
||||||
import org.session.libsignal.service.internal.util.Util
|
import org.session.libsignal.service.internal.util.Util
|
||||||
import org.session.libsignal.service.loki.PlaintextOutputStreamFactory
|
import org.session.libsignal.streams.PlaintextOutputStreamFactory
|
||||||
import org.session.libsignal.utilities.Log
|
import org.session.libsignal.utilities.Log
|
||||||
|
|
||||||
class AttachmentUploadJob(val attachmentID: Long, val threadID: String, val message: Message, val messageSendJobID: String) : Job {
|
class AttachmentUploadJob(val attachmentID: Long, val threadID: String, val message: Message, val messageSendJobID: String) : Job {
|
||||||
|
@ -5,9 +5,9 @@ import org.session.libsession.messaging.MessagingModuleConfiguration
|
|||||||
import org.session.libsession.messaging.threads.Address
|
import org.session.libsession.messaging.threads.Address
|
||||||
import org.session.libsession.messaging.threads.recipients.Recipient
|
import org.session.libsession.messaging.threads.recipients.Recipient
|
||||||
import org.session.libsession.utilities.GroupUtil
|
import org.session.libsession.utilities.GroupUtil
|
||||||
import org.session.libsignal.libsignal.ecc.DjbECPrivateKey
|
import org.session.libsignal.crypto.ecc.DjbECPrivateKey
|
||||||
import org.session.libsignal.libsignal.ecc.DjbECPublicKey
|
import org.session.libsignal.crypto.ecc.DjbECPublicKey
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.DataMessage
|
import org.session.libsignal.service.internal.push.SignalServiceProtos.DataMessage
|
||||||
import org.session.libsignal.service.loki.utilities.removing05PrefixIfNeeded
|
import org.session.libsignal.service.loki.utilities.removing05PrefixIfNeeded
|
||||||
|
@ -6,9 +6,9 @@ import org.session.libsession.messaging.threads.Address
|
|||||||
import org.session.libsession.utilities.GroupUtil
|
import org.session.libsession.utilities.GroupUtil
|
||||||
import org.session.libsession.utilities.TextSecurePreferences
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
import org.session.libsession.utilities.preferences.ProfileKeyUtil
|
import org.session.libsession.utilities.preferences.ProfileKeyUtil
|
||||||
import org.session.libsignal.libsignal.ecc.DjbECPrivateKey
|
import org.session.libsignal.crypto.ecc.DjbECPrivateKey
|
||||||
import org.session.libsignal.libsignal.ecc.DjbECPublicKey
|
import org.session.libsignal.crypto.ecc.DjbECPublicKey
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
||||||
import org.session.libsignal.service.loki.utilities.removing05PrefixIfNeeded
|
import org.session.libsignal.service.loki.utilities.removing05PrefixIfNeeded
|
||||||
import org.session.libsignal.service.loki.utilities.toHexString
|
import org.session.libsignal.service.loki.utilities.toHexString
|
||||||
|
@ -5,7 +5,7 @@ import com.goterl.lazycode.lazysodium.LazySodiumAndroid
|
|||||||
import com.goterl.lazycode.lazysodium.SodiumAndroid
|
import com.goterl.lazycode.lazysodium.SodiumAndroid
|
||||||
import com.goterl.lazycode.lazysodium.interfaces.Box
|
import com.goterl.lazycode.lazysodium.interfaces.Box
|
||||||
import com.goterl.lazycode.lazysodium.interfaces.Sign
|
import com.goterl.lazycode.lazysodium.interfaces.Sign
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
import org.session.libsignal.service.loki.utilities.hexEncodedPublicKey
|
import org.session.libsignal.service.loki.utilities.hexEncodedPublicKey
|
||||||
import org.session.libsignal.service.loki.utilities.removing05PrefixIfNeeded
|
import org.session.libsignal.service.loki.utilities.removing05PrefixIfNeeded
|
||||||
import org.session.libsignal.service.loki.utilities.toHexString
|
import org.session.libsignal.service.loki.utilities.toHexString
|
||||||
|
@ -12,8 +12,8 @@ import org.session.libsession.messaging.sending_receiving.notifications.PushNoti
|
|||||||
import org.session.libsession.messaging.threads.Address
|
import org.session.libsession.messaging.threads.Address
|
||||||
import org.session.libsession.utilities.GroupUtil
|
import org.session.libsession.utilities.GroupUtil
|
||||||
import org.session.libsession.utilities.TextSecurePreferences
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
import org.session.libsignal.libsignal.ecc.Curve
|
import org.session.libsignal.crypto.ecc.Curve
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
import org.session.libsignal.libsignal.util.guava.Optional
|
import org.session.libsignal.libsignal.util.guava.Optional
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceGroup
|
import org.session.libsignal.service.api.messages.SignalServiceGroup
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
||||||
|
@ -20,9 +20,9 @@ import org.session.libsession.utilities.GroupUtil
|
|||||||
import org.session.libsession.utilities.SSKEnvironment
|
import org.session.libsession.utilities.SSKEnvironment
|
||||||
import org.session.libsession.utilities.TextSecurePreferences
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
import org.session.libsession.utilities.preferences.ProfileKeyUtil
|
import org.session.libsession.utilities.preferences.ProfileKeyUtil
|
||||||
import org.session.libsignal.libsignal.ecc.DjbECPrivateKey
|
import org.session.libsignal.crypto.ecc.DjbECPrivateKey
|
||||||
import org.session.libsignal.libsignal.ecc.DjbECPublicKey
|
import org.session.libsignal.crypto.ecc.DjbECPublicKey
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
import org.session.libsignal.libsignal.util.guava.Optional
|
import org.session.libsignal.libsignal.util.guava.Optional
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceGroup
|
import org.session.libsignal.service.api.messages.SignalServiceGroup
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
||||||
|
@ -11,7 +11,7 @@ import org.session.libsession.snode.OnionRequestAPI
|
|||||||
import org.session.libsession.messaging.file_server.FileServerAPI
|
import org.session.libsession.messaging.file_server.FileServerAPI
|
||||||
|
|
||||||
import org.session.libsignal.crypto.DiffieHellman
|
import org.session.libsignal.crypto.DiffieHellman
|
||||||
import org.session.libsignal.service.api.crypto.ProfileCipherOutputStream
|
import org.session.libsignal.streams.ProfileCipherOutputStream
|
||||||
import org.session.libsignal.service.api.push.exceptions.NonSuccessfulResponseCodeException
|
import org.session.libsignal.service.api.push.exceptions.NonSuccessfulResponseCodeException
|
||||||
import org.session.libsignal.service.api.push.exceptions.PushNetworkException
|
import org.session.libsignal.service.api.push.exceptions.PushNetworkException
|
||||||
import org.session.libsignal.service.api.util.StreamDetails
|
import org.session.libsignal.service.api.util.StreamDetails
|
||||||
|
@ -22,13 +22,13 @@ import android.content.SharedPreferences;
|
|||||||
import android.content.SharedPreferences.Editor;
|
import android.content.SharedPreferences.Editor;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import org.session.libsignal.libsignal.ecc.ECPublicKey;
|
import org.session.libsignal.crypto.ecc.ECPublicKey;
|
||||||
import org.session.libsignal.libsignal.IdentityKey;
|
import org.session.libsignal.libsignal.IdentityKey;
|
||||||
import org.session.libsignal.libsignal.IdentityKeyPair;
|
import org.session.libsignal.libsignal.IdentityKeyPair;
|
||||||
import org.session.libsignal.libsignal.InvalidKeyException;
|
import org.session.libsignal.libsignal.InvalidKeyException;
|
||||||
import org.session.libsignal.libsignal.ecc.Curve;
|
import org.session.libsignal.crypto.ecc.Curve;
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair;
|
import org.session.libsignal.crypto.ecc.ECKeyPair;
|
||||||
import org.session.libsignal.libsignal.ecc.ECPrivateKey;
|
import org.session.libsignal.crypto.ecc.ECPrivateKey;
|
||||||
|
|
||||||
import org.session.libsignal.utilities.Base64;
|
import org.session.libsignal.utilities.Base64;
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@ import com.goterl.lazycode.lazysodium.utils.Key
|
|||||||
import com.goterl.lazycode.lazysodium.utils.KeyPair
|
import com.goterl.lazycode.lazysodium.utils.KeyPair
|
||||||
import org.session.libsignal.utilities.Base64
|
import org.session.libsignal.utilities.Base64
|
||||||
import org.session.libsignal.utilities.Hex
|
import org.session.libsignal.utilities.Hex
|
||||||
import org.session.libsignal.libsignal.ecc.DjbECPrivateKey
|
import org.session.libsignal.crypto.ecc.DjbECPrivateKey
|
||||||
import org.session.libsignal.libsignal.ecc.DjbECPublicKey
|
import org.session.libsignal.crypto.ecc.DjbECPublicKey
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
|
|
||||||
object KeyPairUtilities {
|
object KeyPairUtilities {
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import nl.komponents.kovenant.deferred
|
|||||||
import okio.Buffer
|
import okio.Buffer
|
||||||
import org.session.libsession.messaging.file_server.FileServerAPIV2
|
import org.session.libsession.messaging.file_server.FileServerAPIV2
|
||||||
import org.session.libsession.utilities.preferences.ProfileKeyUtil
|
import org.session.libsession.utilities.preferences.ProfileKeyUtil
|
||||||
import org.session.libsignal.service.api.crypto.ProfileCipherOutputStream
|
import org.session.libsignal.streams.ProfileCipherOutputStream
|
||||||
import org.session.libsignal.service.internal.push.ProfileAvatarData
|
import org.session.libsignal.service.internal.push.ProfileAvatarData
|
||||||
import org.session.libsignal.service.internal.push.http.DigestingRequestBody
|
import org.session.libsignal.service.internal.push.http.DigestingRequestBody
|
||||||
import org.session.libsignal.service.internal.push.http.ProfileCipherOutputStreamFactory
|
import org.session.libsignal.service.internal.push.http.ProfileCipherOutputStreamFactory
|
||||||
|
@ -3,12 +3,11 @@
|
|||||||
*
|
*
|
||||||
* Licensed according to the LICENSE file in this repository.
|
* Licensed according to the LICENSE file in this repository.
|
||||||
*/
|
*/
|
||||||
package org.session.libsignal.libsignal.ecc;
|
package org.session.libsignal.crypto.ecc;
|
||||||
|
|
||||||
import org.whispersystems.curve25519.Curve25519;
|
import org.whispersystems.curve25519.Curve25519;
|
||||||
import org.whispersystems.curve25519.Curve25519KeyPair;
|
import org.whispersystems.curve25519.Curve25519KeyPair;
|
||||||
import org.session.libsignal.libsignal.InvalidKeyException;
|
import org.session.libsignal.libsignal.InvalidKeyException;
|
||||||
|
|
||||||
import static org.whispersystems.curve25519.Curve25519.BEST;
|
import static org.whispersystems.curve25519.Curve25519.BEST;
|
||||||
|
|
||||||
public class Curve {
|
public class Curve {
|
@ -4,7 +4,7 @@
|
|||||||
* Licensed according to the LICENSE file in this repository.
|
* Licensed according to the LICENSE file in this repository.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.session.libsignal.libsignal.ecc;
|
package org.session.libsignal.crypto.ecc;
|
||||||
|
|
||||||
public class DjbECPrivateKey implements ECPrivateKey {
|
public class DjbECPrivateKey implements ECPrivateKey {
|
||||||
|
|
@ -4,10 +4,9 @@
|
|||||||
* Licensed according to the LICENSE file in this repository.
|
* Licensed according to the LICENSE file in this repository.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.session.libsignal.libsignal.ecc;
|
package org.session.libsignal.crypto.ecc;
|
||||||
|
|
||||||
import org.session.libsignal.libsignal.util.ByteUtil;
|
import org.session.libsignal.libsignal.util.ByteUtil;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Licensed according to the LICENSE file in this repository.
|
* Licensed according to the LICENSE file in this repository.
|
||||||
*/
|
*/
|
||||||
package org.session.libsignal.libsignal.ecc;
|
package org.session.libsignal.crypto.ecc;
|
||||||
|
|
||||||
public class ECKeyPair {
|
public class ECKeyPair {
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
* Licensed according to the LICENSE file in this repository.
|
* Licensed according to the LICENSE file in this repository.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.session.libsignal.libsignal.ecc;
|
package org.session.libsignal.crypto.ecc;
|
||||||
|
|
||||||
public interface ECPrivateKey {
|
public interface ECPrivateKey {
|
||||||
public byte[] serialize();
|
public byte[] serialize();
|
@ -4,7 +4,7 @@
|
|||||||
* Licensed according to the LICENSE file in this repository.
|
* Licensed according to the LICENSE file in this repository.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.session.libsignal.libsignal.ecc;
|
package org.session.libsignal.crypto.ecc;
|
||||||
|
|
||||||
public interface ECPublicKey extends Comparable<ECPublicKey> {
|
public interface ECPublicKey extends Comparable<ECPublicKey> {
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
* Licensed according to the LICENSE file in this repository.
|
* Licensed according to the LICENSE file in this repository.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.session.libsignal.libsignal.kdf;
|
package org.session.libsignal.crypto.kdf;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Licensed according to the LICENSE file in this repository.
|
* Licensed according to the LICENSE file in this repository.
|
||||||
*/
|
*/
|
||||||
package org.session.libsignal.libsignal.kdf;
|
package org.session.libsignal.crypto.kdf;
|
||||||
|
|
||||||
public class HKDFv3 extends HKDF {
|
public class HKDFv3 extends HKDF {
|
||||||
@Override
|
@Override
|
@ -6,8 +6,8 @@
|
|||||||
package org.session.libsignal.libsignal;
|
package org.session.libsignal.libsignal;
|
||||||
|
|
||||||
|
|
||||||
import org.session.libsignal.libsignal.ecc.Curve;
|
import org.session.libsignal.crypto.ecc.Curve;
|
||||||
import org.session.libsignal.libsignal.ecc.ECPublicKey;
|
import org.session.libsignal.crypto.ecc.ECPublicKey;
|
||||||
import org.session.libsignal.utilities.Hex;
|
import org.session.libsignal.utilities.Hex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.session.libsignal.libsignal;
|
package org.session.libsignal.libsignal;
|
||||||
|
|
||||||
import org.session.libsignal.libsignal.ecc.ECPrivateKey;
|
import org.session.libsignal.crypto.ecc.ECPrivateKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holder for public and private identity key pair.
|
* Holder for public and private identity key pair.
|
||||||
|
@ -7,14 +7,11 @@
|
|||||||
package org.session.libsignal.service.api;
|
package org.session.libsignal.service.api;
|
||||||
|
|
||||||
import org.session.libsignal.libsignal.InvalidMessageException;
|
import org.session.libsignal.libsignal.InvalidMessageException;
|
||||||
import org.session.libsignal.service.api.crypto.AttachmentCipherInputStream;
|
|
||||||
import org.session.libsignal.service.api.crypto.ProfileCipherInputStream;
|
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceAttachment.ProgressListener;
|
import org.session.libsignal.service.api.messages.SignalServiceAttachment.ProgressListener;
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceAttachmentPointer;
|
import org.session.libsignal.service.api.messages.SignalServiceAttachmentPointer;
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceDataMessage;
|
import org.session.libsignal.service.api.messages.SignalServiceDataMessage;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
@ -1,336 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2014-2016 Open Whisper Systems
|
|
||||||
*
|
|
||||||
* Licensed according to the LICENSE file in this repository.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.session.libsignal.service.api.crypto;
|
|
||||||
|
|
||||||
import com.google.protobuf.InvalidProtocolBufferException;
|
|
||||||
|
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair;
|
|
||||||
import org.session.libsignal.metadata.InvalidMetadataMessageException;
|
|
||||||
import org.session.libsignal.metadata.ProtocolInvalidMessageException;
|
|
||||||
import org.session.libsignal.libsignal.InvalidMessageException;
|
|
||||||
import org.session.libsignal.libsignal.util.guava.Optional;
|
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceAttachment;
|
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceAttachmentPointer;
|
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceContent;
|
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceDataMessage;
|
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceDataMessage.Preview;
|
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceEnvelope;
|
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceGroup;
|
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceReceiptMessage;
|
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceTypingMessage;
|
|
||||||
import org.session.libsignal.service.api.push.SignalServiceAddress;
|
|
||||||
import org.session.libsignal.service.internal.push.PushTransportDetails;
|
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos;
|
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.AttachmentPointer;
|
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.DataMessage.ClosedGroupControlMessage;
|
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.Content;
|
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.DataMessage;
|
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.ReceiptMessage;
|
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.TypingMessage;
|
|
||||||
import org.session.libsignal.service.loki.LokiAPIDatabaseProtocol;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static org.session.libsignal.service.internal.push.SignalServiceProtos.GroupContext.Type.DELIVER;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is used to decrypt received {@link SignalServiceEnvelope}s.
|
|
||||||
*
|
|
||||||
* @author Moxie Marlinspike
|
|
||||||
*/
|
|
||||||
public class SignalServiceCipher {
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private static final String TAG = SignalServiceCipher.class.getSimpleName();
|
|
||||||
|
|
||||||
private final LokiAPIDatabaseProtocol apiDB;
|
|
||||||
|
|
||||||
public SignalServiceCipher(LokiAPIDatabaseProtocol apiDB)
|
|
||||||
{
|
|
||||||
this.apiDB = apiDB;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decrypt a received {@link SignalServiceEnvelope}
|
|
||||||
*
|
|
||||||
* @param envelope The received SignalServiceEnvelope
|
|
||||||
*
|
|
||||||
* @return a decrypted SignalServiceContent
|
|
||||||
*/
|
|
||||||
public SignalServiceContent decrypt(SignalServiceEnvelope envelope) throws InvalidMetadataMessageException,ProtocolInvalidMessageException
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
Plaintext plaintext = decrypt(envelope, envelope.getContent());
|
|
||||||
Content message = Content.parseFrom(plaintext.getData());
|
|
||||||
|
|
||||||
if (message.hasConfigurationMessage()) {
|
|
||||||
SignalServiceCipher.Metadata metadata = plaintext.getMetadata();
|
|
||||||
SignalServiceContent content = new SignalServiceContent(message, metadata.getSender(), metadata.getSenderDevice(), metadata.getTimestamp());
|
|
||||||
|
|
||||||
if (message.hasDataMessage()) {
|
|
||||||
setProfile(message.getDataMessage(), content);
|
|
||||||
SignalServiceDataMessage signalServiceDataMessage = createSignalServiceMessage(metadata, message.getDataMessage());
|
|
||||||
content.setDataMessage(signalServiceDataMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
return content;
|
|
||||||
} else if (message.hasDataMessage()) {
|
|
||||||
DataMessage dataMessage = message.getDataMessage();
|
|
||||||
|
|
||||||
SignalServiceDataMessage signalServiceDataMessage = createSignalServiceMessage(plaintext.getMetadata(), dataMessage);
|
|
||||||
SignalServiceContent content = new SignalServiceContent(signalServiceDataMessage,
|
|
||||||
plaintext.getMetadata().getSender(),
|
|
||||||
plaintext.getMetadata().getSenderDevice(),
|
|
||||||
plaintext.getMetadata().getTimestamp(),
|
|
||||||
plaintext.getMetadata().isNeedsReceipt());
|
|
||||||
|
|
||||||
setProfile(dataMessage, content);
|
|
||||||
|
|
||||||
return content;
|
|
||||||
} else if (message.hasReceiptMessage()) {
|
|
||||||
return new SignalServiceContent(createReceiptMessage(plaintext.getMetadata(), message.getReceiptMessage()),
|
|
||||||
plaintext.getMetadata().getSender(),
|
|
||||||
plaintext.getMetadata().getSenderDevice(),
|
|
||||||
plaintext.getMetadata().getTimestamp());
|
|
||||||
} else if (message.hasTypingMessage()) {
|
|
||||||
return new SignalServiceContent(createTypingMessage(plaintext.getMetadata(), message.getTypingMessage()),
|
|
||||||
plaintext.getMetadata().getSender(),
|
|
||||||
plaintext.getMetadata().getSenderDevice(),
|
|
||||||
plaintext.getMetadata().getTimestamp());
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
} catch (InvalidProtocolBufferException e) {
|
|
||||||
throw new InvalidMetadataMessageException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setProfile(DataMessage message, SignalServiceContent content) {
|
|
||||||
if (!message.hasProfile()) { return; }
|
|
||||||
SignalServiceProtos.DataMessage.LokiProfile profile = message.getProfile();
|
|
||||||
if (profile.hasDisplayName()) { content.setSenderDisplayName(profile.getDisplayName()); }
|
|
||||||
if (profile.hasProfilePicture()) { content.setSenderProfilePictureURL(profile.getProfilePicture()); }
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Plaintext decrypt(SignalServiceEnvelope envelope, byte[] ciphertext) throws InvalidMetadataMessageException
|
|
||||||
{
|
|
||||||
throw new IllegalStateException("This shouldn't be used anymore");
|
|
||||||
}
|
|
||||||
|
|
||||||
private SignalServiceDataMessage createSignalServiceMessage(Metadata metadata, DataMessage content) throws ProtocolInvalidMessageException {
|
|
||||||
SignalServiceGroup groupInfo = createGroupInfo(content);
|
|
||||||
List<SignalServiceAttachment> attachments = new LinkedList<SignalServiceAttachment>();
|
|
||||||
boolean expirationUpdate = ((content.getFlags() & DataMessage.Flags.EXPIRATION_TIMER_UPDATE_VALUE) != 0);
|
|
||||||
SignalServiceDataMessage.Quote quote = createQuote(content);
|
|
||||||
List<Preview> previews = createPreviews(content);
|
|
||||||
ClosedGroupControlMessage closedGroupControlMessage = content.getClosedGroupControlMessage();
|
|
||||||
String syncTarget = content.getSyncTarget();
|
|
||||||
|
|
||||||
for (AttachmentPointer pointer : content.getAttachmentsList()) {
|
|
||||||
attachments.add(createAttachmentPointer(pointer));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (content.hasTimestamp() && content.getTimestamp() != metadata.getTimestamp()) {
|
|
||||||
throw new ProtocolInvalidMessageException(new InvalidMessageException("Timestamps don't match: " + content.getTimestamp() + " vs " + metadata.getTimestamp()),
|
|
||||||
metadata.getSender(),
|
|
||||||
metadata.getSenderDevice());
|
|
||||||
}
|
|
||||||
|
|
||||||
return new SignalServiceDataMessage(metadata.getTimestamp(),
|
|
||||||
groupInfo,
|
|
||||||
attachments,
|
|
||||||
content.getBody(),
|
|
||||||
content.getExpireTimer(),
|
|
||||||
expirationUpdate,
|
|
||||||
content.hasProfileKey() ? content.getProfileKey().toByteArray() : null,
|
|
||||||
quote,
|
|
||||||
new ArrayList<>(),
|
|
||||||
previews,
|
|
||||||
closedGroupControlMessage,
|
|
||||||
syncTarget);
|
|
||||||
}
|
|
||||||
|
|
||||||
private SignalServiceReceiptMessage createReceiptMessage(Metadata metadata, ReceiptMessage content) {
|
|
||||||
SignalServiceReceiptMessage.Type type;
|
|
||||||
|
|
||||||
if (content.getType() == ReceiptMessage.Type.DELIVERY) type = SignalServiceReceiptMessage.Type.DELIVERY;
|
|
||||||
else if (content.getType() == ReceiptMessage.Type.READ) type = SignalServiceReceiptMessage.Type.READ;
|
|
||||||
else type = SignalServiceReceiptMessage.Type.UNKNOWN;
|
|
||||||
|
|
||||||
return new SignalServiceReceiptMessage(type, content.getTimestampList(), metadata.getTimestamp());
|
|
||||||
}
|
|
||||||
|
|
||||||
private SignalServiceTypingMessage createTypingMessage(Metadata metadata, TypingMessage content) throws ProtocolInvalidMessageException {
|
|
||||||
SignalServiceTypingMessage.Action action;
|
|
||||||
|
|
||||||
if (content.getAction() == TypingMessage.Action.STARTED) action = SignalServiceTypingMessage.Action.STARTED;
|
|
||||||
else if (content.getAction() == TypingMessage.Action.STOPPED) action = SignalServiceTypingMessage.Action.STOPPED;
|
|
||||||
else action = SignalServiceTypingMessage.Action.UNKNOWN;
|
|
||||||
|
|
||||||
if (content.hasTimestamp() && content.getTimestamp() != metadata.getTimestamp()) {
|
|
||||||
throw new ProtocolInvalidMessageException(new InvalidMessageException("Timestamps don't match: " + content.getTimestamp() + " vs " + metadata.getTimestamp()),
|
|
||||||
metadata.getSender(),
|
|
||||||
metadata.getSenderDevice());
|
|
||||||
}
|
|
||||||
|
|
||||||
return new SignalServiceTypingMessage(action, content.getTimestamp());
|
|
||||||
}
|
|
||||||
|
|
||||||
private SignalServiceDataMessage.Quote createQuote(DataMessage content) {
|
|
||||||
if (!content.hasQuote()) return null;
|
|
||||||
|
|
||||||
List<SignalServiceDataMessage.Quote.QuotedAttachment> attachments = new LinkedList<SignalServiceDataMessage.Quote.QuotedAttachment>();
|
|
||||||
|
|
||||||
for (DataMessage.Quote.QuotedAttachment attachment : content.getQuote().getAttachmentsList()) {
|
|
||||||
attachments.add(new SignalServiceDataMessage.Quote.QuotedAttachment(attachment.getContentType(),
|
|
||||||
attachment.getFileName(),
|
|
||||||
attachment.hasThumbnail() ? createAttachmentPointer(attachment.getThumbnail()) : null));
|
|
||||||
}
|
|
||||||
|
|
||||||
return new SignalServiceDataMessage.Quote(content.getQuote().getId(),
|
|
||||||
new SignalServiceAddress(content.getQuote().getAuthor()),
|
|
||||||
content.getQuote().getText(),
|
|
||||||
attachments);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Preview> createPreviews(DataMessage content) {
|
|
||||||
if (content.getPreviewCount() <= 0) return null;
|
|
||||||
|
|
||||||
List<Preview> results = new LinkedList<Preview>();
|
|
||||||
|
|
||||||
for (DataMessage.Preview preview : content.getPreviewList()) {
|
|
||||||
SignalServiceAttachment attachment = null;
|
|
||||||
|
|
||||||
if (preview.hasImage()) {
|
|
||||||
attachment = createAttachmentPointer(preview.getImage());
|
|
||||||
}
|
|
||||||
|
|
||||||
results.add(new Preview(preview.getUrl(),
|
|
||||||
preview.getTitle(),
|
|
||||||
Optional.fromNullable(attachment)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SignalServiceAttachmentPointer createAttachmentPointer(AttachmentPointer pointer) {
|
|
||||||
return new SignalServiceAttachmentPointer(pointer.getId(),
|
|
||||||
pointer.getContentType(),
|
|
||||||
pointer.getKey().toByteArray(),
|
|
||||||
pointer.hasSize() ? Optional.of(pointer.getSize()) : Optional.<Integer>absent(),
|
|
||||||
pointer.hasThumbnail() ? Optional.of(pointer.getThumbnail().toByteArray()): Optional.<byte[]>absent(),
|
|
||||||
pointer.getWidth(), pointer.getHeight(),
|
|
||||||
pointer.hasDigest() ? Optional.of(pointer.getDigest().toByteArray()) : Optional.<byte[]>absent(),
|
|
||||||
pointer.hasFileName() ? Optional.of(pointer.getFileName()) : Optional.<String>absent(),
|
|
||||||
(pointer.getFlags() & AttachmentPointer.Flags.VOICE_MESSAGE_VALUE) != 0,
|
|
||||||
pointer.hasCaption() ? Optional.of(pointer.getCaption()) : Optional.<String>absent(),
|
|
||||||
pointer.getUrl());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private SignalServiceGroup createGroupInfo(DataMessage content) {
|
|
||||||
if (!content.hasGroup()) return null;
|
|
||||||
|
|
||||||
SignalServiceGroup.Type type;
|
|
||||||
|
|
||||||
switch (content.getGroup().getType()) {
|
|
||||||
case DELIVER: type = SignalServiceGroup.Type.DELIVER; break;
|
|
||||||
case UPDATE: type = SignalServiceGroup.Type.UPDATE; break;
|
|
||||||
case QUIT: type = SignalServiceGroup.Type.QUIT; break;
|
|
||||||
case REQUEST_INFO: type = SignalServiceGroup.Type.REQUEST_INFO; break;
|
|
||||||
default: type = SignalServiceGroup.Type.UNKNOWN; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (content.getGroup().getType() != DELIVER) {
|
|
||||||
String name = null;
|
|
||||||
List<String> members = null;
|
|
||||||
SignalServiceAttachmentPointer avatar = null;
|
|
||||||
List<String> admins = null;
|
|
||||||
|
|
||||||
if (content.getGroup().hasName()) {
|
|
||||||
name = content.getGroup().getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (content.getGroup().getMembersCount() > 0) {
|
|
||||||
members = content.getGroup().getMembersList();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (content.getGroup().hasAvatar()) {
|
|
||||||
AttachmentPointer pointer = content.getGroup().getAvatar();
|
|
||||||
|
|
||||||
avatar = new SignalServiceAttachmentPointer(pointer.getId(),
|
|
||||||
pointer.getContentType(),
|
|
||||||
pointer.getKey().toByteArray(),
|
|
||||||
Optional.of(pointer.getSize()),
|
|
||||||
Optional.<byte[]>absent(), 0, 0,
|
|
||||||
Optional.fromNullable(pointer.hasDigest() ? pointer.getDigest().toByteArray() : null),
|
|
||||||
Optional.<String>absent(),
|
|
||||||
false,
|
|
||||||
Optional.<String>absent(),
|
|
||||||
pointer.getUrl());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (content.getGroup().getAdminsCount() > 0) {
|
|
||||||
admins = content.getGroup().getAdminsList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new SignalServiceGroup(type, content.getGroup().getId().toByteArray(), SignalServiceGroup.GroupType.SIGNAL, name, members, avatar, admins);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new SignalServiceGroup(content.getGroup().getId().toByteArray(), SignalServiceGroup.GroupType.SIGNAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static class Metadata {
|
|
||||||
private final String sender;
|
|
||||||
private final int senderDevice;
|
|
||||||
private final long timestamp;
|
|
||||||
private final boolean needsReceipt;
|
|
||||||
|
|
||||||
public Metadata(String sender, int senderDevice, long timestamp, boolean needsReceipt) {
|
|
||||||
this.sender = sender;
|
|
||||||
this.senderDevice = senderDevice;
|
|
||||||
this.timestamp = timestamp;
|
|
||||||
this.needsReceipt = needsReceipt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSender() {
|
|
||||||
return sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSenderDevice() {
|
|
||||||
return senderDevice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTimestamp() {
|
|
||||||
return timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNeedsReceipt() {
|
|
||||||
return needsReceipt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static class Plaintext {
|
|
||||||
private final Metadata metadata;
|
|
||||||
private final byte[] data;
|
|
||||||
|
|
||||||
public Plaintext(Metadata metadata, byte[] data) {
|
|
||||||
this.metadata = metadata;
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Metadata getMetadata() {
|
|
||||||
return metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
package org.session.libsignal.service.internal.push.http;
|
package org.session.libsignal.service.internal.push.http;
|
||||||
|
|
||||||
import org.session.libsignal.service.api.crypto.AttachmentCipherOutputStream;
|
import org.session.libsignal.streams.AttachmentCipherOutputStream;
|
||||||
import org.session.libsignal.service.api.crypto.DigestingOutputStream;
|
import org.session.libsignal.streams.DigestingOutputStream;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package org.session.libsignal.service.internal.push.http;
|
package org.session.libsignal.service.internal.push.http;
|
||||||
|
|
||||||
|
|
||||||
import org.session.libsignal.service.api.crypto.DigestingOutputStream;
|
import org.session.libsignal.streams.DigestingOutputStream;
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceAttachment.ProgressListener;
|
import org.session.libsignal.service.api.messages.SignalServiceAttachment.ProgressListener;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package org.session.libsignal.service.internal.push.http;
|
package org.session.libsignal.service.internal.push.http;
|
||||||
|
|
||||||
|
|
||||||
import org.session.libsignal.service.api.crypto.DigestingOutputStream;
|
import org.session.libsignal.streams.DigestingOutputStream;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package org.session.libsignal.service.internal.push.http;
|
package org.session.libsignal.service.internal.push.http;
|
||||||
|
|
||||||
|
|
||||||
import org.session.libsignal.service.api.crypto.DigestingOutputStream;
|
import org.session.libsignal.streams.DigestingOutputStream;
|
||||||
import org.session.libsignal.service.api.crypto.ProfileCipherOutputStream;
|
import org.session.libsignal.streams.ProfileCipherOutputStream;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.session.libsignal.service.loki
|
package org.session.libsignal.service.loki
|
||||||
|
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
import org.session.libsignal.service.loki.Snode
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
interface LokiAPIDatabaseProtocol {
|
interface LokiAPIDatabaseProtocol {
|
||||||
|
@ -4,11 +4,10 @@
|
|||||||
* Licensed according to the LICENSE file in this repository.
|
* Licensed according to the LICENSE file in this repository.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.session.libsignal.service.api.crypto;
|
package org.session.libsignal.streams;
|
||||||
|
|
||||||
import org.session.libsignal.libsignal.InvalidMacException;
|
import org.session.libsignal.libsignal.InvalidMacException;
|
||||||
import org.session.libsignal.libsignal.InvalidMessageException;
|
import org.session.libsignal.libsignal.InvalidMessageException;
|
||||||
import org.session.libsignal.service.internal.util.ContentLengthInputStream;
|
|
||||||
import org.session.libsignal.service.internal.util.Util;
|
import org.session.libsignal.service.internal.util.Util;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
@ -4,7 +4,7 @@
|
|||||||
* Licensed according to the LICENSE file in this repository.
|
* Licensed according to the LICENSE file in this repository.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.session.libsignal.service.api.crypto;
|
package org.session.libsignal.streams;
|
||||||
|
|
||||||
import org.session.libsignal.service.internal.util.Util;
|
import org.session.libsignal.service.internal.util.Util;
|
||||||
|
|
@ -1,6 +1,8 @@
|
|||||||
package org.session.libsignal.service.internal.util;
|
package org.session.libsignal.streams;
|
||||||
|
|
||||||
|
|
||||||
|
import org.session.libsignal.service.internal.util.Util;
|
||||||
|
|
||||||
import java.io.FilterInputStream;
|
import java.io.FilterInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
@ -1,4 +1,4 @@
|
|||||||
package org.session.libsignal.service.api.crypto;
|
package org.session.libsignal.streams;
|
||||||
|
|
||||||
|
|
||||||
import java.io.FilterOutputStream;
|
import java.io.FilterOutputStream;
|
@ -1,5 +1,4 @@
|
|||||||
package org.session.libsignal.service.internal.crypto;
|
package org.session.libsignal.streams;
|
||||||
|
|
||||||
|
|
||||||
import org.session.libsignal.service.internal.util.Util;
|
import org.session.libsignal.service.internal.util.Util;
|
||||||
|
|
@ -1,6 +1,5 @@
|
|||||||
package org.session.libsignal.service.loki
|
package org.session.libsignal.streams
|
||||||
|
|
||||||
import org.session.libsignal.service.api.crypto.DigestingOutputStream
|
|
||||||
import org.session.libsignal.service.internal.push.http.OutputStreamFactory
|
import org.session.libsignal.service.internal.push.http.OutputStreamFactory
|
||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
|
|
@ -1,5 +1,4 @@
|
|||||||
package org.session.libsignal.service.api.crypto;
|
package org.session.libsignal.streams;
|
||||||
|
|
||||||
|
|
||||||
import org.session.libsignal.service.internal.util.Util;
|
import org.session.libsignal.service.internal.util.Util;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.session.libsignal.service.api.crypto;
|
package org.session.libsignal.streams;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
@ -1,7 +1,7 @@
|
|||||||
package org.session.libsignal.service.loki.utilities
|
package org.session.libsignal.service.loki.utilities
|
||||||
|
|
||||||
import org.session.libsignal.libsignal.IdentityKeyPair
|
import org.session.libsignal.libsignal.IdentityKeyPair
|
||||||
import org.session.libsignal.libsignal.ecc.ECKeyPair
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||||
|
|
||||||
fun ByteArray.toHexString(): String {
|
fun ByteArray.toHexString(): String {
|
||||||
return joinToString("") { String.format("%02x", it) }
|
return joinToString("") { String.format("%02x", it) }
|
||||||
|
Loading…
Reference in New Issue
Block a user