Skip to content

Commit e720def

Browse files
committed
chore: add github pages/docs
2 parents 9ef2cc3 + 5264bed commit e720def

21 files changed

Lines changed: 983 additions & 0 deletions

.github/workflows/docs.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy Docs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'docs/**'
8+
- '.github/workflows/docs.yml'
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: pages
18+
cancel-in-progress: true
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version: 20
31+
cache: npm
32+
cache-dependency-path: docs/package.json
33+
34+
- name: Install docs dependencies
35+
working-directory: docs
36+
run: npm install
37+
38+
- name: Build VitePress site
39+
working-directory: docs
40+
run: npm run docs:build
41+
42+
- name: Upload Pages artifact
43+
uses: actions/upload-pages-artifact@v3
44+
with:
45+
path: docs/.vitepress/dist
46+
47+
deploy:
48+
needs: build
49+
runs-on: ubuntu-latest
50+
environment:
51+
name: github-pages
52+
url: ${{ steps.deployment.outputs.page_url }}
53+
steps:
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v4

docs/.vitepress/config.js

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
import { defineConfig } from 'vitepress';
2+
3+
export default defineConfig({
4+
title: 'react-native-shield',
5+
description:
6+
'All-in-one security suite for React Native — root detection, jailbreak detection, SSL pinning, biometric authentication, secure storage, and Play Integrity attestation.',
7+
base: '/react-native-shield/',
8+
9+
head: [
10+
[
11+
'meta',
12+
{
13+
name: 'og:title',
14+
content: 'react-native-shield — React Native Security Suite',
15+
},
16+
],
17+
[
18+
'meta',
19+
{
20+
name: 'og:description',
21+
content:
22+
'Root detection, SSL pinning, biometrics, secure storage, and Play Integrity attestation for iOS and Android.',
23+
},
24+
],
25+
['meta', { name: 'og:type', content: 'website' }],
26+
],
27+
28+
themeConfig: {
29+
siteTitle: 'react-native-shield',
30+
31+
nav: [
32+
{ text: 'Guide', link: '/guide/getting-started' },
33+
{ text: 'API', link: '/api/device-integrity' },
34+
{ text: 'Roadmap', link: '/roadmap' },
35+
{
36+
text: 'GitHub',
37+
link: 'https://github.com/ThinkGrid-Labs/react-native-shield',
38+
},
39+
{
40+
text: 'npm',
41+
link: 'https://www.npmjs.com/package/@think-grid-labs/react-native-shield',
42+
},
43+
],
44+
45+
sidebar: [
46+
{
47+
text: 'Guide',
48+
items: [
49+
{ text: 'Getting Started', link: '/guide/getting-started' },
50+
{
51+
text: 'Device Integrity & Anti-Tampering',
52+
link: '/guide/device-integrity',
53+
},
54+
{ text: 'Platform Attestation', link: '/guide/attestation' },
55+
{ text: 'SSL Pinning', link: '/guide/ssl-pinning' },
56+
{ text: 'Biometric Authentication', link: '/guide/biometrics' },
57+
{ text: 'Secure Storage', link: '/guide/secure-storage' },
58+
{ text: 'UI Privacy', link: '/guide/ui-privacy' },
59+
{ text: 'App Environment', link: '/guide/app-environment' },
60+
],
61+
},
62+
{
63+
text: 'API Reference',
64+
items: [
65+
{ text: 'Device Integrity', link: '/api/device-integrity' },
66+
{ text: 'Network & Environment', link: '/api/network' },
67+
{ text: 'Platform Attestation', link: '/api/attestation' },
68+
{ text: 'Biometrics', link: '/api/biometrics' },
69+
{ text: 'SSL Pinning', link: '/api/ssl-pinning' },
70+
{ text: 'Secure Storage', link: '/api/secure-storage' },
71+
{ text: 'UI Privacy', link: '/api/ui-privacy' },
72+
],
73+
},
74+
{
75+
text: 'More',
76+
items: [
77+
{ text: 'Roadmap', link: '/roadmap' },
78+
{ text: 'Contributing', link: '/contributing' },
79+
],
80+
},
81+
],
82+
83+
socialLinks: [
84+
{
85+
icon: 'github',
86+
link: 'https://github.com/ThinkGrid-Labs/react-native-shield',
87+
},
88+
],
89+
90+
footer: {
91+
message: 'Released under the MIT License.',
92+
copyright: 'Copyright © ThinkGrid Labs',
93+
},
94+
95+
search: {
96+
provider: 'local',
97+
},
98+
99+
editLink: {
100+
pattern:
101+
'https://github.com/ThinkGrid-Labs/react-native-shield/edit/main/docs/:path',
102+
text: 'Edit this page on GitHub',
103+
},
104+
},
105+
});

docs/api/attestation.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Platform Attestation API
2+
3+
| Method | Returns | Description |
4+
|---|---|---|
5+
| `requestIntegrityToken(nonce)` | `Promise<string>` | Play Integrity token (Android) or DeviceCheck token (iOS) |
6+
7+
## `requestIntegrityToken(nonce)`
8+
9+
```typescript
10+
requestIntegrityToken(nonce: string): Promise<string>
11+
```
12+
13+
**Parameters:**
14+
- `nonce` — server-generated, single-use random value (minimum 16 bytes, base64-encoded)
15+
16+
**Resolves** with a signed token string to send to your backend for verification.
17+
18+
**Rejects** with:
19+
- `INTEGRITY_NOT_SUPPORTED` — running on an emulator, unsigned build, or device without Play Services
20+
- `INTEGRITY_ERROR` — network error or Play Services unavailable
21+
22+
See the [Attestation guide](/guide/attestation) for server-side verification details.

docs/api/biometrics.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Biometrics API
2+
3+
| Method | Returns | Description |
4+
|---|---|---|
5+
| `authenticateWithBiometrics(prompt)` | `Promise<boolean>` | Launches native biometric prompt; resolves `true` on success |
6+
| `getBiometricStrength()` | `Promise<"strong" \| "weak" \| "none">` | Returns the strength level of enrolled biometrics |
7+
8+
## `authenticateWithBiometrics(prompt)`
9+
10+
```typescript
11+
authenticateWithBiometrics(prompt: string): Promise<boolean>
12+
```
13+
14+
**Parameters:**
15+
- `prompt` — string shown in the native biometric dialog (e.g. `"Authenticate to continue"`)
16+
17+
**Resolves** `true` on successful authentication, `false` if the user cancels or fails.
18+
19+
## `getBiometricStrength()`
20+
21+
```typescript
22+
getBiometricStrength(): Promise<"strong" | "weak" | "none">
23+
```
24+
25+
| Value | Meaning |
26+
|---|---|
27+
| `"strong"` | Secure enclave-backed: Face ID, fingerprint (iOS), Class 3 biometric (Android) |
28+
| `"weak"` | 2D camera-based: Face Unlock (Android) |
29+
| `"none"` | No biometrics enrolled |

docs/api/device-integrity.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Device Integrity API
2+
3+
All methods are synchronous.
4+
5+
| Method | Returns | Description |
6+
|---|---|---|
7+
| `isRooted()` | `boolean` | `true` if device is rooted (Android) or jailbroken (iOS) |
8+
| `isEmulator()` | `boolean` | `true` if running in a simulator or emulator |
9+
| `isDebuggerAttached()` | `boolean` | `true` if a debugger is attached to the process |
10+
| `isDeveloperModeEnabled()` | `boolean` | `true` if ADB/developer options are active (Android only; always `false` on iOS) |
11+
| `isHooked()` | `boolean` | `true` if Frida, Xposed, Substrate, or similar is detected |
12+
| `verifySignature(hash)` | `boolean` | `true` if the app's signing cert SHA-256 matches `hash` |
13+
| `getRootReasons()` | `string[]` | Array of reason codes explaining why the device is flagged |
14+
15+
## `verifySignature(hash)`
16+
17+
```typescript
18+
verifySignature(hash: string): boolean
19+
```
20+
21+
`hash` — expected SHA-256 fingerprint of your signing certificate (hex string, no colons).
22+
23+
Returns `false` if the APK has been repackaged with a different key, or if the app is running on iOS (where signature verification uses provisioning profiles rather than cert hashes).
24+
25+
## `getRootReasons()`
26+
27+
```typescript
28+
getRootReasons(): string[]
29+
```
30+
31+
Returns an empty array `[]` on clean devices. Possible values: `build_tags`, `su_binary`, `su_command`, `dangerous_packages`, `mount_flags` (Android); `jailbreak_files`, `sandbox_escape`, `cydia_scheme`, `substrate_loaded` (iOS).
32+
33+
See [Device Integrity guide](/guide/device-integrity#root--jailbreak-reason-codes) for full descriptions.

docs/api/network.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Network & Environment API
2+
3+
| Method | Returns | Description |
4+
|---|---|---|
5+
| `isVPNDetected()` | `boolean` | `true` if traffic is routed through a VPN interface |
6+
| `protectClipboard(protect)` | `Promise<void>` | Toggle auto-clear clipboard on app background |
7+
8+
## `isVPNDetected()`
9+
10+
```typescript
11+
isVPNDetected(): boolean
12+
```
13+
14+
Synchronous. Detects active VPN network interfaces. Does not detect manually configured HTTP proxies (see Roadmap v0.7.0).
15+
16+
## `protectClipboard(protect)`
17+
18+
```typescript
19+
protectClipboard(protect: boolean): Promise<void>
20+
```
21+
22+
When `protect` is `true`, the clipboard is cleared whenever the app transitions to the background.

docs/api/secure-storage.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Secure Storage API
2+
3+
| Method | Returns | Description |
4+
|---|---|---|
5+
| `setSecureString(key, value)` | `Promise<boolean>` | Encrypt and store a string |
6+
| `getSecureString(key)` | `Promise<string \| null>` | Decrypt and retrieve a stored string |
7+
| `removeSecureString(key)` | `Promise<boolean>` | Delete a single key from secure storage |
8+
| `getAllSecureKeys()` | `Promise<string[]>` | List all keys currently in secure storage |
9+
| `clearAllSecureStorage()` | `Promise<boolean>` | Delete all keys from secure storage |
10+
11+
## `setSecureString(key, value)`
12+
13+
```typescript
14+
setSecureString(key: string, value: string): Promise<boolean>
15+
```
16+
17+
Resolves `true` on success.
18+
19+
## `getSecureString(key)`
20+
21+
```typescript
22+
getSecureString(key: string): Promise<string | null>
23+
```
24+
25+
Returns `null` if the key does not exist.
26+
27+
## `removeSecureString(key)`
28+
29+
```typescript
30+
removeSecureString(key: string): Promise<boolean>
31+
```
32+
33+
Resolves `true` on success, `false` if the key was not found.
34+
35+
## `getAllSecureKeys()`
36+
37+
```typescript
38+
getAllSecureKeys(): Promise<string[]>
39+
```
40+
41+
Returns all keys stored by this app. Scoped to the app's bundle ID on iOS and package name on Android.
42+
43+
## `clearAllSecureStorage()`
44+
45+
```typescript
46+
clearAllSecureStorage(): Promise<boolean>
47+
```
48+
49+
Deletes all keys. Safe to call when storage is already empty.

docs/api/ssl-pinning.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# SSL Pinning API
2+
3+
| Method | Returns | Description |
4+
|---|---|---|
5+
| `addSSLPinning(domain, hashes)` | `Promise<void>` | Enable certificate pinning for a domain |
6+
| `updateSSLPins(domain, hashes)` | `Promise<void>` | Update pins at runtime (Android only) |
7+
8+
## `addSSLPinning(domain, hashes)`
9+
10+
```typescript
11+
addSSLPinning(domain: string, hashes: string[]): Promise<void>
12+
```
13+
14+
**Parameters:**
15+
- `domain` — hostname to pin (e.g. `"api.yourdomain.com"`)
16+
- `hashes` — array of `sha256/` prefixed public key hashes (base64-encoded)
17+
18+
Must be called before any network requests to that domain. Always provide at least one backup hash.
19+
20+
## `updateSSLPins(domain, hashes)`
21+
22+
```typescript
23+
updateSSLPins(domain: string, hashes: string[]): Promise<void>
24+
```
25+
26+
**Android:** updates the OkHttp `CertificatePinner` immediately at runtime.
27+
28+
**iOS:** rejects with error code `SSL_PIN_UPDATE_UNSUPPORTED` — TrustKit locks its configuration at startup. Ship an app update to rotate iOS pins.

docs/api/ui-privacy.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# UI Privacy API
2+
3+
| Method | Returns | Description |
4+
|---|---|---|
5+
| `preventScreenshot(prevent)` | `Promise<void>` | Toggle screenshot/recording prevention and background blur |
6+
7+
## `preventScreenshot(prevent)`
8+
9+
```typescript
10+
preventScreenshot(prevent: boolean): Promise<void>
11+
```
12+
13+
**Parameters:**
14+
- `prevent``true` to enable protection, `false` to disable
15+
16+
**Android:** sets or clears `FLAG_SECURE` on the window, blocking screenshots and screen recording at the OS level.
17+
18+
**iOS:** applies a `UITextField.secureTextEntry` layer trick to mask screen recording and AirPlay mirroring, and injects a blur overlay on `WillResignActive` to hide content in the app switcher. Hardware screenshots (Home + Power) cannot be blocked.

0 commit comments

Comments
 (0)