Skip to content

Commit

Permalink
Merge pull request #17 from torusresearch/FD-565
Browse files Browse the repository at this point in the history
Fd 565 proguard configuration
  • Loading branch information
chaitanyapotti authored Jan 4, 2022
2 parents 7ccf9f9 + 8ab066c commit 0055293
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 45 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

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

2 changes: 1 addition & 1 deletion .idea/misc.xml

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

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ or

6. Reach out to [email protected] to get your verifier spun up on the testnet today!

## Proguard
No Proguard configuration is required. SDK will automatically append necessary rules to the project's proguard-rules.txt file.

## Examples

Please refer to example for configuration
Expand Down
12 changes: 11 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ plugins {
}

android {
signingConfigs {

release {
storeFile file('/Users/tanuj/Desktop/Torus/custom auth/custom_auth_keystore')
storePassword 'torus123'
keyAlias 'key1'
keyPassword 'torus123'
}
}
compileSdk 31

defaultConfig {
Expand All @@ -22,8 +31,9 @@ android {

buildTypes {
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
compileOptions {
Expand Down
39 changes: 21 additions & 18 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# 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 *;
#}
-keep class org.torusresearch.customauth.app.* { *; }

##### okhttp3
# okHttp3
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault
# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**
# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
# OkHttp platform used only on JVM and when Conscrypt dependency is available.
-dontwarn okhttp3.internal.platform.ConscryptPlatform
# I was able to get rid of this issue adding this Proguard line to my configuration :
-keep class okhttp3.Headers { *; }

#### GSON
# Prevent proguard from stripping interface information from TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

# 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
9 changes: 5 additions & 4 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ android {
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
consumerProguardFiles "proguard-rules.pro"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
consumerProguardFiles 'proguard-rules.pro'
}
}
compileOptions {
Expand All @@ -36,9 +37,9 @@ dependencies {
api 'org.torusresearch:fetch-node-details-java:1.0.10'
api 'org.torusresearch:torus-utils-java:1.0.13'
api 'androidx.browser:browser:1.4.0'
api 'org.web3j:crypto:4.6.0-android'
api 'org.web3j:crypto:4.8.8-android'
implementation 'com.auth0.android:jwtdecode:2.0.1'
implementation 'com.squareup.okhttp3:okhttp:4.9.2'
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
Expand Down
73 changes: 52 additions & 21 deletions sdk/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,52 @@
# 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
#-keep class org.torusresearch.customauth.app.* { *; }
#-keep class org.torusresearch.customauth.** { *; }
#-keepclassmembers class org.torusresearch.customauth.**

# Web3j rules https://github.com/web3j/web3j/wiki/Android-ProGuard-rules-for-web3j-android
-dontwarn java8.util.**
-dontwarn jnr.posix.**
-dontwarn com.kenai.**

-keep class org.bouncycastle.**
-dontwarn org.bouncycastle.jce.provider.X509LDAPCertStoreSpi
-dontwarn org.bouncycastle.x509.util.LDAPStoreHelper

-keepclassmembers class org.web3j.protocol.** { *; }
-keepclassmembers class org.web3j.crypto.* { *; }

-keep class * extends org.web3j.abi.TypeReference
-keep class * extends org.web3j.abi.datatypes.Type

-dontwarn java.lang.SafeVarargs
-dontwarn org.slf4j.**

-dontwarn com.fasterxml.jackson.databind.**
-keep class org.** {*;}
-keep class com.fasterxml.jackson.core.** {*;}
-keep public class * extends com.fasterxml.jackson.core.*
-keep class com.fasterxml.jackson.databind.introspect.VisibilityChecker$Std.*
-keep class com.fasterxml.jackson.databind.ObjectMapper.*
-keep class com.fasterxml.jackson.databind.** {*;}
-keep public class * extends com.fasterxml.jackson.databind.*
-keep class com.fasterxml.jackson.annotation.** {*;}
-keep interface com.fasterxml.jackson.annotation.** {*;}
#########################################################

##### okhttp3
# okHttp3
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault
# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**
# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
# OkHttp platform used only on JVM and when Conscrypt dependency is available.
-dontwarn okhttp3.internal.platform.ConscryptPlatform
-keep class okhttp3.Headers { *; }

#### GSON
# Prevent proguard from stripping interface information from TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

0 comments on commit 0055293

Please sign in to comment.