pushwave-client 0.1.9 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/android/build.gradle
CHANGED
|
@@ -51,5 +51,5 @@ repositories {
|
|
|
51
51
|
dependencies {
|
|
52
52
|
implementation "com.facebook.react:react-native:+"
|
|
53
53
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
54
|
-
implementation "com.google.android.play:integrity:1.
|
|
54
|
+
implementation "com.google.android.play:integrity:1.6.0"
|
|
55
55
|
}
|
|
@@ -6,9 +6,9 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
|
6
6
|
import com.facebook.react.bridge.ReactMethod
|
|
7
7
|
import com.google.android.gms.tasks.OnFailureListener
|
|
8
8
|
import com.google.android.gms.tasks.OnSuccessListener
|
|
9
|
+
import com.google.android.play.core.integrity.IntegrityManager
|
|
9
10
|
import com.google.android.play.core.integrity.IntegrityManagerFactory
|
|
10
|
-
import com.google.android.play.core.integrity.
|
|
11
|
-
import com.google.android.play.core.integrity.StandardIntegrityTokenRequest
|
|
11
|
+
import com.google.android.play.core.integrity.IntegrityTokenRequest
|
|
12
12
|
|
|
13
13
|
class PushwaveAttestationModule(private val context: ReactApplicationContext) :
|
|
14
14
|
ReactContextBaseJavaModule(context) {
|
|
@@ -18,19 +18,20 @@ class PushwaveAttestationModule(private val context: ReactApplicationContext) :
|
|
|
18
18
|
@ReactMethod
|
|
19
19
|
fun getIntegrityToken(nonce: String, promise: Promise) {
|
|
20
20
|
try {
|
|
21
|
-
val
|
|
22
|
-
|
|
23
|
-
val request = StandardIntegrityTokenRequest.builder()
|
|
21
|
+
val manager: IntegrityManager = IntegrityManagerFactory.create(context)
|
|
22
|
+
val request = IntegrityTokenRequest.builder()
|
|
24
23
|
.setNonce(nonce)
|
|
25
24
|
.build()
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
.addOnSuccessListener(
|
|
29
|
-
promise.resolve(response.token())
|
|
30
|
-
|
|
31
|
-
.addOnFailureListener(
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
manager.requestIntegrityToken(request)
|
|
27
|
+
.addOnSuccessListener(
|
|
28
|
+
OnSuccessListener { response -> promise.resolve(response.token()) }
|
|
29
|
+
)
|
|
30
|
+
.addOnFailureListener(
|
|
31
|
+
OnFailureListener { error ->
|
|
32
|
+
promise.reject("PLAY_INTEGRITY_ERROR", error.localizedMessage, error)
|
|
33
|
+
}
|
|
34
|
+
)
|
|
34
35
|
} catch (e: Exception) {
|
|
35
36
|
promise.reject("PLAY_INTEGRITY_ERROR", e.localizedMessage, e)
|
|
36
37
|
}
|
package/package.json
CHANGED
package/plugin/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
|
|
7
7
|
const pkg = require("../package.json");
|
|
8
8
|
|
|
9
|
-
const PLAY_INTEGRITY_DEP = 'implementation("com.google.android.play:integrity:1.
|
|
9
|
+
const PLAY_INTEGRITY_DEP = 'implementation("com.google.android.play:integrity:1.6.0")';
|
|
10
10
|
|
|
11
11
|
function injectDependency(contents) {
|
|
12
12
|
if (contents.includes(PLAY_INTEGRITY_DEP)) return contents;
|