Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions android/src/main/java/com/shield/ShieldModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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) {
Expand Down Expand Up @@ -130,6 +135,6 @@ class ShieldModule(reactContext: ReactApplicationContext) :
}

companion object {
const val NAME = NativeShieldSpec.NAME
const val NAME = "Shield"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -160,4 +160,4 @@
],
"version": "0.57.0"
}
}
}
Loading