private final ObjectMapper jsonProcessot = new ObjectMapper();
private String username;
- int deviceId = SignalServiceAddress.DEFAULT_DEVICE_ID;
+ private int deviceId = SignalServiceAddress.DEFAULT_DEVICE_ID;
private String password;
private String signalingKey;
private int preKeyIdOffset;
return username;
}
+ public int getDeviceId() {
+ return deviceId;
+ }
+
public String getFileName() {
new File(dataPath).mkdirs();
return dataPath + "/" + username;
save();
}
+ public List<DeviceInfo> getLinkedDevices() throws IOException {
+ return accountManager.getDevices();
+ }
+
+ public void removeLinkedDevices(int deviceId) throws IOException {
+ accountManager.removeDevice(deviceId);
+ }
public static Map<String, String> getQueryMap(String query) {
String[] params = query.split("&");
}
public void addDeviceLink(URI linkUri) throws IOException, InvalidKeyException {
- Map<String, String> query = getQueryMap(linkUri.getQuery());
+ Map<String, String> query = getQueryMap(linkUri.getRawQuery());
String deviceIdentifier = query.get("uuid");
String publicKeyEncoded = query.get("pub_key");
ECPublicKey deviceKey = Curve.decodePoint(Base64.decode(publicKeyEncoded), 0);
- addDeviceLink(deviceIdentifier, deviceKey);
+ addDevice(deviceIdentifier, deviceKey);
}
- private void addDeviceLink(String deviceIdentifier, ECPublicKey deviceKey) throws IOException, InvalidKeyException {
+ private void addDevice(String deviceIdentifier, ECPublicKey deviceKey) throws IOException, InvalidKeyException {
IdentityKeyPair identityKeyPair = signalProtocolStore.getIdentityKeyPair();
String verificationCode = accountManager.getNewDeviceVerificationCode();