pushwave-client 0.2.0 → 0.2.3
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.
|
@@ -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/react-native.config.js
CHANGED
|
@@ -6,7 +6,7 @@ module.exports = {
|
|
|
6
6
|
},
|
|
7
7
|
android: {
|
|
8
8
|
sourceDir: "android",
|
|
9
|
-
packageImportPath: "import com.pushwaveclient.PushwaveAttestationPackage",
|
|
9
|
+
packageImportPath: "import com.pushwaveclient.PushwaveAttestationPackage;",
|
|
10
10
|
packageInstance: "new PushwaveAttestationPackage()",
|
|
11
11
|
},
|
|
12
12
|
},
|