Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,50 @@ ProofMode is light, minimal "reboot" of our full encrypted, verified secure came

While we are very proud of the work we did with the CameraV and InformaCam projects, the end results was a complex application and proprietary data format that required a great deal of investment by any user or community that wished to adopt it. Furthermore, it was an app that you had to decide and remember to use, in a moment of crisis. With ProofMode, we both wanted to simplify the adoption of the tool, and make it nearly invisible to the end-user, while making it the adoption of the tool by organizations painless through simple formats like CSV and known formats like PGP signatures.

# ✨ NEW: Web3 Wallet Integration

This version of ProofMode includes Web3 wallet authentication through Privy SDK integration, enabling users to securely authenticate and manage cryptographic wallets alongside their proof data.

## Features

- **SMS/Email OTP Authentication**: Secure phone number and email verification using Privy's authentication system
- **Embedded Wallet Creation**: Automatic Ethereum wallet generation for authenticated users
- **Cross-Platform Ready**: Implementation designed to match iOS patterns for future consistency
- **Secure Key Management**: Wallet addresses and authentication state managed through encrypted storage

## Setup

To enable Web3 wallet functionality:

1. **Configure Privy Credentials**:
- Open `app/src/main/java/org/witness/proofmode/crypto/privy/PrivyConfig.kt`
- Add your Privy `APP_ID` and `APP_CLIENT_ID` from your Privy dashboard

2. **Dependencies**:
- The required Privy SDK dependency is already included in `app/build.gradle`
- No additional setup required

## Usage

Users can access Web3 wallet features through the new "Web3 Wallet" option in the app, allowing them to:
- Authenticate using phone number or email with OTP verification
- Generate and manage embedded Ethereum wallets
- View wallet addresses and connection status
- Securely logout and disconnect wallets

## Implementation Details

- **PrivyManager.kt**: Core wallet management and authentication logic
- **PrivyConfig.kt**: Configuration for Privy SDK credentials
- **Web3WalletAuthActivity.kt**: User interface for authentication flow
- Full error handling and logging for debugging authentication issues

For detailed documentation:
- **[Web3 Wallet Setup Guide](docs/web3-wallet-setup.md)**: Step-by-step configuration and troubleshooting
- **[Technical Documentation](docs/web3-wallet-integration.md)**: Architecture details and implementation notes

This integration enhances ProofMode's cryptographic capabilities while maintaining the app's core principle of invisible, automatic operation.

# Design Goals

* Run all of the time in the background without noticeable battery, storage or network impact
Expand Down
1 change: 1 addition & 0 deletions android-libproofcam/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
kotlin("android")
kotlin("kapt")
id("androidx.navigation.safeargs")
id("org.jetbrains.kotlin.plugin.compose")
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class ProofMode {

public final static String PREF_CREDENTIALS_PRIMARY = "prefCredsPrimary";

public final static String PREF_OPTION_WEB3_WALLET = "web3Wallet";


public final static boolean PREF_OPTION_NOTARY_DEFAULT = true;
public final static boolean PREF_OPTION_LOCATION_DEFAULT = true;
Expand All @@ -65,6 +67,8 @@ public class ProofMode {

public final static boolean PREF_OPTION_AI_DEFAULT = true;

public final static boolean PREF_OPTION_WEB3_WALLET_DEFAULT = false;

public final static String PROOF_FILE_TAG = ".proof.csv";
public final static String PROOF_FILE_JSON_TAG = ".proof.json";
public final static String OPENPGP_FILE_TAG = ".asc";
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'com.google.devtools.ksp' version '1.9.0-1.0.13'
id 'com.google.devtools.ksp' version '2.1.0-1.0.29'
id 'org.jetbrains.kotlin.plugin.serialization'
id 'org.jetbrains.kotlin.plugin.compose'
}


Expand Down Expand Up @@ -33,7 +34,7 @@ android {

defaultConfig {
applicationId "org.witness.proofmode"
minSdkVersion 28
minSdkVersion 24
targetSdkVersion 34
versionCode 260303
versionName "2.6.0-RC-3"
Expand Down Expand Up @@ -199,7 +200,6 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'


implementation("com.google.zxing:core:3.4.1")



Expand Down
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@
android:label="Filebase Settings"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".Web3WalletAuthActivity"
android:label="Web3 Wallet"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />

<receiver
android:name=".org.witness.proofmode.util.OnBootReceiver"
Expand Down
36 changes: 36 additions & 0 deletions app/src/main/java/org/witness/proofmode/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ import android.view.MenuItem
import android.widget.CheckBox
import android.widget.CompoundButton
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.Observer
import androidx.preference.PreferenceManager
import com.google.android.gms.common.AccountPicker
import com.google.android.gms.common.AccountPicker.AccountChooserOptions
import org.witness.proofmode.PermissionActivity.Companion.hasPermissions
import org.witness.proofmode.ProofMode.PREF_CREDENTIALS_PRIMARY
import org.witness.proofmode.c2pa.C2paUtils
import org.witness.proofmode.crypto.pgp.PgpUtils
import org.witness.proofmode.crypto.privy.PrivyManager
import org.witness.proofmode.databinding.ActivitySettingsBinding
import org.witness.proofmode.storage.FilebaseConfig
import org.witness.proofmode.util.GPSTracker
Expand All @@ -34,6 +36,9 @@ class SettingsActivity : AppCompatActivity() {
private lateinit var switchAI: CheckBox
private lateinit var switchAutoImport: CheckBox
private lateinit var switchAutoSync: CheckBox
private lateinit var switchWeb3Wallet: CheckBox

private lateinit var privyManager: PrivyManager

private lateinit var binding:ActivitySettingsBinding
override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -48,6 +53,8 @@ class SettingsActivity : AppCompatActivity() {
val title = binding.toolbarTitle
title.text = getTitle()
mPrefs = PreferenceManager.getDefaultSharedPreferences(this)
privyManager = PrivyManager.getInstance(this)

switchLocation = binding.contentSettings.switchLocation
switchNetwork = binding.contentSettings.switchNetwork
switchDevice = binding.contentSettings.switchDevice
Expand All @@ -56,6 +63,7 @@ class SettingsActivity : AppCompatActivity() {
switchAI = binding.contentSettings.switchAI
switchAutoImport = binding.contentSettings.switchAutoImport
switchAutoSync = binding.contentSettings.switchAutoSync
switchWeb3Wallet = binding.contentSettings.switchWeb3Wallet



Expand Down Expand Up @@ -176,6 +184,31 @@ class SettingsActivity : AppCompatActivity() {

}

// Setup Web3 wallet settings
switchWeb3Wallet.setOnCheckedChangeListener { _: CompoundButton?, isChecked: Boolean ->
mPrefs.edit().putBoolean(ProofMode.PREF_OPTION_WEB3_WALLET, isChecked).commit()

if (isChecked) {
// Open Web3 wallet authentication activity
val intent = Intent(this, Web3WalletAuthActivity::class.java)
startActivity(intent)
} else {
// Disconnect wallet
privyManager.disconnectWallet()
}

updateUI()
}

// Observe Privy manager state changes
privyManager.isConnected.observe(this, Observer { isConnected ->
// Update the switch state based on connection status
if (switchWeb3Wallet.isChecked != isConnected) {
switchWeb3Wallet.isChecked = isConnected
mPrefs.edit().putBoolean(ProofMode.PREF_OPTION_WEB3_WALLET, isConnected).apply()
}
})

}

private val REQ_ACCOUNT_CHOOSER = 9999;
Expand Down Expand Up @@ -219,6 +252,9 @@ class SettingsActivity : AppCompatActivity() {
switchAutoImport.isChecked =
mPrefs.getBoolean(ProofMode.PREFS_DOPROOF, false)

switchWeb3Wallet.isChecked =
mPrefs.getBoolean(ProofMode.PREF_OPTION_WEB3_WALLET, ProofMode.PREF_OPTION_WEB3_WALLET_DEFAULT)

}

override fun onResume() {
Expand Down
Loading