import java.io.IOException;
import java.util.List;
-public class JsonAxolotlStore implements AxolotlStore {
+class JsonAxolotlStore implements AxolotlStore {
private final JsonPreKeyStore preKeyStore;
private final JsonSessionStore sessionStore;
private final JsonSignedPreKeyStore signedPreKeyStore;
import java.util.HashMap;
import java.util.Map;
-public class JsonIdentityKeyStore implements IdentityKeyStore {
+class JsonIdentityKeyStore implements IdentityKeyStore {
private final Map<String, IdentityKey> trustedKeys = new HashMap<>();
import java.util.HashMap;
import java.util.Map;
-public class JsonPreKeyStore implements PreKeyStore {
+class JsonPreKeyStore implements PreKeyStore {
private final Map<Integer, byte[]> store = new HashMap<>();
}
- public JsonPreKeyStore(JSONArray list) throws IOException {
+ public JsonPreKeyStore(JSONArray list) {
for (int i = 0; i < list.length(); i++) {
JSONObject k = list.getJSONObject(i);
try {
import java.io.IOException;
import java.util.*;
-public class JsonSessionStore implements SessionStore {
+class JsonSessionStore implements SessionStore {
- private Map<AxolotlAddress, byte[]> sessions = new HashMap<>();
+ private final Map<AxolotlAddress, byte[]> sessions = new HashMap<>();
public JsonSessionStore() {
}
- public JsonSessionStore(JSONArray list) throws IOException {
+ public JsonSessionStore(JSONArray list) {
for (int i = 0; i < list.length(); i++) {
JSONObject k = list.getJSONObject(i);
try {
import java.util.List;
import java.util.Map;
-public class JsonSignedPreKeyStore implements SignedPreKeyStore {
+class JsonSignedPreKeyStore implements SignedPreKeyStore {
private final Map<Integer, byte[]> store = new HashMap<>();
}
- public JsonSignedPreKeyStore(JSONArray list) throws IOException {
+ public JsonSignedPreKeyStore(JSONArray list) {
for (int i = 0; i < list.length(); i++) {
JSONObject k = list.getJSONObject(i);
try {
}
private static class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
- Manager m;
+ final Manager m;
public ReceiveMessageHandler(Manager m) {
this.m = m;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-public class Manager {
+class Manager {
private final static String URL = "https://textsecure-service.whispersystems.org";
private final static TrustStore TRUST_STORE = new WhisperTrustStore();
private boolean registered = false;
private JsonAxolotlStore axolotlStore;
- TextSecureAccountManager accountManager;
+ private TextSecureAccountManager accountManager;
public Manager(String username) {
this.username = username;
public boolean userExists() {
File f = new File(getFileName());
- if (!f.exists() || f.isDirectory()) {
- return false;
- }
- return true;
+ return !(!f.exists() || f.isDirectory());
}
public boolean userHasKeys() {
writer.close();
} catch (Exception e) {
System.out.println("Saving file error: " + e.getMessage());
- return;
}
}
return outputFile;
}
- public String canonicalizeNumber(String number) throws InvalidNumberException {
+ private String canonicalizeNumber(String number) throws InvalidNumberException {
String localNumber = username;
return PhoneNumberFormatter.formatNumber(number, localNumber);
}
- protected TextSecureAddress getPushAddress(String number) throws InvalidNumberException {
+ TextSecureAddress getPushAddress(String number) throws InvalidNumberException {
String e164number = canonicalizeNumber(number);
return new TextSecureAddress(e164number);
}
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
-public class Util {
+class Util {
public static String getSecret(int size) {
byte[] secret = getSecretBytes(size);
return Base64.encodeBytes(secret);
}
- public static byte[] getSecretBytes(int size) {
+ private static byte[] getSecretBytes(int size) {
byte[] secret = new byte[size];
getSecureRandom().nextBytes(secret);
return secret;
}
- public static SecureRandom getSecureRandom() {
+ private static SecureRandom getSecureRandom() {
try {
return SecureRandom.getInstance("SHA1PRNG");
} catch (NoSuchAlgorithmException e) {
import java.io.InputStream;
-public class WhisperTrustStore implements TrustStore {
+class WhisperTrustStore implements TrustStore {
@Override
public InputStream getKeyStoreInputStream() {