react-native-keys
Version:
🔐 Make protected .ENVs variables
26 lines (24 loc) • 997 B
JavaScript
import { NativeModules, Platform } from 'react-native';
const LINKING_ERROR = `The package 'react-native-keys' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
ios: "- You have run 'pod install'\n",
default: ''
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
// @ts-expect-error
const isTurboModuleEnabled = global.__turboModuleProxy != null;
// Keep this to sync auto install with the native code
const KeysModule = isTurboModuleEnabled ? require('./spec/NativeKeys').default : NativeModules.Keys;
const KeysTurboModule = KeysModule ? KeysModule : new Proxy({}, {
get() {
throw new Error(LINKING_ERROR);
}
});
const installed = KeysTurboModule.install();
if (!installed) {
throw new Error(LINKING_ERROR);
}
const KeysTurbo = global;
Object.assign(KeysTurbo, {
...(Platform.OS === 'android' ? JSON.parse(KeysTurbo.publicKeys()) : KeysTurbo.publicKeys())
});
export default KeysTurbo;
//# sourceMappingURL=index.js.map