@fireflydb/expo-driver 0.0.6
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 +253 -0
- package/android/build.gradle +51 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/CMakeLists.txt +21 -0
- package/android/src/main/cpp/firefly_jni.cpp +110 -0
- package/android/src/main/jniLibs/arm64-v8a/libfirefly.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libfirefly.so +0 -0
- package/android/src/main/jniLibs/x86/libfirefly.so +0 -0
- package/android/src/main/jniLibs/x86_64/libfirefly.so +0 -0
- package/android/src/main/kotlin/com/fireflydb/expo/FireflyClientModule.kt +101 -0
- package/android/src/main/kotlin/com/fireflydb/expo/FireflyJniBridge.kt +58 -0
- package/expo-module.config.json +9 -0
- package/ios/Firefly.xcframework/Info.plist +44 -0
- package/ios/Firefly.xcframework/ios-arm64/Firefly.framework/Firefly +0 -0
- package/ios/Firefly.xcframework/ios-arm64/Firefly.framework/Info.plist +30 -0
- package/ios/Firefly.xcframework/ios-arm64_x86_64-simulator/Firefly.framework/Firefly +0 -0
- package/ios/Firefly.xcframework/ios-arm64_x86_64-simulator/Firefly.framework/Info.plist +30 -0
- package/ios/FireflyClient.podspec +33 -0
- package/ios/FireflyClientModule.swift +193 -0
- package/package.json +50 -0
- package/scripts/build-libfirefly.sh +224 -0
- package/src/FireflyClientModule.ts +83 -0
- package/src/drivers/secureStorage.ts +83 -0
- package/src/drivers/sqlite.ts +322 -0
- package/src/drivers/websocket.ts +166 -0
- package/src/index.ts +120 -0
- package/src/polyfill.ts +22 -0
package/src/polyfill.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Side-effect module: installs globalThis.crypto.getRandomValues using
|
|
2
|
+
// expo-crypto's implementation.
|
|
3
|
+
//
|
|
4
|
+
// Hermes does not ship Web Crypto. @fireflydb/core's @noble/ed25519 dependency
|
|
5
|
+
// reads globalThis.crypto.getRandomValues to generate device keys, so without
|
|
6
|
+
// this polyfill, FireflyClient.init() throws "Cannot read property
|
|
7
|
+
// 'getRandomValues' of undefined" the first time a key is generated.
|
|
8
|
+
//
|
|
9
|
+
// react-native-get-random-values would auto-polyfill, but we already pull in
|
|
10
|
+
// expo-crypto for other reasons; using it here avoids a second native module.
|
|
11
|
+
|
|
12
|
+
import { getRandomValues } from 'expo-crypto';
|
|
13
|
+
|
|
14
|
+
type CryptoLike = { getRandomValues: typeof getRandomValues };
|
|
15
|
+
|
|
16
|
+
const g = globalThis as unknown as { crypto?: CryptoLike };
|
|
17
|
+
|
|
18
|
+
if (!g.crypto) {
|
|
19
|
+
g.crypto = { getRandomValues };
|
|
20
|
+
} else if (typeof g.crypto.getRandomValues !== 'function') {
|
|
21
|
+
g.crypto.getRandomValues = getRandomValues;
|
|
22
|
+
}
|