Upgrade snet extension
This commit is contained in:
parent
79418a3767
commit
3e22573d8d
@ -8,7 +8,7 @@ android {
|
|||||||
applicationId "com.topjohnwu.snet"
|
applicationId "com.topjohnwu.snet"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion rootProject.ext.compileSdkVersion
|
targetSdkVersion rootProject.ext.compileSdkVersion
|
||||||
versionCode 11
|
versionCode 12
|
||||||
versionName "snet"
|
versionName "snet"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,5 +23,5 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
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'
|
||||||
}
|
}
|
||||||
|
3
snet/proguard-rules.pro
vendored
3
snet/proguard-rules.pro
vendored
@ -21,3 +21,6 @@
|
|||||||
#-renamesourcefileattribute SourceFile
|
#-renamesourcefileattribute SourceFile
|
||||||
|
|
||||||
-keep class com.topjohnwu.snet.Snet { *; }
|
-keep class com.topjohnwu.snet.Snet { *; }
|
||||||
|
|
||||||
|
-repackageclasses ''
|
||||||
|
-allowaccessmodification
|
||||||
|
@ -5,7 +5,6 @@ import android.app.AlertDialog;
|
|||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@ -27,6 +26,8 @@ import java.lang.reflect.InvocationHandler;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
public class SafetyNetHelper implements InvocationHandler,
|
public class SafetyNetHelper implements InvocationHandler,
|
||||||
OnSuccessListener<SafetyNetApi.AttestationResponse>, OnFailureListener {
|
OnSuccessListener<SafetyNetApi.AttestationResponse>, OnFailureListener {
|
||||||
|
|
||||||
@ -39,9 +40,6 @@ public class SafetyNetHelper implements InvocationHandler,
|
|||||||
private static final SecureRandom RANDOM = new SecureRandom();
|
private static final SecureRandom RANDOM = new SecureRandom();
|
||||||
private static final String TAG = "SNET";
|
private static final String TAG = "SNET";
|
||||||
|
|
||||||
/* Insert the magic API key here :) */
|
|
||||||
private static final String API_KEY = "";
|
|
||||||
|
|
||||||
private final Activity mActivity;
|
private final Activity mActivity;
|
||||||
private final Object callback;
|
private final Object callback;
|
||||||
|
|
||||||
@ -57,6 +55,11 @@ public class SafetyNetHelper implements InvocationHandler,
|
|||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return magic API key here :) */
|
||||||
|
private String getApiKey() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
/* Override ISafetyNetHelper.getVersion */
|
/* Override ISafetyNetHelper.getVersion */
|
||||||
private int getVersion() {
|
private int getVersion() {
|
||||||
return BuildConfig.VERSION_CODE;
|
return BuildConfig.VERSION_CODE;
|
||||||
@ -76,7 +79,7 @@ public class SafetyNetHelper implements InvocationHandler,
|
|||||||
RANDOM.nextBytes(nonce);
|
RANDOM.nextBytes(nonce);
|
||||||
|
|
||||||
SafetyNetClient client = SafetyNet.getClient(mActivity.getBaseContext());
|
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) {
|
private Dialog getErrorDialog(int errorCode, int requestCode) {
|
||||||
|
Loading…
Reference in New Issue
Block a user