mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Extract lib module
This commit is contained in:
parent
4adb11dada
commit
c72aeed8bb
79 changed files with 38 additions and 6 deletions
|
@ -21,12 +21,11 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("com.google.protobuf:protobuf-javalite:3.10.0")
|
|
||||||
implementation("com.github.turasa:signal-service-java:2.15.3_unofficial_18")
|
|
||||||
implementation("org.bouncycastle:bcprov-jdk15on:1.68")
|
implementation("org.bouncycastle:bcprov-jdk15on:1.68")
|
||||||
implementation("net.sourceforge.argparse4j:argparse4j:0.8.1")
|
implementation("net.sourceforge.argparse4j:argparse4j:0.8.1")
|
||||||
implementation("com.github.hypfvieh:dbus-java:3.2.4")
|
implementation("com.github.hypfvieh:dbus-java:3.2.4")
|
||||||
implementation("org.slf4j:slf4j-simple:1.7.30")
|
implementation("org.slf4j:slf4j-simple:1.7.30")
|
||||||
|
implementation(project(":lib"))
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
|
|
30
lib/build.gradle.kts
Normal file
30
lib/build.gradle.kts
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
plugins {
|
||||||
|
`java-library`
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
api("com.github.turasa:signal-service-java:2.15.3_unofficial_18")
|
||||||
|
implementation("com.google.protobuf:protobuf-javalite:3.10.0")
|
||||||
|
implementation("org.bouncycastle:bcprov-jdk15on:1.68")
|
||||||
|
implementation("org.slf4j:slf4j-api:1.7.30")
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
implementation {
|
||||||
|
resolutionStrategy.failOnVersionConflict()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<JavaCompile> {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
|
@ -17,12 +17,12 @@ import org.asamk.signal.manager.groups.GroupIdV1;
|
||||||
import org.asamk.signal.manager.groups.GroupIdV2;
|
import org.asamk.signal.manager.groups.GroupIdV2;
|
||||||
import org.asamk.signal.manager.groups.GroupUtils;
|
import org.asamk.signal.manager.groups.GroupUtils;
|
||||||
import org.asamk.signal.manager.util.IOUtils;
|
import org.asamk.signal.manager.util.IOUtils;
|
||||||
import org.asamk.signal.util.Hex;
|
|
||||||
import org.signal.storageservice.protos.groups.local.DecryptedGroup;
|
import org.signal.storageservice.protos.groups.local.DecryptedGroup;
|
||||||
import org.signal.zkgroup.InvalidInputException;
|
import org.signal.zkgroup.InvalidInputException;
|
||||||
import org.signal.zkgroup.groups.GroupMasterKey;
|
import org.signal.zkgroup.groups.GroupMasterKey;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.whispersystems.libsignal.util.Hex;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
|
@ -1,6 +1,5 @@
|
||||||
package org.asamk.signal.manager.util;
|
package org.asamk.signal.manager.util;
|
||||||
|
|
||||||
import org.asamk.signal.util.RandomUtils;
|
|
||||||
import org.signal.zkgroup.InvalidInputException;
|
import org.signal.zkgroup.InvalidInputException;
|
||||||
import org.signal.zkgroup.profiles.ProfileKey;
|
import org.signal.zkgroup.profiles.ProfileKey;
|
||||||
import org.whispersystems.libsignal.IdentityKey;
|
import org.whispersystems.libsignal.IdentityKey;
|
||||||
|
@ -14,12 +13,15 @@ import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
||||||
import org.whispersystems.libsignal.util.Medium;
|
import org.whispersystems.libsignal.util.Medium;
|
||||||
import org.whispersystems.signalservice.api.kbs.MasterKey;
|
import org.whispersystems.signalservice.api.kbs.MasterKey;
|
||||||
|
|
||||||
|
import java.security.SecureRandom;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class KeyUtils {
|
public class KeyUtils {
|
||||||
|
|
||||||
|
private static final SecureRandom secureRandom = new SecureRandom();
|
||||||
|
|
||||||
private KeyUtils() {
|
private KeyUtils() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +79,7 @@ public class KeyUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MasterKey createMasterKey() {
|
public static MasterKey createMasterKey() {
|
||||||
return MasterKey.createNew(RandomUtils.getSecureRandom());
|
return MasterKey.createNew(secureRandom);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getSecret(int size) {
|
private static String getSecret(int size) {
|
||||||
|
@ -87,7 +89,7 @@ public class KeyUtils {
|
||||||
|
|
||||||
public static byte[] getSecretBytes(int size) {
|
public static byte[] getSecretBytes(int size) {
|
||||||
byte[] secret = new byte[size];
|
byte[] secret = new byte[size];
|
||||||
RandomUtils.getSecureRandom().nextBytes(secret);
|
secureRandom.nextBytes(secret);
|
||||||
return secret;
|
return secret;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1 +1,2 @@
|
||||||
rootProject.name = "signal-cli"
|
rootProject.name = "signal-cli"
|
||||||
|
include("lib")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue