mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 10:05:15 +00:00
clean
This commit is contained in:
parent
9bc360f047
commit
5cb3a79a27
@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import network.loki.messenger.R;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
|
||||
import org.session.libsession.utilities.JsonUtils;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -40,7 +40,7 @@ public class RecentEmojiPageModel implements EmojiPageModel {
|
||||
try {
|
||||
CollectionType collectionType = TypeFactory.defaultInstance()
|
||||
.constructCollectionType(LinkedHashSet.class, String.class);
|
||||
return JsonUtils.getMapper().readValue(serialized, collectionType);
|
||||
return JsonUtil.getMapper().readValue(serialized, collectionType);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
return new LinkedHashSet<>();
|
||||
@ -89,7 +89,7 @@ public class RecentEmojiPageModel implements EmojiPageModel {
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
try {
|
||||
String serialized = JsonUtils.toJson(latestRecentlyUsed);
|
||||
String serialized = JsonUtil.toJsonThrows(latestRecentlyUsed);
|
||||
prefs.edit()
|
||||
.putString(EMOJI_LRU_PREFERENCE, serialized)
|
||||
.apply();
|
||||
|
@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
|
||||
import org.session.libsession.utilities.JsonUtils;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -83,7 +83,7 @@ public class SignalPlace {
|
||||
|
||||
public @Nullable String serialize() {
|
||||
try {
|
||||
return JsonUtils.toJson(this);
|
||||
return JsonUtil.toJsonThrows(this);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
return null;
|
||||
@ -91,6 +91,6 @@ public class SignalPlace {
|
||||
}
|
||||
|
||||
public static SignalPlace deserialize(@NonNull String serialized) throws IOException {
|
||||
return JsonUtils.fromJson(serialized, SignalPlace.class);
|
||||
return JsonUtil.fromJson(serialized, SignalPlace.class);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
import org.session.libsession.utilities.JsonUtils;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -81,7 +81,7 @@ public class AttachmentSecret {
|
||||
|
||||
public String serialize() {
|
||||
try {
|
||||
return JsonUtils.toJson(this);
|
||||
return JsonUtil.toJsonThrows(this);
|
||||
} catch (IOException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
@ -89,7 +89,7 @@ public class AttachmentSecret {
|
||||
|
||||
static AttachmentSecret fromString(@NonNull String value) {
|
||||
try {
|
||||
return JsonUtils.fromJson(value, AttachmentSecret.class);
|
||||
return JsonUtil.fromJson(value, AttachmentSecret.class);
|
||||
} catch (IOException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import org.session.libsignal.libsignal.ecc.Curve;
|
||||
import org.session.libsignal.libsignal.ecc.ECKeyPair;
|
||||
import org.session.libsignal.libsignal.ecc.ECPrivateKey;
|
||||
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
|
@ -19,7 +19,7 @@ import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
import org.session.libsession.utilities.JsonUtils;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
@ -174,7 +174,7 @@ public final class KeyStoreHelper {
|
||||
|
||||
public String serialize() {
|
||||
try {
|
||||
return JsonUtils.toJson(this);
|
||||
return JsonUtil.toJsonThrows(this);
|
||||
} catch (IOException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
@ -182,7 +182,7 @@ public final class KeyStoreHelper {
|
||||
|
||||
public static SealedData fromString(@NonNull String value) {
|
||||
try {
|
||||
return JsonUtils.fromJson(value, SealedData.class);
|
||||
return JsonUtil.fromJson(value, SealedData.class);
|
||||
} catch (IOException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import org.session.libsignal.libsignal.ecc.Curve;
|
||||
import org.session.libsignal.libsignal.ecc.ECPrivateKey;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Hex;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -30,7 +30,7 @@ import org.session.libsignal.libsignal.ecc.ECPrivateKey;
|
||||
import org.session.libsignal.libsignal.ecc.ECPublicKey;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsession.utilities.Util;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -5,7 +5,7 @@ import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsession.utilities.TextSecurePreferences;
|
||||
import org.session.libsession.utilities.Util;
|
||||
|
||||
|
@ -52,7 +52,7 @@ import org.session.libsession.messaging.sending_receiving.attachments.DatabaseAt
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.DatabaseAttachmentAudioExtras;
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.StickerLocator;
|
||||
|
||||
import org.session.libsession.utilities.JsonUtils;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
import org.session.libsession.utilities.Util;
|
||||
|
||||
import org.thoughtcrime.securesms.mms.MediaStream;
|
||||
@ -679,7 +679,7 @@ public class AttachmentDatabase extends Database {
|
||||
JSONArray array = new JSONArray(cursor.getString(cursor.getColumnIndexOrThrow(ATTACHMENT_JSON_ALIAS)));
|
||||
|
||||
for (int i=0;i<array.length();i++) {
|
||||
JsonUtils.SaneJSONObject object = new JsonUtils.SaneJSONObject(array.getJSONObject(i));
|
||||
JsonUtil.SaneJSONObject object = new JsonUtil.SaneJSONObject(array.getJSONObject(i));
|
||||
|
||||
if (!object.isNull(ROW_ID)) {
|
||||
result.add(new DatabaseAttachment(new AttachmentId(object.getLong(ROW_ID), object.getLong(UNIQUE_ID)),
|
||||
|
@ -15,7 +15,7 @@ import org.thoughtcrime.securesms.logging.Log;
|
||||
import org.session.libsignal.libsignal.IdentityKey;
|
||||
|
||||
import org.session.libsession.messaging.threads.Address;
|
||||
import org.session.libsession.utilities.JsonUtils;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -132,7 +132,7 @@ public abstract class MessagingDatabase extends Database implements MmsSmsColumn
|
||||
if (document == null || document.size() == 0) {
|
||||
contentValues.put(column, (String)null);
|
||||
} else {
|
||||
contentValues.put(column, JsonUtils.toJson(document));
|
||||
contentValues.put(column, JsonUtil.toJsonThrows(document));
|
||||
}
|
||||
|
||||
database.update(getTableName(), contentValues, ID_WHERE, new String[] {String.valueOf(messageId)});
|
||||
@ -153,7 +153,7 @@ public abstract class MessagingDatabase extends Database implements MmsSmsColumn
|
||||
|
||||
try {
|
||||
if (!TextUtils.isEmpty(document)) {
|
||||
return JsonUtils.fromJson(document, clazz);
|
||||
return JsonUtil.fromJson(document, clazz);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
|
@ -65,7 +65,7 @@ import org.session.libsession.messaging.sending_receiving.quotes.QuoteModel;
|
||||
import org.session.libsession.messaging.threads.Address;
|
||||
import org.session.libsession.messaging.threads.recipients.Recipient;
|
||||
import org.session.libsession.messaging.threads.recipients.RecipientFormattingException;
|
||||
import org.session.libsession.utilities.JsonUtils;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
import org.session.libsession.utilities.TextSecurePreferences;
|
||||
import org.session.libsession.utilities.Util;
|
||||
|
||||
@ -83,8 +83,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.session.libsession.messaging.sending_receiving.contacts.Contact.Avatar;
|
||||
|
||||
public class MmsDatabase extends MessagingDatabase {
|
||||
|
||||
private static final String TAG = MmsDatabase.class.getSimpleName();
|
||||
@ -655,7 +653,7 @@ public class MmsDatabase extends MessagingDatabase {
|
||||
|
||||
if (!TextUtils.isEmpty(mismatchDocument)) {
|
||||
try {
|
||||
mismatches = JsonUtils.fromJson(mismatchDocument, IdentityKeyMismatchList.class).getList();
|
||||
mismatches = JsonUtil.fromJson(mismatchDocument, IdentityKeyMismatchList.class).getList();
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
@ -663,7 +661,7 @@ public class MmsDatabase extends MessagingDatabase {
|
||||
|
||||
if (!TextUtils.isEmpty(networkDocument)) {
|
||||
try {
|
||||
networkFailures = JsonUtils.fromJson(networkDocument, NetworkFailureList.class).getList();
|
||||
networkFailures = JsonUtil.fromJson(networkDocument, NetworkFailureList.class).getList();
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
@ -1504,7 +1502,7 @@ public class MmsDatabase extends MessagingDatabase {
|
||||
private List<IdentityKeyMismatch> getMismatchedIdentities(String document) {
|
||||
if (!TextUtils.isEmpty(document)) {
|
||||
try {
|
||||
return JsonUtils.fromJson(document, IdentityKeyMismatchList.class).getList();
|
||||
return JsonUtil.fromJson(document, IdentityKeyMismatchList.class).getList();
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
@ -1516,7 +1514,7 @@ public class MmsDatabase extends MessagingDatabase {
|
||||
private List<NetworkFailure> getFailures(String document) {
|
||||
if (!TextUtils.isEmpty(document)) {
|
||||
try {
|
||||
return JsonUtils.fromJson(document, NetworkFailureList.class).getList();
|
||||
return JsonUtil.fromJson(document, NetworkFailureList.class).getList();
|
||||
} catch (IOException ioe) {
|
||||
Log.w(TAG, ioe);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import org.thoughtcrime.securesms.logging.Log;
|
||||
import net.sqlcipher.database.SQLiteDatabase;
|
||||
|
||||
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper;
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsignal.libsignal.InvalidKeyException;
|
||||
import org.session.libsignal.libsignal.ecc.Curve;
|
||||
import org.session.libsignal.libsignal.ecc.ECKeyPair;
|
||||
|
@ -9,7 +9,7 @@ import org.thoughtcrime.securesms.logging.Log;
|
||||
import net.sqlcipher.database.SQLiteDatabase;
|
||||
|
||||
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper;
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsignal.libsignal.util.guava.Optional;
|
||||
import org.session.libsignal.service.api.messages.SignalServiceEnvelope;
|
||||
import org.session.libsignal.service.internal.util.Util;
|
||||
|
@ -16,7 +16,7 @@ import org.session.libsession.utilities.color.MaterialColor;
|
||||
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.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsession.utilities.Util;
|
||||
|
||||
import org.session.libsignal.libsignal.util.guava.Optional;
|
||||
|
@ -11,7 +11,7 @@ import net.sqlcipher.database.SQLiteDatabase;
|
||||
|
||||
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsignal.libsignal.InvalidKeyException;
|
||||
import org.session.libsignal.libsignal.ecc.Curve;
|
||||
import org.session.libsignal.libsignal.ecc.ECKeyPair;
|
||||
|
@ -44,7 +44,7 @@ import org.thoughtcrime.securesms.sms.OutgoingTextMessage;
|
||||
|
||||
import org.session.libsession.messaging.threads.Address;
|
||||
import org.session.libsession.messaging.threads.recipients.Recipient;
|
||||
import org.session.libsession.utilities.JsonUtils;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
import org.session.libsession.utilities.TextSecurePreferences;
|
||||
import org.session.libsession.utilities.Util;
|
||||
import org.session.libsignal.libsignal.util.guava.Optional;
|
||||
@ -960,7 +960,7 @@ public class SmsDatabase extends MessagingDatabase {
|
||||
private List<IdentityKeyMismatch> getMismatches(String document) {
|
||||
try {
|
||||
if (!TextUtils.isEmpty(document)) {
|
||||
return JsonUtils.fromJson(document, IdentityKeyMismatchList.class).getList();
|
||||
return JsonUtil.fromJson(document, IdentityKeyMismatchList.class).getList();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
|
@ -14,7 +14,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
import org.session.libsession.messaging.threads.Address;
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsignal.libsignal.IdentityKey;
|
||||
import org.session.libsignal.libsignal.InvalidKeyException;
|
||||
|
||||
|
@ -13,7 +13,7 @@ import org.thoughtcrime.securesms.giph.model.GiphyImage;
|
||||
import org.thoughtcrime.securesms.giph.model.GiphyResponse;
|
||||
import org.thoughtcrime.securesms.net.ContentProxySelector;
|
||||
import org.thoughtcrime.securesms.util.AsyncLoader;
|
||||
import org.session.libsession.utilities.JsonUtils;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
@ -58,7 +58,7 @@ public abstract class GiphyLoader extends AsyncLoader<List<GiphyImage>> {
|
||||
throw new IOException("Unexpected code " + response);
|
||||
}
|
||||
|
||||
GiphyResponse giphyResponse = JsonUtils.fromJson(response.body().byteStream(), GiphyResponse.class);
|
||||
GiphyResponse giphyResponse = JsonUtil.fromJson(response.body().byteStream(), GiphyResponse.class);
|
||||
List<GiphyImage> results = giphyResponse.getData();
|
||||
|
||||
if (results == null) return new LinkedList<>();
|
||||
|
@ -25,7 +25,7 @@ import org.thoughtcrime.securesms.sms.IncomingTextMessage;
|
||||
import org.session.libsession.messaging.threads.Address;
|
||||
import org.session.libsession.messaging.threads.GroupRecord;
|
||||
import org.session.libsession.messaging.threads.recipients.Recipient;
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsession.utilities.GroupUtil;
|
||||
import org.session.libsession.utilities.TextSecurePreferences;
|
||||
import org.session.libsignal.libsignal.util.guava.Optional;
|
||||
|
@ -4,7 +4,7 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import org.session.libsession.messaging.jobs.Data;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
import org.session.libsession.utilities.JsonUtils;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -15,7 +15,7 @@ public class JsonDataSerializer implements Data.Serializer {
|
||||
@Override
|
||||
public @NonNull String serialize(@NonNull Data data) {
|
||||
try {
|
||||
return JsonUtils.toJson(data);
|
||||
return JsonUtil.toJsonThrows(data);
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to serialize to JSON.", e);
|
||||
throw new AssertionError(e);
|
||||
@ -25,7 +25,7 @@ public class JsonDataSerializer implements Data.Serializer {
|
||||
@Override
|
||||
public @NonNull Data deserialize(@NonNull String serialized) {
|
||||
try {
|
||||
return JsonUtils.fromJson(serialized, Data.class);
|
||||
return JsonUtil.fromJson(serialized, Data.class);
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to deserialize JSON.", e);
|
||||
throw new AssertionError(e);
|
||||
|
@ -27,7 +27,7 @@ import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
import org.thoughtcrime.securesms.mms.MmsException;
|
||||
import org.thoughtcrime.securesms.util.AttachmentUtil;
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Hex;
|
||||
import org.session.libsession.utilities.Util;
|
||||
|
||||
|
@ -17,7 +17,7 @@ import org.session.libsession.messaging.threads.Address;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.MmsDatabase;
|
||||
import org.session.libsession.messaging.threads.recipients.Recipient;
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsession.utilities.Util;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -10,7 +10,7 @@ import com.annimon.stream.Stream;
|
||||
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.Attachment;
|
||||
import org.session.libsession.messaging.sending_receiving.contacts.Contact;
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsession.utilities.TextSecurePreferences;
|
||||
import org.session.libsession.utilities.Util;
|
||||
|
||||
|
@ -16,7 +16,7 @@ import org.thoughtcrime.securesms.database.SmsDatabase;
|
||||
import org.session.libsession.messaging.threads.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.sms.IncomingTextMessage;
|
||||
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsession.utilities.TextSecurePreferences;
|
||||
|
||||
import org.session.libsignal.libsignal.util.guava.Optional;
|
||||
|
@ -20,7 +20,7 @@ import org.thoughtcrime.securesms.logging.Log;
|
||||
import org.thoughtcrime.securesms.service.UpdateApkReadyListener;
|
||||
import org.thoughtcrime.securesms.util.FileUtils;
|
||||
import org.session.libsignal.utilities.Hex;
|
||||
import org.session.libsession.utilities.JsonUtils;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
import org.session.libsession.utilities.TextSecurePreferences;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
@ -76,7 +76,7 @@ public class UpdateApkJob extends BaseJob {
|
||||
throw new IOException("Bad response: " + response.message());
|
||||
}
|
||||
|
||||
UpdateDescriptor updateDescriptor = JsonUtils.fromJson(response.body().string(), UpdateDescriptor.class);
|
||||
UpdateDescriptor updateDescriptor = JsonUtil.fromJson(response.body().string(), UpdateDescriptor.class);
|
||||
byte[] digest = Hex.fromStringCondensed(updateDescriptor.getDigest());
|
||||
|
||||
Log.i(TAG, "Got descriptor: " + updateDescriptor);
|
||||
|
@ -5,7 +5,7 @@ import android.os.Build;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.KeyStoreHelper;
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsession.utilities.TextSecurePreferences;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -6,7 +6,7 @@ import okhttp3.*
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.api.PushNotificationAPI
|
||||
import org.session.libsignal.service.loki.api.onionrequests.OnionRequestAPI
|
||||
import org.session.libsignal.service.loki.utilities.retryIfNeeded
|
||||
|
@ -9,7 +9,7 @@ import org.thoughtcrime.securesms.notifications.NotificationChannels
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.api.messages.SignalServiceEnvelope
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.service.loki.api.MessageWrapper
|
||||
|
||||
class PushNotificationService : FirebaseMessagingService() {
|
||||
|
@ -15,7 +15,7 @@ import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.session.libsignal.service.loki.api.opengroups.PublicChat
|
||||
|
||||
import org.session.libsignal.libsignal.loki.SessionResetStatus
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.database.LokiThreadDatabaseProtocol
|
||||
import org.session.libsignal.service.loki.utilities.PublicKeyValidation
|
||||
|
||||
|
@ -3,7 +3,7 @@ package org.thoughtcrime.securesms.loki.utilities
|
||||
import android.content.ContentValues
|
||||
import net.sqlcipher.Cursor
|
||||
import net.sqlcipher.database.SQLiteDatabase
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
|
||||
fun <T> SQLiteDatabase.get(table: String, query: String?, arguments: Array<String>?, get: (Cursor) -> T): T? {
|
||||
var cursor: Cursor? = null
|
||||
|
@ -5,7 +5,7 @@ import org.session.libsession.messaging.threads.Address
|
||||
import org.session.libsession.messaging.threads.recipients.Recipient
|
||||
import org.session.libsession.messaging.threads.recipients.RecipientModifiedListener
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.session.libsession.utilities.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
||||
import java.util.*
|
||||
|
||||
|
@ -6,7 +6,7 @@ import com.goterl.lazycode.lazysodium.SodiumAndroid
|
||||
import com.goterl.lazycode.lazysodium.utils.Key
|
||||
import com.goterl.lazycode.lazysodium.utils.KeyPair
|
||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil
|
||||
import org.session.libsession.utilities.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.utilities.Hex
|
||||
import org.session.libsignal.libsignal.ecc.DjbECPrivateKey
|
||||
import org.session.libsignal.libsignal.ecc.DjbECPublicKey
|
||||
|
@ -9,7 +9,7 @@ import org.session.libsession.messaging.sending_receiving.contacts.Contact;
|
||||
import org.session.libsession.messaging.sending_receiving.linkpreview.LinkPreview;
|
||||
import org.session.libsession.messaging.sending_receiving.quotes.QuoteModel;
|
||||
import org.session.libsession.messaging.threads.recipients.Recipient;
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.GroupContext;
|
||||
|
||||
|
@ -5,8 +5,8 @@ import nl.komponents.kovenant.functional.map
|
||||
import okhttp3.Request
|
||||
import org.session.libsession.messaging.utilities.DotNetAPI
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.api.onionrequests.OnionRequestAPI
|
||||
import org.session.libsignal.service.loki.database.LokiAPIDatabaseProtocol
|
||||
import org.session.libsignal.service.loki.protocol.shelved.multidevice.DeviceLink
|
||||
|
@ -13,7 +13,7 @@ import org.session.libsession.snode.SnodeMessage
|
||||
import org.session.libsession.snode.OnionRequestAPI
|
||||
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.utilities.retryIfNeeded
|
||||
|
||||
class NotifyPNServerJob(val message: SnodeMessage) : Job {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.session.libsession.messaging.opengroups
|
||||
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
|
||||
data class OpenGroup(
|
||||
val channel: Long,
|
||||
|
@ -13,9 +13,9 @@ import org.session.libsignal.service.loki.utilities.ThreadUtils
|
||||
import org.session.libsession.utilities.createContext
|
||||
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Hex
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.utilities.DownloadUtilities
|
||||
import org.session.libsignal.service.loki.utilities.retryIfNeeded
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
@ -22,7 +22,7 @@ import org.session.libsession.utilities.SSKEnvironment
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.api.messages.SignalServiceAttachment
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.service.loki.api.crypto.ProofOfWork
|
||||
import org.session.libsignal.service.loki.utilities.hexEncodedPublicKey
|
||||
|
||||
|
@ -8,7 +8,7 @@ import androidx.annotation.Nullable;
|
||||
import org.session.libsignal.libsignal.util.guava.Optional;
|
||||
import org.session.libsignal.service.api.messages.SignalServiceAttachment;
|
||||
import org.session.libsignal.service.api.messages.SignalServiceDataMessage;
|
||||
import org.session.libsession.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
@ -16,7 +16,7 @@ import org.session.libsession.messaging.sending_receiving.attachments.Attachment
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.AttachmentTransferProgress;
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.AttachmentId;
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.UriAttachment;
|
||||
import org.session.libsession.utilities.JsonUtils;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
import org.session.libsession.utilities.MediaTypes;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -106,11 +106,11 @@ public class Contact implements Parcelable {
|
||||
}
|
||||
|
||||
public String serialize() throws IOException {
|
||||
return JsonUtils.toJson(this);
|
||||
return JsonUtil.toJsonThrows(this);
|
||||
}
|
||||
|
||||
public static Contact deserialize(@NonNull String serialized) throws IOException {
|
||||
return JsonUtils.fromJson(serialized, Contact.class);
|
||||
return JsonUtil.fromJson(serialized, Contact.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.Attachment;
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.AttachmentId;
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.DatabaseAttachment;
|
||||
import org.session.libsession.utilities.JsonUtils;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
import org.session.libsignal.libsignal.util.guava.Optional;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -69,10 +69,10 @@ public class LinkPreview {
|
||||
}
|
||||
|
||||
public String serialize() throws IOException {
|
||||
return JsonUtils.toJson(this);
|
||||
return JsonUtil.toJsonThrows(this);
|
||||
}
|
||||
|
||||
public static LinkPreview deserialize(@NonNull String serialized) throws IOException {
|
||||
return JsonUtils.fromJson(serialized, LinkPreview.class);
|
||||
return JsonUtil.fromJson(serialized, LinkPreview.class);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import okhttp3.*
|
||||
import org.session.libsession.messaging.MessagingConfiguration
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.api.onionrequests.OnionRequestAPI
|
||||
import org.session.libsignal.service.loki.utilities.retryIfNeeded
|
||||
|
||||
|
@ -13,7 +13,7 @@ import org.session.libsession.snode.SnodeAPI
|
||||
import org.session.libsession.utilities.successBackground
|
||||
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.service.loki.utilities.getRandomElementOrNull
|
||||
|
||||
class ClosedGroupPoller {
|
||||
|
@ -12,7 +12,7 @@ import org.session.libsession.snode.SnodeAPI
|
||||
import org.session.libsession.snode.SnodeConfiguration
|
||||
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
|
||||
import java.security.SecureRandom
|
||||
import java.util.*
|
||||
|
@ -22,11 +22,12 @@ import org.session.libsignal.service.internal.push.ProfileAvatarData
|
||||
import org.session.libsignal.service.internal.push.PushAttachmentData
|
||||
import org.session.libsignal.service.internal.push.http.DigestingRequestBody
|
||||
import org.session.libsignal.service.internal.push.http.ProfileCipherOutputStreamFactory
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Hex
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.api.utilities.HTTP
|
||||
import org.session.libsignal.service.loki.utilities.*
|
||||
import org.session.libsignal.utilities.Base64
|
||||
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.OutputStream
|
||||
|
@ -2,9 +2,7 @@ package org.session.libsession.messaging.utilities
|
||||
|
||||
import com.google.protobuf.ByteString
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.Envelope
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.service.internal.websocket.WebSocketProtos.WebSocketMessage
|
||||
import org.session.libsignal.service.internal.websocket.WebSocketProtos.WebSocketRequestMessage
|
||||
import java.security.SecureRandom
|
||||
|
@ -8,8 +8,8 @@ import nl.komponents.kovenant.functional.map
|
||||
import okhttp3.Request
|
||||
import org.session.libsession.utilities.AESGCM
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.api.*
|
||||
import org.session.libsignal.service.loki.api.fileserver.FileServerAPI
|
||||
import org.session.libsignal.service.loki.api.utilities.*
|
||||
|
@ -2,7 +2,7 @@ package org.session.libsession.snode
|
||||
|
||||
import nl.komponents.kovenant.Promise
|
||||
import nl.komponents.kovenant.deferred
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsession.utilities.AESGCM.EncryptionResult
|
||||
import org.session.libsession.utilities.AESGCM
|
||||
import org.session.libsignal.service.loki.utilities.ThreadUtils
|
||||
|
@ -3,10 +3,11 @@ package org.session.libsession.utilities
|
||||
import okhttp3.MultipartBody
|
||||
import okhttp3.Request
|
||||
import okio.Buffer
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
||||
import org.session.libsignal.utilities.Base64
|
||||
|
||||
internal fun Request.getHeadersForOnionRequest(): Map<String, Any> {
|
||||
val result = mutableMapOf<String, Any>()
|
||||
val contentType = body()?.contentType()
|
||||
|
@ -10,7 +10,6 @@ import androidx.core.app.NotificationCompat
|
||||
import org.session.libsession.R
|
||||
import org.session.libsession.utilities.preferences.NotificationPrivacyPreference
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
||||
|
@ -17,6 +17,7 @@ import android.text.TextUtils
|
||||
import android.text.style.StyleSpan
|
||||
import org.session.libsession.messaging.threads.Address
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import java.io.*
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.security.SecureRandom
|
||||
|
@ -44,7 +44,7 @@ import org.session.libsignal.service.internal.crypto.ProvisioningCipher;
|
||||
import org.session.libsignal.service.internal.push.ProfileAvatarData;
|
||||
import org.session.libsignal.service.internal.push.PushServiceSocket;
|
||||
import org.session.libsignal.service.internal.push.http.ProfileCipherOutputStreamFactory;
|
||||
import org.session.libsignal.service.internal.util.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsignal.service.internal.util.StaticCredentialsProvider;
|
||||
import org.session.libsignal.service.internal.util.Util;
|
||||
|
||||
|
@ -19,8 +19,8 @@ import org.session.libsignal.service.api.util.CredentialsProvider;
|
||||
import org.session.libsignal.service.internal.push.AttachmentUploadAttributes;
|
||||
import org.session.libsignal.service.internal.push.OutgoingPushMessageList;
|
||||
import org.session.libsignal.service.internal.push.SendMessageResponse;
|
||||
import org.session.libsignal.service.internal.util.Base64;
|
||||
import org.session.libsignal.service.internal.util.JsonUtil;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
import org.session.libsignal.service.internal.util.Util;
|
||||
import org.session.libsignal.service.internal.websocket.WebSocketConnection;
|
||||
|
||||
|
@ -10,19 +10,11 @@ import com.google.protobuf.InvalidProtocolBufferException;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.session.libsignal.libsignal.ecc.ECKeyPair;
|
||||
import org.session.libsignal.metadata.SealedSessionCipher;
|
||||
import org.session.libsignal.libsignal.InvalidKeyException;
|
||||
import org.session.libsignal.libsignal.SessionBuilder;
|
||||
import org.session.libsignal.libsignal.SignalProtocolAddress;
|
||||
import org.session.libsignal.libsignal.logging.Log;
|
||||
import org.session.libsignal.libsignal.loki.FallbackMessage;
|
||||
import org.session.libsignal.libsignal.loki.FallbackSessionCipher;
|
||||
import org.session.libsignal.libsignal.loki.SessionResetProtocol;
|
||||
import org.session.libsignal.libsignal.state.PreKeyBundle;
|
||||
import org.session.libsignal.libsignal.state.SignalProtocolStore;
|
||||
import org.session.libsignal.libsignal.util.guava.Optional;
|
||||
import org.session.libsignal.service.api.crypto.AttachmentCipherOutputStream;
|
||||
import org.session.libsignal.service.api.crypto.SignalServiceCipher;
|
||||
import org.session.libsignal.service.api.crypto.UnidentifiedAccess;
|
||||
import org.session.libsignal.service.api.crypto.UnidentifiedAccessPair;
|
||||
import org.session.libsignal.service.api.crypto.UntrustedIdentityException;
|
||||
@ -64,13 +56,12 @@ 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.GroupContext;
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.LokiUserProfile;
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.PreKeyBundleMessage;
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.ReceiptMessage;
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.SyncMessage;
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.TypingMessage;
|
||||
import org.session.libsignal.service.internal.push.http.AttachmentCipherOutputStreamFactory;
|
||||
import org.session.libsignal.service.internal.push.http.OutputStreamFactory;
|
||||
import org.session.libsignal.service.internal.util.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsignal.service.internal.util.StaticCredentialsProvider;
|
||||
import org.session.libsignal.service.internal.util.Util;
|
||||
import org.session.libsignal.service.internal.util.concurrent.SettableFuture;
|
||||
@ -92,7 +83,6 @@ import org.session.libsignal.service.loki.database.LokiUserDatabaseProtocol;
|
||||
import org.session.libsignal.service.loki.protocol.closedgroups.SharedSenderKeysDatabaseProtocol;
|
||||
import org.session.libsignal.service.loki.protocol.meta.TTLUtilities;
|
||||
import org.session.libsignal.service.loki.protocol.sessionmanagement.SessionManagementProtocol;
|
||||
import org.session.libsignal.service.loki.protocol.shelved.multidevice.DeviceLink;
|
||||
import org.session.libsignal.service.loki.protocol.shelved.multidevice.MultiDeviceProtocol;
|
||||
import org.session.libsignal.service.loki.protocol.shelved.syncmessages.SyncMessagesProtocol;
|
||||
import org.session.libsignal.service.loki.utilities.Broadcaster;
|
||||
@ -108,7 +98,6 @@ import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
@ -40,7 +40,6 @@ import org.session.libsignal.libsignal.protocol.CiphertextMessage;
|
||||
import org.session.libsignal.libsignal.protocol.PreKeySignalMessage;
|
||||
import org.session.libsignal.libsignal.protocol.SignalMessage;
|
||||
import org.session.libsignal.libsignal.state.SignalProtocolStore;
|
||||
import org.session.libsignal.libsignal.util.Pair;
|
||||
import org.session.libsignal.libsignal.util.guava.Optional;
|
||||
import org.session.libsignal.service.api.messages.SignalServiceAttachment;
|
||||
import org.session.libsignal.service.api.messages.SignalServiceAttachmentPointer;
|
||||
@ -84,7 +83,7 @@ import org.session.libsignal.service.internal.push.SignalServiceProtos.ReceiptMe
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.SyncMessage;
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.TypingMessage;
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.Verified;
|
||||
import org.session.libsignal.service.internal.util.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsignal.service.loki.api.crypto.SessionProtocol;
|
||||
import org.session.libsignal.service.loki.api.crypto.SessionProtocolUtilities;
|
||||
import org.session.libsignal.service.loki.api.opengroups.PublicChat;
|
||||
|
@ -12,7 +12,7 @@ import org.session.libsignal.libsignal.InvalidVersionException;
|
||||
import org.session.libsignal.libsignal.logging.Log;
|
||||
import org.session.libsignal.service.api.push.SignalServiceAddress;
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.Envelope;
|
||||
import org.session.libsignal.service.internal.util.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsignal.utilities.Hex;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -9,7 +9,6 @@ package org.session.libsignal.service.api.push;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
@ -19,7 +18,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
import org.session.libsignal.libsignal.ecc.ECPublicKey;
|
||||
import org.session.libsignal.service.internal.push.PreKeyEntity;
|
||||
import org.session.libsignal.service.internal.util.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -13,7 +13,7 @@ import org.session.libsignal.service.internal.contacts.entities.DiscoveryRequest
|
||||
import org.session.libsignal.service.internal.contacts.entities.DiscoveryResponse;
|
||||
import org.session.libsignal.service.internal.contacts.entities.RemoteAttestationResponse;
|
||||
import org.session.libsignal.utilities.Hex;
|
||||
import org.session.libsignal.service.internal.util.JsonUtil;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
import org.session.libsignal.service.internal.util.Util;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.session.libsignal.service.internal.contacts.crypto;
|
||||
|
||||
import org.session.libsignal.service.internal.util.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.net.URLDecoder;
|
||||
|
@ -19,7 +19,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import org.session.libsignal.libsignal.InvalidKeyException;
|
||||
import org.session.libsignal.libsignal.ecc.Curve;
|
||||
import org.session.libsignal.libsignal.ecc.ECPublicKey;
|
||||
import org.session.libsignal.service.internal.util.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -7,22 +7,12 @@
|
||||
package org.session.libsignal.service.internal.push;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
import org.session.libsignal.libsignal.IdentityKey;
|
||||
import org.session.libsignal.libsignal.InvalidKeyException;
|
||||
import org.session.libsignal.service.internal.push.PreKeyResponseItem;
|
||||
import org.session.libsignal.service.internal.util.Base64;
|
||||
import org.session.libsignal.service.internal.util.JsonUtil;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class PreKeyResponse {
|
||||
|
@ -6,8 +6,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
import org.session.libsignal.libsignal.IdentityKey;
|
||||
import org.session.libsignal.service.api.push.SignedPreKeyEntity;
|
||||
import org.session.libsignal.service.internal.push.PreKeyEntity;
|
||||
import org.session.libsignal.service.internal.util.JsonUtil;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -46,10 +46,10 @@ import org.session.libsignal.service.internal.push.exceptions.MismatchedDevicesE
|
||||
import org.session.libsignal.service.internal.push.exceptions.StaleDevicesException;
|
||||
import org.session.libsignal.service.internal.push.http.DigestingRequestBody;
|
||||
import org.session.libsignal.service.internal.push.http.OutputStreamFactory;
|
||||
import org.session.libsignal.service.internal.util.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
import org.session.libsignal.service.internal.util.BlacklistingTrustManager;
|
||||
import org.session.libsignal.utilities.Hex;
|
||||
import org.session.libsignal.service.internal.util.JsonUtil;
|
||||
import org.session.libsignal.utilities.JsonUtil;
|
||||
import org.session.libsignal.service.internal.util.Util;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -11,7 +11,7 @@ import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
import org.session.libsignal.service.internal.util.Base64;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,78 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2014-2016 Open Whisper Systems
|
||||
*
|
||||
* Licensed according to the LICENSE file in this repository.
|
||||
*/
|
||||
|
||||
package org.session.libsignal.service.internal.util;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
import org.session.libsignal.libsignal.IdentityKey;
|
||||
import org.session.libsignal.libsignal.InvalidKeyException;
|
||||
import org.session.libsignal.libsignal.logging.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class JsonUtil {
|
||||
|
||||
private static final String TAG = JsonUtil.class.getSimpleName();
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
static {
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
}
|
||||
|
||||
public static String toJson(Object object) {
|
||||
try {
|
||||
return objectMapper.writeValueAsString(object);
|
||||
} catch (JsonProcessingException e) {
|
||||
Log.w(TAG, e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T fromJson(String json, Class<T> clazz)
|
||||
throws IOException
|
||||
{
|
||||
return objectMapper.readValue(json, clazz);
|
||||
}
|
||||
|
||||
public static JsonNode fromJson(String json) throws IOException {
|
||||
return objectMapper.readTree(json);
|
||||
}
|
||||
|
||||
public static class IdentityKeySerializer extends JsonSerializer<IdentityKey> {
|
||||
@Override
|
||||
public void serialize(IdentityKey value, JsonGenerator gen, SerializerProvider serializers)
|
||||
throws IOException
|
||||
{
|
||||
gen.writeString(Base64.encodeBytesWithoutPadding(value.serialize()));
|
||||
}
|
||||
}
|
||||
|
||||
public static class IdentityKeyDeserializer extends JsonDeserializer<IdentityKey> {
|
||||
@Override
|
||||
public IdentityKey deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||
try {
|
||||
return new IdentityKey(Base64.decodeWithoutPadding(p.getValueAsString()), 0);
|
||||
} catch (InvalidKeyException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -18,9 +18,9 @@ import org.session.libsignal.service.internal.push.ProfileAvatarData
|
||||
import org.session.libsignal.service.internal.push.PushAttachmentData
|
||||
import org.session.libsignal.service.internal.push.http.DigestingRequestBody
|
||||
import org.session.libsignal.service.internal.push.http.ProfileCipherOutputStreamFactory
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.utilities.Hex
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.api.fileserver.FileServerAPI
|
||||
import org.session.libsignal.service.loki.api.onionrequests.OnionRequestAPI
|
||||
import org.session.libsignal.service.loki.api.utilities.HTTP
|
||||
|
@ -3,7 +3,7 @@ package org.session.libsignal.service.loki.api
|
||||
import nl.komponents.kovenant.Promise
|
||||
import nl.komponents.kovenant.deferred
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.service.loki.api.crypto.ProofOfWork
|
||||
import org.session.libsignal.service.loki.protocol.meta.TTLUtilities
|
||||
import org.session.libsignal.service.loki.utilities.ThreadUtils
|
||||
|
@ -3,7 +3,7 @@ package org.session.libsignal.service.loki.api
|
||||
import com.google.protobuf.ByteString
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.Envelope
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.service.internal.websocket.WebSocketProtos.WebSocketMessage
|
||||
import org.session.libsignal.service.internal.websocket.WebSocketProtos.WebSocketRequestMessage
|
||||
import java.security.SecureRandom
|
||||
|
@ -3,10 +3,9 @@ package org.session.libsignal.service.loki.api
|
||||
import nl.komponents.kovenant.functional.map
|
||||
import okhttp3.*
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.api.onionrequests.OnionRequestAPI
|
||||
import org.session.libsignal.service.loki.utilities.retryIfNeeded
|
||||
import java.io.IOException
|
||||
|
||||
public class PushNotificationAPI private constructor(public val server: String) {
|
||||
|
||||
|
@ -8,7 +8,7 @@ import nl.komponents.kovenant.functional.map
|
||||
import nl.komponents.kovenant.task
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos.Envelope
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.service.loki.api.onionrequests.OnionRequestAPI
|
||||
import org.session.libsignal.service.loki.api.utilities.HTTP
|
||||
import org.session.libsignal.service.loki.database.LokiAPIDatabaseProtocol
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.session.libsignal.service.loki.api.crypto
|
||||
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.service.loki.api.SnodeAPI
|
||||
import java.math.BigInteger
|
||||
import java.nio.ByteBuffer
|
||||
|
@ -4,8 +4,8 @@ import nl.komponents.kovenant.Promise
|
||||
import nl.komponents.kovenant.functional.map
|
||||
import okhttp3.Request
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.api.LokiDotNetAPI
|
||||
import org.session.libsignal.service.loki.api.onionrequests.OnionRequestAPI
|
||||
import org.session.libsignal.service.loki.database.LokiAPIDatabaseProtocol
|
||||
|
@ -7,8 +7,8 @@ import nl.komponents.kovenant.functional.bind
|
||||
import nl.komponents.kovenant.functional.map
|
||||
import okhttp3.Request
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.api.*
|
||||
import org.session.libsignal.service.loki.api.fileserver.FileServerAPI
|
||||
import org.session.libsignal.service.loki.api.utilities.*
|
||||
|
@ -2,7 +2,7 @@ package org.session.libsignal.service.loki.api.onionrequests
|
||||
|
||||
import nl.komponents.kovenant.Promise
|
||||
import nl.komponents.kovenant.deferred
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.api.utilities.EncryptionResult
|
||||
import org.session.libsignal.service.loki.api.utilities.EncryptionUtilities
|
||||
import org.session.libsignal.service.loki.utilities.ThreadUtils
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.session.libsignal.service.loki.api.opengroups
|
||||
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
|
||||
public data class PublicChat(
|
||||
public val channel: Long,
|
||||
|
@ -6,9 +6,9 @@ import nl.komponents.kovenant.deferred
|
||||
import nl.komponents.kovenant.functional.map
|
||||
import nl.komponents.kovenant.then
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.utilities.Hex
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.api.LokiDotNetAPI
|
||||
import org.session.libsignal.service.loki.api.SnodeAPI
|
||||
import org.session.libsignal.service.loki.api.fileserver.FileServerAPI
|
||||
|
@ -2,7 +2,7 @@ package org.session.libsignal.service.loki.api.utilities
|
||||
|
||||
import okhttp3.*
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import java.security.SecureRandom
|
||||
import java.security.cert.X509Certificate
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
@ -3,7 +3,7 @@ package org.session.libsignal.service.loki.api.utilities
|
||||
import okhttp3.MultipartBody
|
||||
import okhttp3.Request
|
||||
import okio.Buffer
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
||||
|
@ -4,7 +4,7 @@ import com.google.protobuf.ByteString
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.utilities.Hex
|
||||
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
||||
import org.session.libsignal.service.internal.util.JsonUtil
|
||||
import org.session.libsignal.utilities.JsonUtil
|
||||
import org.session.libsignal.service.loki.utilities.toHexString
|
||||
|
||||
public class ClosedGroupSenderKey(public val chainKey: ByteArray, public val keyIndex: Int, public val publicKey: ByteArray) {
|
||||
|
@ -2,7 +2,7 @@ package org.session.libsignal.service.loki.protocol.shelved.multidevice
|
||||
|
||||
import org.whispersystems.curve25519.Curve25519
|
||||
import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.utilities.Hex
|
||||
import org.session.libsignal.service.loki.utilities.removing05PrefixIfNeeded
|
||||
import java.util.*
|
||||
|
@ -6,7 +6,7 @@ import org.session.libsignal.libsignal.logging.Log
|
||||
import org.session.libsignal.service.api.messages.SignalServiceAttachment
|
||||
import org.session.libsignal.service.api.push.exceptions.NonSuccessfulResponseCodeException
|
||||
import org.session.libsignal.service.api.push.exceptions.PushNetworkException
|
||||
import org.session.libsignal.service.internal.util.Base64
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.service.loki.api.fileserver.FileServerAPI
|
||||
import org.session.libsignal.service.loki.api.onionrequests.OnionRequestAPI
|
||||
import java.io.*
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.session.libsession.utilities;
|
||||
package org.session.libsignal.utilities;
|
||||
|
||||
/**
|
||||
* <p>Encodes and decodes to and from Base64 notation.</p>
|
@ -1,17 +1,31 @@
|
||||
package org.session.libsession.utilities;
|
||||
package org.session.libsignal.utilities;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.session.libsignal.libsignal.IdentityKey;
|
||||
import org.session.libsignal.libsignal.InvalidKeyException;
|
||||
import org.session.libsignal.libsignal.logging.Log;
|
||||
import org.session.libsignal.utilities.Base64;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
|
||||
public class JsonUtils {
|
||||
public class JsonUtil {
|
||||
|
||||
private static final String TAG = org.session.libsignal.utilities.JsonUtil.class.getSimpleName();
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@ -37,10 +51,43 @@ public class JsonUtils {
|
||||
return objectMapper.readValue(serialized, clazz);
|
||||
}
|
||||
|
||||
public static String toJson(Object object) throws IOException {
|
||||
public static JsonNode fromJson(String serialized) throws IOException {
|
||||
return objectMapper.readTree(serialized);
|
||||
}
|
||||
|
||||
public static String toJsonThrows(Object object) throws IOException {
|
||||
return objectMapper.writeValueAsString(object);
|
||||
}
|
||||
|
||||
public static String toJson(Object object) {
|
||||
try {
|
||||
return objectMapper.writeValueAsString(object);
|
||||
} catch (JsonProcessingException e) {
|
||||
Log.w(TAG, e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static class IdentityKeySerializer extends JsonSerializer<IdentityKey> {
|
||||
@Override
|
||||
public void serialize(IdentityKey value, JsonGenerator gen, SerializerProvider serializers)
|
||||
throws IOException
|
||||
{
|
||||
gen.writeString(Base64.encodeBytesWithoutPadding(value.serialize()));
|
||||
}
|
||||
}
|
||||
|
||||
public static class IdentityKeyDeserializer extends JsonDeserializer<IdentityKey> {
|
||||
@Override
|
||||
public IdentityKey deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||
try {
|
||||
return new IdentityKey(Base64.decodeWithoutPadding(p.getValueAsString()), 0);
|
||||
} catch (InvalidKeyException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ObjectMapper getMapper() {
|
||||
return objectMapper;
|
||||
}
|
Loading…
Reference in New Issue
Block a user