diff --git a/README.md b/README.md index ebec462..2e7fb5b 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,11 @@ ## Installation ```sh -npm install @thinkgrid-labs/react-native-shield +npm install @think-grid-labs/react-native-shield # or -yarn add @thinkgrid-labs/react-native-shield +yarn add @think-grid-labs/react-native-shield # or -pnpm add @thinkgrid-labs/react-native-shield +pnpm add @think-grid-labs/react-native-shield ``` ### iOS Setup @@ -37,7 +37,7 @@ cd ios && pod install Import the library in your component: ```tsx -import { isRooted, addSSLPinning, preventScreenshot } from '@thinkgrid-labs/react-native-shield'; +import { isRooted, addSSLPinning, preventScreenshot } from '@think-grid-labs/react-native-shield'; ``` ### 1. Device Integrity (Root/Jailbreak Detection) @@ -116,7 +116,7 @@ preventScreenshot(false); Store sensitive data (like auth tokens, API keys) securely. ```tsx -import { setSecureString, getSecureString, removeSecureString } from '@thinkgrid-labs/react-native-shield'; +import { setSecureString, getSecureString, removeSecureString } from '@think-grid-labs/react-native-shield'; const manageSecrets = async () => { // 1. Save a secret diff --git a/android/src/main/java/com/shield/ShieldModule.kt b/android/src/main/java/com/shield/ShieldModule.kt index acb1fe4..eff48a0 100644 --- a/android/src/main/java/com/shield/ShieldModule.kt +++ b/android/src/main/java/com/shield/ShieldModule.kt @@ -16,7 +16,10 @@ class ShieldModule(reactContext: ReactApplicationContext) : try { val pinnerBuilder = okhttp3.CertificatePinner.Builder() for (i in 0 until publicKeyHashes.size()) { - pinnerBuilder.add(domain, publicKeyHashes.getString(i)) + val hash = publicKeyHashes.getString(i) + if (hash != null) { + pinnerBuilder.add(domain, hash) + } } val certificatePinner = pinnerBuilder.build() @@ -29,6 +32,8 @@ class ShieldModule(reactContext: ReactApplicationContext) : } catch (e: Exception) { promise.reject("SSL_PINNING_ERROR", e) } + } + override fun preventScreenshot(prevent: Boolean, promise: com.facebook.react.bridge.Promise) { val activity = currentActivity if (activity == null) { @@ -130,6 +135,6 @@ class ShieldModule(reactContext: ReactApplicationContext) : } companion object { - const val NAME = NativeShieldSpec.NAME + const val NAME = "Shield" } } diff --git a/package.json b/package.json index df13b4e..5267bc3 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@thinkgrid-labs/react-native-shield", + "name": "@think-grid-labs/react-native-shield", "version": "0.1.0", "description": "All-in-one security suite", "main": "./lib/module/index.js", @@ -160,4 +160,4 @@ ], "version": "0.57.0" } -} +} \ No newline at end of file