@hituchhimpa/react-native-auth-vault 1.0.1 β 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.
- package/README.md +94 -71
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,54 @@
|
|
|
1
1
|
# π‘οΈ React Native Auth Vault
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](LICENSE)
|
|
5
|
-
[](#)
|
|
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
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
|
108
|
+
Encrypt and store keys using hardware cryptoprocessors (Secure Enclave / TEE) **silently** without prompting the user:
|
|
89
109
|
|
|
90
110
|
```typescript
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
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
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
##
|
|
130
|
+
## π Security Architecture
|
|
124
131
|
|
|
125
|
-
|
|
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
|
-
|
|
128
|
-
*
|
|
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
|
-
##
|
|
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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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