Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
Dan Ballard | 082beb5691 | |
Dan Ballard | 66a25b0efa | |
Dan Ballard | 2da20a5962 | |
Dan Ballard | 45d56ae601 |
|
@ -1,5 +1,6 @@
|
|||
*.iml
|
||||
*.aar
|
||||
*.apk
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
|
|
10
README.md
10
README.md
|
@ -4,3 +4,13 @@ A simple proof of concept usage of Ricochet + Tor on mobile
|
|||
Uses:
|
||||
- Orbot
|
||||
- gomobile: to leverage the go ricochet protocol library
|
||||
|
||||
## Orbot setup
|
||||
|
||||
In Orbot's Settings, find at the bottom `Debug / Torrc Custom Config` and input:
|
||||
|
||||
```
|
||||
ControlPort 9051
|
||||
CookieAuthentication 0
|
||||
DisableNetwork 0
|
||||
```
|
||||
|
|
|
@ -8,7 +8,7 @@ android {
|
|||
minSdkVersion 16
|
||||
targetSdkVersion 25
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
versionName "0.9.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
|
@ -25,6 +25,7 @@ dependencies {
|
|||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
compile project(':goRicochetMobile')
|
||||
compile project(':goRicochetMobileOd')
|
||||
|
||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||
compile 'com.android.support.constraint:constraint-layout:1.0.2'
|
||||
|
|
|
@ -16,6 +16,8 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
|
||||
import goRicochetMobile.GoRicochetMobile;
|
||||
import od.Od;
|
||||
|
||||
|
||||
public class ConnectActivity extends AppCompatActivity {
|
||||
|
||||
|
@ -39,9 +41,6 @@ public class ConnectActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// Load identity and connect to addr. Enable appropriate buttons
|
||||
// If no identity, generate.
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(im.ricochet.androidod.R.layout.activity_connect);
|
||||
|
||||
|
@ -90,11 +89,11 @@ public class ConnectActivity extends AppCompatActivity {
|
|||
String privateKey = prefs.getString(PRIVATE_KEY_KEY, "");
|
||||
Log.i(TAG, "Private key loaded:\n"+privateKey);
|
||||
if (privateKey.equals("")) {
|
||||
Log.i(TAG, "regenerating pricate key");
|
||||
Log.i(TAG, "Generating pricate key");
|
||||
RegenIdentTask regenIdentTask = new RegenIdentTask();
|
||||
regenIdentTask.execute();
|
||||
} else {
|
||||
Log.i(TAG, "setting identity, enabling regen");
|
||||
Log.i(TAG, "Setting identity, Enabling regen");
|
||||
setIdentity(privateKey);
|
||||
Button regenButton = (Button)findViewById(R.id.regenIdentButton);
|
||||
regenButton.setEnabled(true);
|
||||
|
@ -123,7 +122,7 @@ public class ConnectActivity extends AppCompatActivity {
|
|||
String privateKey = params[0];
|
||||
String connectToAddr = params[1].replaceFirst(RICOCHET_ADDRESS_PREFIX, "");
|
||||
try {
|
||||
GoRicochetMobile.odClientConnect(privateKey, connectToAddr);
|
||||
Od.odClientConnect(privateKey, connectToAddr);
|
||||
return "";
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, e.toString());
|
||||
|
@ -149,7 +148,7 @@ public class ConnectActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private void setIdentity(String privateKey) {
|
||||
Log.i(TAG, "setIdentity(): " + privateKey);
|
||||
Log.i(TAG, "setIdentity()");
|
||||
String addr = GoRicochetMobile.getOnionAddress(privateKey);
|
||||
Log.i(TAG, "setIdentity(): addr: '" + addr + "'");
|
||||
idetityText.setText("ricochet:" + addr);
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.view.View;
|
|||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import goRicochetMobile.GoRicochetMobile;
|
||||
import od.Od;
|
||||
|
||||
public class RemoteActivity extends AppCompatActivity {
|
||||
private static final String DEVICE_NAME_KEY = "deviceName";
|
||||
|
@ -118,7 +118,7 @@ public class RemoteActivity extends AppCompatActivity {
|
|||
private class GetDeviceNameTask extends AsyncTask<Void, Void, String> {
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
String name = GoRicochetMobile.getDeviceName();
|
||||
String name = Od.getDeviceName();
|
||||
return name;
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ public class RemoteActivity extends AppCompatActivity {
|
|||
private class GetBatteryTask extends AsyncTask<Void, Void, String> {
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
String batteryLevel = GoRicochetMobile.getBatteryLevel();
|
||||
String batteryLevel = Od.getBatteryLevel();
|
||||
return batteryLevel;
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ public class RemoteActivity extends AppCompatActivity {
|
|||
private class GetLevelTask extends AsyncTask<Void, Void, Integer> {
|
||||
@Override
|
||||
protected Integer doInBackground(Void... params) {
|
||||
Integer vibeLevel = (int) GoRicochetMobile.getVibeLevel();
|
||||
Integer vibeLevel = (int) Od.getVibeLevel();
|
||||
return vibeLevel;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ public class RemoteActivity extends AppCompatActivity {
|
|||
@Override
|
||||
protected Integer doInBackground(Integer... params) {
|
||||
Integer newVibeLevel = params[0];
|
||||
GoRicochetMobile.setVibeLevel(newVibeLevel);
|
||||
Od.setVibeLevel(newVibeLevel);
|
||||
return newVibeLevel;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ public class RemoteActivity extends AppCompatActivity {
|
|||
private class DisconnectTask extends AsyncTask<Void, Void, Void> {
|
||||
@Override
|
||||
protected Void doInBackground(Void ...params) {
|
||||
GoRicochetMobile.odClientDisconnect();
|
||||
Od.odClientDisconnect();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,4 +8,5 @@ gobind {
|
|||
GOMOBILE = "/home/user/src/go/bin/gomobile"
|
||||
GOBIND = "/home/user/src/go/bin/gobind"
|
||||
GO = "/home/user/go/bin/go"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
plugins {
|
||||
id "org.golang.mobile.bind" version "0.2.7"
|
||||
}
|
||||
|
||||
gobind {
|
||||
pkg = "github.com/dballard/goRicochetMobile/od"
|
||||
GOPATH = "/home/user/src/go"
|
||||
GOMOBILE = "/home/user/src/go/bin/gomobile"
|
||||
GOBIND = "/home/user/src/go/bin/gobind"
|
||||
GO = "/home/user/go/bin/go"
|
||||
}
|
|
@ -1 +1 @@
|
|||
include ':app', 'goRicochetMobile'
|
||||
include ':app', 'goRicochetMobile', 'goRicochetMobileOd'
|
||||
|
|
Loading…
Reference in New Issue