Skip to content

Instantly share code, notes, and snippets.

Last active April 27, 2018 01:11
What would you like to do?
RNDemo - Approov native module
package com.criticalblue.approov;
import ...
import com.criticalblue.attestationlibrary.ApproovAttestation;
import com.criticalblue.attestationlibrary.ApproovConfig;
import com.criticalblue.attestationlibrary.TokenInterface;
class ApproovModule extends ReactContextBaseJavaModule {
private static final String E_APPROOV_ERROR = "E_APPROOV_ERROR";
private Context context;
public ApproovModule(ReactApplicationContext reactContext) {
this.context = reactContext;
try {
ApproovConfig config = ApproovConfig.getDefaultConfig(reactContext);
} catch (IllegalArgumentException ex) {
} catch (MalformedURLException ex) {
public String getName() {
return "Approov";
public void fetchApproovToken(final String url, final Promise promise) {
ApproovAttestation.shared().fetchApproovToken(new TokenInterface() {
public void approovTokenFetchResult(ApproovResults results) {
if (results.getResult() == ApproovAttestation.AttestationResult.SUCCESS)
promise.reject(E_APPROOV_ERROR, "Failed to fetch Approov Token");
}, url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment