]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/cli/JsonSignedPreKeyStore.java
Fix formatting of attachment size
[signal-cli] / src / main / java / cli / JsonSignedPreKeyStore.java
index 000a0aa41fa2f9f4a457e524c8c5838abb949b56..f992d2d6101318fb622577e719866fa06a451d4b 100644 (file)
@@ -12,7 +12,7 @@ import java.util.LinkedList;
 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<>();
 
@@ -20,7 +20,7 @@ public class JsonSignedPreKeyStore implements SignedPreKeyStore {
 
     }
 
-    public JsonSignedPreKeyStore(JSONArray list) throws IOException {
+    public JsonSignedPreKeyStore(JSONArray list) {
         for (int i = 0; i < list.length(); i++) {
             JSONObject k = list.getJSONObject(i);
             try {
@@ -34,7 +34,7 @@ public class JsonSignedPreKeyStore implements SignedPreKeyStore {
     public JSONArray getJson() {
         JSONArray result = new JSONArray();
         for (Integer id : store.keySet()) {
-            result.put(new JSONObject().put("id", id.toString()).put("record", store.get(id)));
+            result.put(new JSONObject().put("id", id.toString()).put("record", Base64.encodeBytes(store.get(id))));
         }
         return result;
     }