@hituchhimpa/react-native-auth-vault 1.0.0 β†’ 1.0.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.
Files changed (2) hide show
  1. package/README.md +94 -71
  2. package/package.json +22 -2
package/README.md CHANGED
@@ -1,20 +1,54 @@
1
1
  # πŸ›‘οΈ React Native Auth Vault
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@hituchhimpa/react-native-auth-vault.svg?style=flat-square)](https://www.npmjs.com/package/@hituchhimpa/react-native-auth-vault)
4
- [![license](https://img.shields.io/npm/l/@hituchhimpa/react-native-auth-vault.svg?style=flat-square)](LICENSE)
5
- [![platform](https://img.shields.io/badge/platform-ios%20%7C%20android-blue.svg?style=flat-square)](#)
3
+ A native-first security and authentication library for React Native that leverages the Android Keystore, StrongBox, and iOS Secure Enclave to protect sensitive application data.
6
4
 
7
- A premium, native-first security and authentication library for React Native. Provides secure, hardware-backed cryptographic storage and runtime security auditing for enterprise-grade mobile applications.
5
+ Built for applications that require secure credential storage, biometric authentication, encrypted local secrets, and runtime security auditing.
6
+
7
+ ---
8
+
9
+ ## Why Auth Vault?
10
+
11
+ Most secure-storage libraries only encrypt data. Auth Vault goes further by:
12
+
13
+ * πŸ” **Hardware-Backed Protection**: Keeping cryptographic keys inside hardware-backed security modules whenever available.
14
+ * πŸ‘† **Biometrics Integration**: Supporting Face ID, Touch ID, and Android Biometrics out of the box.
15
+ * ⚑ **Silent Encryption**: Allowing silent encryption for background operations without showing user prompts.
16
+ * πŸ›‘οΈ **Security Posture Checks**: Auditing device security posture before performing sensitive actions.
17
+ * 🧡 **Native Performance**: Executing cryptographic operations natively on separate threads for improved performance.
8
18
 
9
19
  ---
10
20
 
11
21
  ## ✨ Features
12
22
 
13
- * πŸ”‘ **Hardware-Backed Encryption**: Private keys are generated and stored securely inside the **Android Keystore (TEE/StrongBox)** and **iOS Secure Enclave**.
14
- * πŸ‘€ **Biometric Protection**: FaceID, TouchID, and Android BiometricPrompt integration with customizable user prompts.
15
- * ⚑ **Optional Biometrics**: Supports both biometric-authenticated operations and high-performance silent hardware encryption (no prompts).
16
- * πŸ›‘οΈ **Security Auditing**: Run real-time checks to inspect device integrity (e.g. root/jailbreak detection, device passcode setup, biometrics status).
17
- * 🧡 **Thread Safe & Native**: Constructed using React Native's modern architecture, executing complex cryptographic tasks on native threads.
23
+ ### πŸ”‘ Hardware-Backed Key Protection
24
+ Uses Android Keystore (TEE/StrongBox) and iOS Secure Enclave to generate and protect encryption keys.
25
+
26
+ ### πŸ‘€ Biometric Authentication
27
+ Authenticate using Face ID, Touch ID, Fingerprint, or device credentials.
28
+
29
+ ### ⚑ Silent Secure Storage
30
+ Store and retrieve encrypted secrets without displaying biometric prompts when appropriate.
31
+
32
+ ### πŸ›‘οΈ Security Auditing
33
+ Inspect device security status including:
34
+ * Root/Jailbreak detection
35
+ * Device lock screen configuration
36
+ * Biometric enrollment
37
+ * Hardware-backed key availability
38
+
39
+ ### πŸ“± Native Performance
40
+ Runs cryptographic operations on native threads with React Native's modern architecture.
41
+
42
+ ---
43
+
44
+ ## πŸ“± Platform Support
45
+
46
+ | Platform | Supported |
47
+ |-----------|-----------|
48
+ | Android | βœ… |
49
+ | iOS | βœ… |
50
+ | React Native New Architecture | βœ… |
51
+ | TypeScript | βœ… |
18
52
 
19
53
  ---
20
54
 
@@ -56,89 +90,78 @@ Prompt the user for biometrics (Face ID/Touch ID/Fingerprint/Passcode) to unlock
56
90
  ```typescript
57
91
  import { AuthVault } from '@hituchhimpa/react-native-auth-vault';
58
92
 
59
- // Store a value securely (triggers biometric prompt)
60
- const saveSecureToken = async (token: string) => {
61
- try {
62
- const success = await AuthVault.setItem(
63
- 'user_token',
64
- token,
65
- 'Scan fingerprint to secure your credentials'
66
- );
67
- if (success) console.log('Stored securely!');
68
- } catch (error) {
69
- console.error('Storage failed:', error);
70
- }
71
- };
72
-
73
- // Retrieve a value (triggers biometric prompt)
74
- const getSecureToken = async () => {
75
- try {
76
- const token = await AuthVault.getItem(
77
- 'user_token',
78
- 'Scan fingerprint to access your account'
79
- );
80
- console.log('Retrieved Token:', token);
81
- } catch (error) {
82
- console.error('Failed to unlock token:', error);
83
- }
84
- };
93
+ // Save securely with biometrics
94
+ await AuthVault.setItem(
95
+ 'token',
96
+ jwt,
97
+ 'Authenticate to save credentials'
98
+ );
99
+
100
+ // Retrieve securely
101
+ const token = await AuthVault.getItem(
102
+ 'token',
103
+ 'Authenticate to continue'
104
+ );
85
105
  ```
86
106
 
87
107
  ### 2. Silent Hardware-Backed Storage (Optional Biometrics)
88
- Encrypt and store keys using hardware cryptoprocessors (Secure Enclave / TEE) **silently** without prompting the user. Perfect for API request signing, background session tokens, or caching:
108
+ Encrypt and store keys using hardware cryptoprocessors (Secure Enclave / TEE) **silently** without prompting the user:
89
109
 
90
110
  ```typescript
91
- // Pass an empty string `""` as the prompt to bypass the biometric UI
92
- const saveSilentToken = async (token: string) => {
93
- await AuthVault.setItem('api_key', token, '');
94
- };
95
-
96
- const getSilentToken = async () => {
97
- const token = await AuthVault.getItem('api_key', '');
98
- return token; // Returns the token silently
99
- };
111
+ // Silent hardware-backed encryption
112
+ await AuthVault.setItem('api_key', apiKey, '');
113
+
114
+ const apiKey = await AuthVault.getItem('api_key', '');
100
115
  ```
101
116
 
102
117
  ### 3. Device Security Auditing
103
118
  Get security metrics to decide whether your app should run or restrict sensitive actions:
104
119
 
105
120
  ```typescript
106
- const checkDeviceSecurity = () => {
107
- const audit = AuthVault.audit();
108
- console.log(audit);
109
- /*
110
- Output:
111
- {
112
- isRooted: false, // Root/Jailbreak status
113
- hasPin: true, // Device lock (PIN/Password) setup
114
- biometricsEnabled: true, // Biometrics enrollment status
115
- hardwareBacked: true // Key storage hardware backing status
116
- }
117
- */
118
- };
121
+ const security = AuthVault.audit();
122
+
123
+ if (security.isRooted) {
124
+ console.warn('Untrusted device detected');
125
+ }
119
126
  ```
120
127
 
121
128
  ---
122
129
 
123
- ## πŸ›‘οΈ Under the Hood: Security Architecture
130
+ ## πŸ”’ Security Architecture
124
131
 
125
- Here is how your data is secured at the hardware level:
132
+ ### Android
133
+ * Keys generated inside Android Keystore
134
+ * StrongBox support where available
135
+ * Optional biometric-gated key access
136
+ * AES-256 encryption
126
137
 
127
- * **Android Keystore (TEE/StrongBox)**: When biometric auth is enabled, the library generates a 256-bit AES key and locks it behind OS biometric policy requirements (`setUserAuthenticationRequired(true)`). When disabled, the key is generated in hardware but unlocked silently when the device is unlocked.
128
- * **iOS Secure Enclave**: On FaceID-enabled devices, keys are generated inside the physical Secure Enclave. Access is restricted using Keychain Access Control flags (`kSecAttrAccessControl` with `.userPresence`).
138
+ ### iOS
139
+ * Keys protected by Secure Enclave
140
+ * Keychain Access Control integration
141
+ * Face ID / Touch ID protected operations
142
+ * User presence verification support
129
143
 
130
144
  ---
131
145
 
132
- ## πŸ› οΈ API Reference
146
+ ## πŸš€ Common Use Cases
147
+
148
+ * Storing JWT access tokens
149
+ * Refresh token protection
150
+ * API request signing
151
+ * Local credential storage
152
+ * Banking and fintech applications
153
+ * Healthcare applications
154
+ * Enterprise authentication workflows
155
+
156
+ ---
157
+
158
+ ## πŸ—ΊοΈ Roadmap
159
+
160
+ Here is what we plan to release in the upcoming versions:
133
161
 
134
- | Method | Type | Description |
135
- | :--- | :--- | :--- |
136
- | `setItem(key, value, prompt)` | `Promise<boolean>` | Encrypts and saves `value` locally. Pass non-empty `prompt` for biometrics, or `""` for silent encryption. |
137
- | `getItem(key, prompt)` | `Promise<string \| null>` | Decrypts and retrieves `value`. Pass non-empty `prompt` for biometrics, or `""` for silent decryption. |
138
- | `removeItem(key)` | `Promise<boolean>` | Deletes the stored key and encrypted value from device. |
139
- | `encrypt(plainText, prompt)` | `Promise<string>` | Encrypts raw text and returns a base64 cipher payload. |
140
- | `decrypt(base64Text, prompt)` | `Promise<string>` | Decrypts a base64 cipher payload back to plain text. |
141
- | `audit()` | `Object` | Runs security checks on the device hardware and environment. |
162
+ * **v1.1.0**: Biometric enrollment change locking & auto-invalidation on Root/Jailbreak.
163
+ * **v1.2.0**: Hardware-backed asymmetric key pairs (ECC/RSA) & cryptographic request signing.
164
+ * **v1.3.0**: Anti-screenshot, anti-screen recording blockers & session key validity duration.
142
165
 
143
166
  ---
144
167
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hituchhimpa/react-native-auth-vault",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "description": "Native-first React Native security and authentication library",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -40,7 +40,27 @@
40
40
  "keywords": [
41
41
  "react-native",
42
42
  "ios",
43
- "android"
43
+ "android",
44
+ "security",
45
+ "authentication",
46
+ "biometrics",
47
+ "keychain",
48
+ "keystore",
49
+ "secure-storage",
50
+ "faceid",
51
+ "touchid",
52
+ "encryption",
53
+ "decryption",
54
+ "cryptography",
55
+ "secure-enclave",
56
+ "strongbox",
57
+ "credentials",
58
+ "auth",
59
+ "token-storage",
60
+ "jailbreak-detection",
61
+ "root-detection",
62
+ "device-security",
63
+ "audit"
44
64
  ],
45
65
  "repository": {
46
66
  "type": "git",