diff --git a/snet/build.gradle b/snet/build.gradle index 36660f28e..5ed9c6d22 100644 --- a/snet/build.gradle +++ b/snet/build.gradle @@ -8,7 +8,7 @@ android { applicationId "com.topjohnwu.snet" minSdkVersion 14 targetSdkVersion rootProject.ext.compileSdkVersion - versionCode 11 + versionCode 12 versionName "snet" } @@ -23,5 +23,5 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.google.android.gms:play-services-safetynet:15.0.1' + implementation 'com.google.android.gms:play-services-safetynet:16.0.0' } diff --git a/snet/proguard-rules.pro b/snet/proguard-rules.pro index 290952c23..83a35f656 100644 --- a/snet/proguard-rules.pro +++ b/snet/proguard-rules.pro @@ -21,3 +21,6 @@ #-renamesourcefileattribute SourceFile -keep class com.topjohnwu.snet.Snet { *; } + +-repackageclasses '' +-allowaccessmodification diff --git a/snet/src/main/java/com/topjohnwu/snet/SafetyNetHelper.java b/snet/src/main/java/com/topjohnwu/snet/SafetyNetHelper.java index 3a0ac0b7c..34015a6bb 100644 --- a/snet/src/main/java/com/topjohnwu/snet/SafetyNetHelper.java +++ b/snet/src/main/java/com/topjohnwu/snet/SafetyNetHelper.java @@ -5,7 +5,6 @@ import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.Intent; -import androidx.annotation.NonNull; import android.util.Base64; import android.util.Log; @@ -27,6 +26,8 @@ import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.security.SecureRandom; +import androidx.annotation.NonNull; + public class SafetyNetHelper implements InvocationHandler, OnSuccessListener, OnFailureListener { @@ -39,9 +40,6 @@ public class SafetyNetHelper implements InvocationHandler, private static final SecureRandom RANDOM = new SecureRandom(); private static final String TAG = "SNET"; - /* Insert the magic API key here :) */ - private static final String API_KEY = ""; - private final Activity mActivity; private final Object callback; @@ -57,6 +55,11 @@ public class SafetyNetHelper implements InvocationHandler, } catch (Exception ignored) {} } + /* Return magic API key here :) */ + private String getApiKey() { + return ""; + } + /* Override ISafetyNetHelper.getVersion */ private int getVersion() { return BuildConfig.VERSION_CODE; @@ -76,7 +79,7 @@ public class SafetyNetHelper implements InvocationHandler, RANDOM.nextBytes(nonce); SafetyNetClient client = SafetyNet.getClient(mActivity.getBaseContext()); - client.attest(nonce, API_KEY).addOnSuccessListener(this).addOnFailureListener(this); + client.attest(nonce, getApiKey()).addOnSuccessListener(this).addOnFailureListener(this); } private Dialog getErrorDialog(int errorCode, int requestCode) {