@okint-digital/okint-rn-storage 0.7.0 → 0.7.1
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
CHANGED
|
@@ -144,6 +144,14 @@ feature flags, hot-path UI state — use `createSyncStorage`:
|
|
|
144
144
|
It installs lazily on first use and throws a clear error under remote JS
|
|
145
145
|
debugging (no JSI runtime) — fall back to `createSyncStorageSync` there.
|
|
146
146
|
|
|
147
|
+
> **Opt-in native build.** The C++/JSI engine needs the NDK + CMake + the
|
|
148
|
+
> `ReactAndroid::jsi` prefab, so it's **off by default** — the package builds
|
|
149
|
+
> as pure Kotlin/Java and every other store works without it. Enable it on
|
|
150
|
+
> **Android** with `-PokintEnableJSI=true` (or `okintEnableJSI=true` in
|
|
151
|
+
> `android/gradle.properties`); on **iOS** it's always compiled in. When
|
|
152
|
+
> disabled, `createJSIStorage` reports the engine unavailable — use
|
|
153
|
+
> `createSyncStorageSync` (still synchronous, no NDK).
|
|
154
|
+
|
|
147
155
|
Use `secure` for tokens — never a sync store.
|
|
148
156
|
|
|
149
157
|
## Compared to alternatives
|
package/android/build.gradle
CHANGED
|
@@ -11,6 +11,15 @@ def safeExtGet(prop, fallback) {
|
|
|
11
11
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
// The C++/JSI fast-path engine (createJSIStorage) needs the NDK + CMake + the
|
|
15
|
+
// ReactAndroid::jsi prefab. It is OPT-IN: the default build ships pure
|
|
16
|
+
// Kotlin/Java (secure/encrypted/sqlite/async + the bridge-based `fast` sync
|
|
17
|
+
// store all work without it). Enable with -PokintEnableJSI=true (or
|
|
18
|
+
// okintEnableJSI=true in gradle.properties). When disabled, System.loadLibrary
|
|
19
|
+
// is a no-op (caught) and createJSIStorage reports the engine unavailable.
|
|
20
|
+
def enableJSI = project.hasProperty("okintEnableJSI") &&
|
|
21
|
+
project.property("okintEnableJSI").toString().toBoolean()
|
|
22
|
+
|
|
14
23
|
android {
|
|
15
24
|
namespace "com.okint.rnstorage"
|
|
16
25
|
compileSdkVersion safeExtGet("compileSdkVersion", 35)
|
|
@@ -19,21 +28,25 @@ android {
|
|
|
19
28
|
minSdkVersion safeExtGet("minSdkVersion", 24)
|
|
20
29
|
targetSdkVersion safeExtGet("targetSdkVersion", 35)
|
|
21
30
|
consumerProguardFiles "proguard-rules.pro"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
if (enableJSI) {
|
|
32
|
+
externalNativeBuild {
|
|
33
|
+
cmake {
|
|
34
|
+
cppFlags "-O2", "-frtti", "-fexceptions", "-std=c++17"
|
|
35
|
+
}
|
|
25
36
|
}
|
|
26
37
|
}
|
|
27
38
|
}
|
|
28
39
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
if (enableJSI) {
|
|
41
|
+
// Consume React Native's prefab (JSI) for the C++ fast-path engine.
|
|
42
|
+
buildFeatures {
|
|
43
|
+
prefab true
|
|
44
|
+
}
|
|
33
45
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
46
|
+
externalNativeBuild {
|
|
47
|
+
cmake {
|
|
48
|
+
path "src/main/jni/CMakeLists.txt"
|
|
49
|
+
}
|
|
37
50
|
}
|
|
38
51
|
}
|
|
39
52
|
|
|
@@ -363,7 +363,8 @@ class OkintRnStorageModule(private val reactContext: ReactApplicationContext) :
|
|
|
363
363
|
*/
|
|
364
364
|
@androidx.annotation.RequiresApi(Build.VERSION_CODES.P)
|
|
365
365
|
private fun authenticate(cipher: Cipher, title: String, promise: Promise, onAuthed: (Cipher) -> String?) {
|
|
366
|
-
|
|
366
|
+
// The current Activity lives on the React context, not on the module base class.
|
|
367
|
+
val activity = reactContext.currentActivity
|
|
367
368
|
if (activity == null) {
|
|
368
369
|
promise.reject("E_OKINT_AUTH", "No foreground Activity to present the authentication prompt")
|
|
369
370
|
return
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okint-digital/okint-rn-storage",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Vanilla, pluggable React Native storage — one API over swappable backends: hardware Keystore/Keychain (secure), AES-encrypted blobs (encrypted), SQLite, SharedPreferences/UserDefaults (async), a synchronous fast store, or in-memory.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|