Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
3e22573d
Commit
3e22573d
authored
Oct 28, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade snet extension
parent
79418a37
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
7 deletions
+13
-7
build.gradle
snet/build.gradle
+2
-2
proguard-rules.pro
snet/proguard-rules.pro
+3
-0
SafetyNetHelper.java
snet/src/main/java/com/topjohnwu/snet/SafetyNetHelper.java
+8
-5
No files found.
snet/build.gradle
View file @
3e22573d
...
...
@@ -8,7 +8,7 @@ android {
applicationId
"com.topjohnwu.snet"
minSdkVersion
14
targetSdkVersion
rootProject
.
ext
.
compileSdkVersion
versionCode
1
1
versionCode
1
2
versionName
"snet"
}
...
...
@@ -23,5 +23,5 @@ android {
dependencies
{
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
implementation
'com.google.android.gms:play-services-safetynet:1
5.0.1
'
implementation
'com.google.android.gms:play-services-safetynet:1
6.0.0
'
}
snet/proguard-rules.pro
View file @
3e22573d
...
...
@@ -21,3 +21,6 @@
#-renamesourcefileattribute SourceFile
-
keep
class
com
.
topjohnwu
.
snet
.
Snet
{
*
;
}
-
repackageclasses
''
-
allowaccessmodification
snet/src/main/java/com/topjohnwu/snet/SafetyNetHelper.java
View file @
3e22573d
...
...
@@ -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
<
SafetyNetApi
.
AttestationResponse
>,
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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment