diff --git a/BundleClient/app/src/main/java/net/discdd/bundleclient/BundleClientActivity.java b/BundleClient/app/src/main/java/net/discdd/bundleclient/BundleClientActivity.java index bb00de2598..1ad5328126 100644 --- a/BundleClient/app/src/main/java/net/discdd/bundleclient/BundleClientActivity.java +++ b/BundleClient/app/src/main/java/net/discdd/bundleclient/BundleClientActivity.java @@ -25,9 +25,11 @@ import net.discdd.android.fragments.PermissionsFragment; import net.discdd.client.bundlerouting.ClientWindow; import net.discdd.client.bundlesecurity.BundleSecurity; +import net.discdd.pathutils.ClientPaths; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.concurrent.CompletableFuture; @@ -104,6 +106,13 @@ protected void onCreate(Bundle savedInstanceState) { fragmentsWithTitles.get(position).title())); tabMediator.attach(); + try { + ClientPaths clientPaths = new ClientPaths( + Paths.get(getApplicationContext().getApplicationInfo().dataDir)); + } catch (IOException e) { + throw new RuntimeException(e); + } + //Application context var resources = getApplicationContext().getResources(); try (InputStream inServerIdentity = resources.openRawResource( @@ -112,8 +121,7 @@ protected void onCreate(Bundle savedInstanceState) { net.discdd.android_core.R.raw.server_signed_pre); InputStream inServerRatchet = resources.openRawResource( net.discdd.android_core.R.raw.server_ratchet)) { - BundleSecurity.initializeKeyPaths(inServerIdentity, inServerSignedPre, inServerRatchet, - Paths.get(getApplicationContext().getApplicationInfo().dataDir)); + BundleSecurity.initializeKeyPaths(inServerIdentity, inServerSignedPre, inServerRatchet); } catch (IOException e) { logger.log(SEVERE, "[SEC]: Failed to initialize Server Keys", e); } diff --git a/bundle-core/src/main/java/net/discdd/client/bundlesecurity/BundleSecurity.java b/bundle-core/src/main/java/net/discdd/client/bundlesecurity/BundleSecurity.java index de6e51f789..8a6e4d147a 100644 --- a/bundle-core/src/main/java/net/discdd/client/bundlesecurity/BundleSecurity.java +++ b/bundle-core/src/main/java/net/discdd/client/bundlesecurity/BundleSecurity.java @@ -49,7 +49,7 @@ public BundleSecurity(ClientPaths clientPaths) throws IOException, InvalidKeyExc // TODO: this function makes me sad! it should not be static. We should probably inject BundleSecurity // into Bundle transport so that everything can be set up properly public static void initializeKeyPaths(InputStream inServerIdentity, InputStream inServerSignedPre, - InputStream inServerRatchet, Path rootFolder) throws IOException { + InputStream inServerRatchet) throws IOException { Files.copy(inServerIdentity, clientPaths.outServerIdentity, StandardCopyOption.REPLACE_EXISTING); inServerIdentity.close();