mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2025-01-30 12:37:33 +01:00
Use different API key for SafetyNet checks
This commit is contained in:
parent
0497f7ead3
commit
af28974d97
@ -42,7 +42,7 @@ class SafetyNetPreferencesFragment : PreferenceFragmentCompat() {
|
||||
runAttest.setIcon(R.drawable.ic_circle_pending)
|
||||
runAttest.setSummary(R.string.pref_test_summary_running)
|
||||
val handler = Handler(Looper.myLooper()!!)
|
||||
SafetyNetClientServiceImpl(context, "com.scottyab.safetynet.sample", lifecycle).attestWithApiKey(object : ISafetyNetCallbacks.Default() {
|
||||
SafetyNetClientServiceImpl(context, context.packageName, lifecycle).attestWithApiKey(object : ISafetyNetCallbacks.Default() {
|
||||
override fun onAttestationData(status: Status?, attestationData: AttestationData?) {
|
||||
handler.post {
|
||||
if (status?.isSuccess == true) {
|
||||
@ -95,7 +95,7 @@ class SafetyNetPreferencesFragment : PreferenceFragmentCompat() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}, Random.nextBytes(32), "AIzaSyAfcNLBpWkqrt50mluU6GswUmtysmLn9cY")
|
||||
}, Random.nextBytes(32), "AIzaSyCcJO6IZiA5Or_AXw3LFdaTCmpnfL4pJ-Q")
|
||||
true
|
||||
}
|
||||
runReCaptcha.setOnPreferenceClickListener {
|
||||
@ -103,7 +103,7 @@ class SafetyNetPreferencesFragment : PreferenceFragmentCompat() {
|
||||
runReCaptcha.setIcon(R.drawable.ic_circle_pending)
|
||||
runReCaptcha.setSummary(R.string.pref_test_summary_running)
|
||||
val handler = Handler(Looper.myLooper()!!)
|
||||
SafetyNetClientServiceImpl(context, "com.blogspot.android_er.recaptcha", lifecycle).verifyWithRecaptcha(object : ISafetyNetCallbacks.Default() {
|
||||
SafetyNetClientServiceImpl(context, context.packageName, lifecycle).verifyWithRecaptcha(object : ISafetyNetCallbacks.Default() {
|
||||
override fun onRecaptchaResult(status: Status?, recaptchaResultData: RecaptchaResultData?) {
|
||||
handler.post {
|
||||
if (status?.isSuccess == true) {
|
||||
@ -115,7 +115,7 @@ class SafetyNetPreferencesFragment : PreferenceFragmentCompat() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}, "6LdMKyUUAAAAAN0ndw7byI03_qpbpjxKY-mTQnLw")
|
||||
}, "6Lc4TzgeAAAAAJnW7Jbo6UtQ0xGuTKjHAeyhINuq")
|
||||
true
|
||||
}
|
||||
}
|
||||
|
@ -100,9 +100,6 @@ public class Attestation {
|
||||
try {
|
||||
return ByteString.of(getPackageFileDigest(context, packageName));
|
||||
} catch (Exception e) {
|
||||
if (packageName.equals("com.scottyab.safetynet.sample")) {
|
||||
return ByteString.decodeHex("66a3b8ff8c9444ec14eee94fa006548c4c7b542d54c27f3b06635e459e77c9a0");
|
||||
}
|
||||
Log.w(TAG, e);
|
||||
return null;
|
||||
}
|
||||
@ -130,9 +127,6 @@ public class Attestation {
|
||||
}
|
||||
return res;
|
||||
} catch (Exception e) {
|
||||
if (packageName.equals("com.scottyab.safetynet.sample")) {
|
||||
return Collections.singletonList(ByteString.decodeHex("31936c0e1cfc54024c985c4f3eca37f1946f644eabed5232cd4ab2a646a41bc1"));
|
||||
}
|
||||
Log.w(TAG, e);
|
||||
return null;
|
||||
}
|
||||
|
@ -148,22 +148,14 @@ class SafetyNetClientServiceImpl(private val context: Context, private val packa
|
||||
val packageFileDigest = try {
|
||||
Base64.encodeToString(Attestation.getPackageFileDigest(context, packageName), Base64.URL_SAFE or Base64.NO_WRAP or Base64.NO_PADDING)
|
||||
} catch (e: Exception) {
|
||||
if (packageName == "com.blogspot.android_er.recaptcha") {
|
||||
"kXkOWm-DT-q__5MnrdyCRLowptdd2PjNA1RAnyQ1A-4"
|
||||
} else {
|
||||
callbacks.onRecaptchaResult(Status(SafetyNetStatusCodes.ERROR, e.localizedMessage), null)
|
||||
return
|
||||
}
|
||||
callbacks.onRecaptchaResult(Status(SafetyNetStatusCodes.ERROR, e.localizedMessage), null)
|
||||
return
|
||||
}
|
||||
val packageSignatures = try {
|
||||
Attestation.getPackageSignatures(context, packageName).map { Base64.encodeToString(it, Base64.URL_SAFE or Base64.NO_WRAP or Base64.NO_PADDING) }
|
||||
} catch (e: Exception) {
|
||||
if (packageName == "com.blogspot.android_er.recaptcha") {
|
||||
listOf("xgEpqm72luj7TLUt7kMxIyN-orV6v03_T_yCkR4A93Y")
|
||||
} else {
|
||||
callbacks.onRecaptchaResult(Status(SafetyNetStatusCodes.ERROR, e.localizedMessage), null)
|
||||
return
|
||||
}
|
||||
callbacks.onRecaptchaResult(Status(SafetyNetStatusCodes.ERROR, e.localizedMessage), null)
|
||||
return
|
||||
}
|
||||
params.appendUrlEncodedParam("k", siteKey)
|
||||
.appendUrlEncodedParam("di", androidId.toString())
|
||||
|
Loading…
x
Reference in New Issue
Block a user