Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement setup for connecting the phone signer with the MQTT server #635

Merged
merged 63 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
43e8491
Tor binaries included on git
tomastiminskas Nov 16, 2022
2303e62
Merge branch 'develop' into tt/fix/binaries-included
tomastiminskas Aug 17, 2023
f879010
- Replace libsphinxers.so files
ariel10aguero Aug 17, 2023
e837480
Message pack implementation
tomastiminskas Jul 13, 2023
0c32618
Addition to last commit for MessagePack
tomastiminskas Jul 14, 2023
1b13ff9
merge message-pack
ariel10aguero Aug 17, 2023
12de482
Implement connect to MQTT
ariel10aguero Aug 17, 2023
008e1da
Implement connect to MQTT
ariel10aguero Aug 17, 2023
50efc2e
WIP signer setup frist approach
ariel10aguero Aug 18, 2023
85836a8
wip MQTT request falis
ariel10aguero Aug 21, 2023
a09b14a
wip signer
ariel10aguero Aug 21, 2023
2c2ed7a
Progress on signer changes
tomastiminskas Aug 21, 2023
fc6364a
wip loadmuts
ariel10aguero Aug 21, 2023
e805cf3
wip vls received
ariel10aguero Aug 21, 2023
b25cef9
Fixes
tomastiminskas Aug 21, 2023
d50ed70
- Persist clientID, lss nonce, sequence and muts permanently
ariel10aguero Aug 22, 2023
874339f
Clean Logs and code
ariel10aguero Aug 22, 2023
2beda4f
wip signer manager impl
ariel10aguero Aug 23, 2023
32b0ab8
Implement Signer Manager module
ariel10aguero Aug 23, 2023
1b91307
wip dagger provide
ariel10aguero Aug 23, 2023
f1f43de
Progress on Signer Manager implementation
tomastiminskas Aug 24, 2023
d1b20bf
replace override for private fun
ariel10aguero Aug 24, 2023
4fae5a7
Feed signer manager dependencies from fragment. Handle JSON exception
ariel10aguero Aug 24, 2023
e982511
Implement signer bottom menu
ariel10aguero Aug 25, 2023
8ab7bbb
wip signer manager callback
ariel10aguero Aug 25, 2023
25a14c0
Trigger all the sideEffects related to signer hardware from SignerMan…
ariel10aguero Aug 25, 2023
9cfdacf
Clean old logic from profile view model
ariel10aguero Aug 25, 2023
20e3586
Set SignerViewState to Idln in each case
ariel10aguero Aug 31, 2023
cba1aa1
Improvements on signer implementation
tomastiminskas Sep 4, 2023
dc0d493
Refactor generate and persist mnemonic
ariel10aguero Sep 11, 2023
f3acdb4
Remove handleLightningNodeLink from dashboard view model
ariel10aguero Sep 11, 2023
7aa6024
Remove bip39 library
ariel10aguero Sep 11, 2023
334497d
Validate glyph code
ariel10aguero Sep 12, 2023
bce47a2
Handle glyph with scanner and show signer bottom menu
ariel10aguero Sep 12, 2023
da87987
Implement signer in onboard screen
ariel10aguero Sep 12, 2023
0f49937
Add new bottom menu for seed method
ariel10aguero Sep 12, 2023
0a85dc7
Present new view for mnemonic words
ariel10aguero Sep 13, 2023
1c24d80
Build mnemonic UI
ariel10aguero Sep 13, 2023
be3ce78
Add loading screen to nemonic
ariel10aguero Sep 13, 2023
14ee37d
Validate seed
ariel10aguero Sep 14, 2023
b5ea57c
Hide keyboard when submit button is pressed
ariel10aguero Sep 14, 2023
639e9b4
Go to loading screen when validate seed
ariel10aguero Sep 14, 2023
23a1cce
Implement import mnemonic words
ariel10aguero Sep 14, 2023
b18b5c6
Replace new libsphinxrs
ariel10aguero Sep 18, 2023
4db2220
- Force lowercase on entered mnemonic
ariel10aguero Sep 18, 2023
e880f30
Add HasAdmin network call
ariel10aguero Sep 18, 2023
3c4f2fe
Replace sphinxrs and use mnemonicToSeed method
ariel10aguero Sep 18, 2023
0a3a410
Persist walletMnemonic on class var
ariel10aguero Sep 19, 2023
d5d9f74
Change bottom menu names to be consistent with iOS
ariel10aguero Sep 19, 2023
e1d69b1
Show mnemonic to user when generating words on Phone Signer
ariel10aguero Sep 19, 2023
1d99952
Set the Glyph parm to seedDto
ariel10aguero Sep 19, 2023
fd73b3c
Progress on signer signup
tomastiminskas Sep 19, 2023
d11fab7
Remove set up signer form ProfileViewModel
ariel10aguero Sep 19, 2023
eb3455e
Clean profile side effect
ariel10aguero Sep 19, 2023
8492575
process lightningUrl, handle mqtt exceptions
ariel10aguero Sep 19, 2023
e6e58bc
Last changes on signer signup
tomastiminskas Sep 20, 2023
8791af1
Fix for crash
tomastiminskas Sep 20, 2023
8d8612c
Add to setup phone signer Job
ariel10aguero Sep 20, 2023
9a756bf
Add Signer Manager on Dashboard
ariel10aguero Sep 20, 2023
e9cf68a
More fixes on signer signup
tomastiminskas Sep 20, 2023
259b6d4
Create reconnectMQTT method
ariel10aguero Sep 21, 2023
d15ca98
Reconnect to MQTT on dashboard
ariel10aguero Sep 21, 2023
fd6fb4d
Reconnecting to MQTT on launch
tomastiminskas Sep 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ buildscript {
classpath plugin.kotlin.gradle
classpath plugin.square.exhaustive
classpath plugin.square.sqlDelight
classpath plugin.kotlin.serialization
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
23 changes: 14 additions & 9 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ ext.versions = [
'okhttp': '4.9.1',
'sqlDelight': '1.5.0',
'toplAndroid': '2.1.2',
'bip39': '1.0.2',
]

/**
Expand Down Expand Up @@ -100,6 +99,9 @@ ext.deps = [
coroutinesCore: "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.coroutines}",
reflect: "org.jetbrains.kotlin:kotlin-reflect:${versions.kotlin}",
],
kotlinx: [
serialization: "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2",
],
matthewNelson: [
toplService: "io.matthewnelson.topl-android:topl-service:${versions.toplAndroid}",
toplServiceBase: "io.matthewnelson.topl-android:topl-service-base:${versions.toplAndroid}",
Expand All @@ -121,22 +123,25 @@ ext.deps = [
],
viewBindingDelegateNoReflect: "com.github.kirich1409:viewbindingpropertydelegate-noreflection:1.4.7",
giphy: [
sdk: "com.giphy.sdk:ui:2.1.2"
sdk: "com.giphy.sdk:ui:2.1.2"
],
jitsi: [
sdk: "org.jitsi.react:jitsi-meet-sdk:7.0.0"
sdk: "org.jitsi.react:jitsi-meet-sdk:7.0.0"
],
lottie: [
sdk: "com.airbnb.android:lottie:4.0.0"
],
bip39: [
sdk: "cash.z.ecc.android:kotlin-bip39:${versions.bip39}"
sdk: "com.airbnb.android:lottie:4.0.0"
],
jna: [
sdk: "net.java.dev.jna:jna:5.8.0@aar"
],
facebook: [
shimmer: "com.facebook.shimmer:shimmer:0.5.0"
],
paho: [
sdk: "org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.1"
],
msgpack: [
sdk: "com.ensarsarajcic.kotlinx:serialization-msgpack:0.5.0"
]
]

Expand Down Expand Up @@ -172,7 +177,7 @@ ext.plugin = [
square: [
exhaustive: "app.cash.exhaustive:exhaustive-gradle:0.2.0",
sqlDelight: "com.squareup.sqldelight:gradle-plugin:${versions.sqlDelight}"
],
]
]

/**
Expand Down Expand Up @@ -224,5 +229,5 @@ ext.kaptDeps = [
],
square: [
moshiCodegen: "com.squareup.moshi:moshi-kotlin-codegen:${versions.moshi}",
],
]
]
6 changes: 6 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ include ':sphinx:activity:features:connectivity-helper'
include ':sphinx:activity:concepts:concept-view-model-coordinator'
include ':sphinx:activity:features:feature-view-model-coordinator'
include ':sphinx:activity:features:video-player-controller'
include ':sphinx:activity:concepts:concept-signer-manager'
include ':sphinx:activity:features:signer-manager'

// Screens
include ':sphinx:screens:add-sats:add-sats'
Expand Down Expand Up @@ -342,3 +344,7 @@ include ':sphinx:screens-detail:delete-podcast-detail:delete-podcast-detail'
include ':sphinx:screens-detail:delete-chat-media:delete-chat-media'
include ':sphinx:screens-detail:delete-chat-media-detail:delete-chat-media-detail'
include ':sphinx:screens:threads:threads'
include ':sphinx:activity:concepts:concept-signer-manager'
include ':sphinx:activity:features:signer-manager'
include ':sphinx:application:common:menus:menu-bottom-signer'
include ':sphinx:application:common:menus:menu-bottom-phone-signer-method'
1 change: 1 addition & 0 deletions sphinx/activity/concepts/concept-signer-manager/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
4 changes: 4 additions & 0 deletions sphinx/activity/concepts/concept-signer-manager/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
plugins {
id 'java-library'
id 'kotlin'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package chat.sphinx.concept_signer_manager

interface SignerHardwareCallback {
fun checkNetwork(callback: (Boolean) -> Unit)
fun signingDeviceNetwork(callback: (String) -> Unit)
fun signingDevicePassword(networkName: String, callback: (String) -> Unit)
fun signingDeviceLightningNodeUrl(callback: (String) -> Unit)
fun signingDeviceCheckBitcoinNetwork(network: (String) -> Unit, linkSigningDevice: (Boolean) -> Unit)
fun failedToSetupSigningDevice(message: String)
fun sendingSeedToHardware()
fun signingDeviceSuccessfullySet()
fun showMnemonicToUser(message: String, callback: (Boolean) -> Unit)
}

interface SignerPhoneCallback {
fun showMnemonicToUser(message: String, callback: (Boolean) -> Unit)
fun phoneSignerSuccessfullySet()
fun phoneSignerSetupError()
}

interface CheckAdminCallback {
fun checkAdminFailed()
fun checkAdminSucceeded()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package chat.sphinx.concept_signer_manager

abstract class SignerManager {
abstract fun setupPhoneSigner(mnemonicWords: String?, signerPhoneCallback: SignerPhoneCallback)
abstract fun setupSignerHardware(signerHardwareCallback: SignerHardwareCallback)

abstract fun reconnectMQTT(signerPhoneCallback: SignerPhoneCallback)

abstract fun setWalletDataHandler(walletDataHandlerInstance: Any)
abstract fun setMoshi(moshiInstance: Any)
abstract fun setNetworkQueryCrypter(networkQueryCrypterInstance: Any)
abstract fun setNetworkQueryContact(networkQueryContactInstance: Any)

abstract fun setSeedFromGlyph(mqtt: String, network: String, relay: String)

abstract fun isPhoneSignerSettingUp() : Boolean
abstract fun persistMnemonic()
abstract suspend fun getPublicKeyAndRelayUrl(): Pair<String, String>?
abstract suspend fun checkHasAdmin(checkAdminCallback: CheckAdminCallback)

abstract fun reset()
}
1 change: 1 addition & 0 deletions sphinx/activity/features/signer-manager/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
63 changes: 63 additions & 0 deletions sphinx/activity/features/signer-manager/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
plugins {
id 'app.cash.exhaustive'
id 'com.android.library'
id 'kotlin-android'
id 'kotlinx-serialization'
}

android {
compileSdkVersion versions.compileSdk
buildToolsVersion versions.buildTools

defaultConfig {
minSdkVersion versions.minSdk
targetSdkVersion versions.compileSdk
versionCode VERSION_CODE.toInteger()
versionName VERSION_NAME

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments disableAnalytics: 'true'
consumerProguardFiles "consumer-rules.pro"
}

buildTypes {
release {
minifyEnabled false
}
}
}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
api project(path: ':kotlin:concepts:concept-coroutines')

implementation project(path: ':kotlin:encoders:base64')

// Sphinx
api project(path: ':sphinx:activity:concepts:concept-signer-manager')

implementation project(path: ':sphinx:screens-detail:common:detail-resources')
implementation project(path: ':sphinx:application:common:resources')
implementation project(path: ':sphinx:application:data:concepts:repositories:concept-repository-lightning')
implementation project(path: ':sphinx:application:data:concepts:concept-wallet')
implementation project(path: ':sphinx:application:common:wrappers:wrapper-message-media')

implementation project(path: ':sphinx:application:data:concepts:concept-background-login')
implementation project(path: ':sphinx:application:data:concepts:repositories:concept-repository-media')
implementation project(path: ':sphinx:application:data:concepts:repositories:concept-repository-contact')
implementation project(path: ':sphinx:application:network:concepts:queries:concept-network-query-crypter')
implementation project(path: ':sphinx:application:network:concepts:queries:concept-network-query-contact')
implementation project(path: ':sphinx:application:data:concepts:concept-relay')

implementation deps.jncryptor

implementation deps.androidx.lifecycle.hilt
implementation deps.jna.sdk
implementation deps.paho.sdk
implementation deps.kotlinx.serialization
implementation deps.msgpack.sdk
implementation deps.square.moshi


testImplementation project(path: ':kotlin:test:test-concept-coroutines')
}
Empty file.
21 changes: 21 additions & 0 deletions sphinx/activity/features/signer-manager/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="chat.sphinx.signer_manager"/>
Loading