Skip to content

Commit dc590b8

Browse files
committed
Merge branch 'develop'
2 parents bf10550 + 161adf2 commit dc590b8

File tree

155 files changed

+211135
-881
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+211135
-881
lines changed

README.md

Lines changed: 74 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,80 @@
1-
# sentinelx
21

3-
bitcoin watch only wallet based samourai sentinel
2+
<div align="center">
3+
<img src="./art/ic_launcher.png" width=200>
4+
</div>
45

5-
## Getting Started
6+
<h2 align="center">[BETA] Sentinel x</h2>
7+
<p align="center">bitcoin watch only wallet based <a href="https://github.com/Samourai-Wallet/sentinel-android"> samourai sentinel</a>
8+
</p>
69

7-
This project is a starting point for a Flutter application.
10+
## Sentinel x Features
811

9-
A few resources to get you started if this is your first Flutter project:
12+
* Sleek and faster UI
13+
* Tor Support
14+
* Offline Mode
15+
* Theme support (light/dark and accent)
16+
* db level encryption
17+
* [WIP] Dojo node support
1018

11-
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12-
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
1319

14-
For help getting started with Flutter, view our
15-
[online documentation](https://flutter.dev/docs), which offers tutorials,
16-
samples, guidance on mobile development, and a full API reference.
20+
## Screenshots
21+
22+
<div style="text-align: center"><table>
23+
<tr>
24+
<td style="text-align: center">
25+
<img src="art/1.png" width="554"/></a>
26+
</td>
27+
<td style="text-align: center">
28+
<img src="art/2.png" width="554" />
29+
</td>
30+
<td style="text-align: center">
31+
<img src="art/3.png" width="554"/>
32+
</td>
33+
<td style="text-align: center">
34+
<img src="art/4.png" width="554"/>
35+
</td>
36+
</tr>
37+
<tr>
38+
<td style="text-align: center">
39+
<img src="art/5.png" width="554"/></a>
40+
</td>
41+
<td style="text-align: center">
42+
<img src="art/6.png" width="554" />
43+
</td>
44+
<td style="text-align: center">
45+
<img src="art/7.png" width="554"/>
46+
</td>
47+
<td style="text-align: center">
48+
<img src="art/8.png" width="554"/>
49+
</td>
50+
</tr>
51+
</table>
52+
</div>
53+
54+
55+
## Sentinel features
56+
57+
### BIP44:
58+
Sentinel implementation based on [original BIP](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) ([bitcoin/bips:bip-0044.mediawiki@`master`](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)) extends [bitcoinj](https://bitcoinj.github.io/).
59+
60+
### BIP49 (Segwit):
61+
Sentinel implementation based on [original BIP] ([bitcoin/bips:bip-0049.mediawiki@`master`](https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki)) by Daniel Weigl and includes support for BIP49-specific XPUBs: [YPUB](https://github.com/Samourai-Wallet/sentinel-android/issues/16).
62+
63+
### BIP84 (Segwit):
64+
Sentinel implementation based on [original BIP](https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki) by Pavol Rusnak.
65+
66+
### BIP141 (Segwit):
67+
Sentinel P2WPKH based on [original BIP](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki) by Eric Lombrozo, Johnson Lau and Pieter Wuille.
68+
69+
### BIP173 (Segwit):
70+
Sentinel implementation based on [original BIP](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki) by Pieter Wuille and Greg Maxwell.
71+
72+
## Build
73+
74+
- Install [Flutter](https://flutter.dev/) and its dependencies.
75+
- Run the project by executing ``Flutter run``
76+
77+
------
78+
79+
[Note]: Sentinel x does not support ios (for now)(since this app is completely based on sentinel android core libs are based on java, in order to support IOS we need to port/implement native calls in ios )
80+

android/app/build.gradle

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ android {
3838

3939
defaultConfig {
4040
applicationId "com.invertedx.sentinelx"
41-
minSdkVersion 16
4241
multiDexEnabled true
42+
minSdkVersion 21
4343
targetSdkVersion 28
4444
versionCode flutterVersionCode.toInteger()
4545
versionName flutterVersionName
@@ -73,6 +73,14 @@ dependencies {
7373
implementation 'com.google.protobuf:protobuf-java:3.8.0'
7474
implementation 'com.squareup.okhttp3:okhttp:3.13.1'
7575
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
76+
implementation('com.google.zxing:core:3.3.0') {
77+
transitive = true
78+
}
79+
implementation(project(path: ':tor')) {
80+
transitive = false
81+
}
82+
implementation 'org.torproject:tor-android-binary:0.3.5.8-rc-v2'
83+
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
7684
testImplementation 'junit:junit:4.12'
7785
androidTestImplementation 'com.android.support.test:runner:1.0.2'
7886
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,71 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
24
package="com.invertedx.sentinelx">
3-
4-
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
5+
<!--
6+
io.flutter.app.FlutterApplication is an android.app.Application that
57
calls FlutterMain.startInitialization(this); in its onCreate method.
68
In most cases you can leave this as-is, but you if you want to provide
79
additional functionality it is fine to subclass or reimplement
8-
FlutterApplication and put your custom class here. -->
9-
<uses-permission android:name="android.permission.INTERNET" />
10-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
10+
FlutterApplication and put your custom class here.
11+
-->
1112
<application
1213
android:name="io.flutter.app.FlutterApplication"
13-
android:label="sentinelx"
14-
android:icon="@mipmap/ic_launcher">
14+
android:icon="@mipmap/ic_launcher"
15+
android:label="Sentinel x"
16+
android:usesCleartextTraffic="true"
17+
tools:ignore="GoogleAppIndexingWarning">
1518
<activity
1619
android:name=".MainActivity"
17-
android:launchMode="singleTop"
18-
android:theme="@style/LaunchTheme"
1920
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
2021
android:hardwareAccelerated="true"
22+
android:launchMode="singleTop"
23+
android:theme="@style/LaunchTheme"
2124
android:windowSoftInputMode="adjustResize">
22-
<!-- This keeps the window background of the activity showing
25+
26+
<!--
27+
This keeps the window background of the activity showing
2328
until Flutter renders its first frame. It can be removed if
2429
there is no splash screen (such as the default splash screen
25-
defined in @style/LaunchTheme). -->
30+
defined in @style/LaunchTheme).
31+
-->
32+
<intent-filter>
33+
<action android:name="android.intent.action.MAIN" />
34+
35+
<category android:name="android.intent.category.LAUNCHER" />
36+
</intent-filter>
37+
2638
<meta-data
2739
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
2840
android:value="true" />
41+
</activity>
42+
43+
<receiver android:name=".tor.TorBroadCastReceiver" />
44+
45+
<receiver
46+
android:name="com.msopentech.thali.android.toronionproxy.ConnectionChangeReceiver"
47+
android:label="NetworkChangeReceiver">
2948
<intent-filter>
30-
<action android:name="android.intent.action.MAIN"/>
31-
<category android:name="android.intent.category.LAUNCHER"/>
49+
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
50+
<action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
3251
</intent-filter>
33-
</activity>
52+
</receiver>
53+
54+
<service
55+
android:name=".tor.TorService"
56+
android:enabled="true"
57+
android:stopWithTask="true" />
3458
</application>
35-
</manifest>
59+
60+
<uses-feature
61+
android:name="android.hardware.camera.autofocus"
62+
android:required="false"
63+
tools:node="replace" />
64+
65+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
66+
<uses-permission android:name="android.permission.CAMERA" />
67+
<uses-permission android:name="android.permission.INTERNET" />
68+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
69+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
70+
71+
</manifest>
Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,78 @@
11
package com.invertedx.sentinelx
22

3+
import android.app.NotificationChannel
4+
import android.app.NotificationManager
5+
import android.os.Build
36
import android.os.Bundle
47
import com.invertedx.sentinelx.channel.ApiChannel
58
import com.invertedx.sentinelx.channel.CryptoChannel
9+
import com.invertedx.sentinelx.channel.NetworkChannel
610
import com.invertedx.sentinelx.channel.SystemChannel
11+
import com.invertedx.sentinelx.plugins.QRCameraPlugin
12+
import com.invertedx.sentinelx.tor.TorService
713
import com.invertedx.sentinelx.utils.SentinalPrefs
814
import io.flutter.app.FlutterActivity
915
import io.flutter.plugin.common.MethodChannel
1016
import io.flutter.plugins.GeneratedPluginRegistrant
17+
import org.bitcoinj.params.MainNetParams
18+
import org.bitcoinj.params.TestNet3Params
1119

20+
typealias OnPermissionResult = (requestCode: Int, permissions: Array<out String>, grantResults: IntArray) -> Unit
1221

1322
class MainActivity : FlutterActivity() {
23+
24+
private lateinit var networkChannel: NetworkChannel
25+
private lateinit var onPermissionResultCallback: OnPermissionResult
26+
1427
override fun onCreate(savedInstanceState: Bundle?) {
1528
super.onCreate(savedInstanceState)
1629
GeneratedPluginRegistrant.registerWith(this)
1730

1831
setUpPrefs()
19-
20-
MethodChannel(flutterView, "system.channel").setMethodCallHandler(SystemChannel(applicationContext))
32+
createNotificationChannels()
33+
networkChannel = NetworkChannel(applicationContext, this);
34+
MethodChannel(flutterView, "system.channel").setMethodCallHandler(SystemChannel(applicationContext, this))
2135
MethodChannel(flutterView, "crypto.channel").setMethodCallHandler(CryptoChannel(applicationContext))
2236
MethodChannel(flutterView, "api.channel").setMethodCallHandler(ApiChannel(applicationContext))
37+
MethodChannel(flutterView, "network.channel").setMethodCallHandler(networkChannel)
38+
QRCameraPlugin.registerWith(this.registrarFor("plugins.sentinelx.qr_camera"), this)
39+
40+
}
41+
42+
43+
fun setOnPermissionResult(callback: OnPermissionResult) {
44+
this.onPermissionResultCallback = callback
45+
}
46+
47+
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
48+
if (this.onPermissionResultCallback != null) {
49+
this.onPermissionResultCallback(requestCode, permissions, grantResults)
50+
}
51+
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
2352
}
2453

2554
private fun setUpPrefs() {
2655
val prefs = SentinalPrefs(this)
27-
prefs.isTestNet = false
56+
if (prefs.firstRunComplete!!) {
57+
SentinelxApp.setNetWorkParam(if (prefs.isTestNet!!) TestNet3Params.get() else MainNetParams.get())
58+
}
59+
}
60+
61+
override fun onDestroy() {
62+
networkChannel.dispose()
63+
super.onDestroy()
64+
}
65+
66+
67+
private fun createNotificationChannels() {
68+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
69+
val serviceChannel = NotificationChannel(
70+
TorService.TOR_CHANNEL,
71+
"Tor service ",
72+
NotificationManager.IMPORTANCE_LOW
73+
)
74+
serviceChannel.setSound(null, null)
75+
getSystemService(NotificationManager::class.java)?.createNotificationChannel(serviceChannel)
76+
}
2877
}
2978
}

android/app/src/main/kotlin/com/invertedx/sentinelx/SentinelxApp.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,17 @@ fun Any.d(msg: Any? = "No Message provided") {
2525
object SentinelxApp {
2626

2727

28-
public var networkParameters: NetworkParameters = if (BuildConfig.DEBUG) TestNet3Params.get() else TestNet3Params.get()
28+
public var networkParameters: NetworkParameters = if (BuildConfig.DEBUG) TestNet3Params.get() else MainNetParams.get()
2929

3030

3131
fun isTestNet(): Boolean {
3232
return networkParameters !is MainNetParams
3333
}
3434

3535

36+
fun setNetWorkParam(param: NetworkParameters) {
37+
networkParameters = param;
38+
}
39+
40+
3641
}

0 commit comments

Comments
 (0)