react-native-security-pack 1.0.1 → 2.0.0

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 (73) hide show
  1. package/README.md +181 -13
  2. package/android/CMakeLists.txt +24 -0
  3. package/android/build.gradle +55 -60
  4. package/android/fix-prefab.gradle +44 -0
  5. package/android/gradle.properties +5 -5
  6. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  7. package/android/src/main/java/com/leerman/rnsecuritypack/RNSecurityPackPackage.kt +23 -0
  8. package/android/src/main/java/com/margelo/nitro/rnsecuritypack/HybridSecurityPack.kt +85 -0
  9. package/ios/HybridSecurityPack.swift +17 -0
  10. package/jest/mock.js +7 -0
  11. package/lib/commonjs/index.js +24 -17
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/specs/SecurityPack.nitro.js +6 -0
  14. package/lib/commonjs/specs/SecurityPack.nitro.js.map +1 -0
  15. package/lib/module/index.js +25 -18
  16. package/lib/module/index.js.map +1 -1
  17. package/lib/module/specs/SecurityPack.nitro.js +4 -0
  18. package/lib/module/specs/SecurityPack.nitro.js.map +1 -0
  19. package/lib/typescript/commonjs/src/index.d.ts +7 -0
  20. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  21. package/lib/typescript/commonjs/src/specs/SecurityPack.nitro.d.ts +9 -0
  22. package/lib/typescript/commonjs/src/specs/SecurityPack.nitro.d.ts.map +1 -0
  23. package/lib/typescript/module/src/index.d.ts +7 -0
  24. package/lib/typescript/module/src/index.d.ts.map +1 -1
  25. package/lib/typescript/module/src/specs/SecurityPack.nitro.d.ts +9 -0
  26. package/lib/typescript/module/src/specs/SecurityPack.nitro.d.ts.map +1 -0
  27. package/nitro.json +24 -0
  28. package/nitrogen/generated/.gitattributes +1 -0
  29. package/nitrogen/generated/android/RNSecurityPack+autolinking.cmake +81 -0
  30. package/nitrogen/generated/android/RNSecurityPack+autolinking.gradle +27 -0
  31. package/nitrogen/generated/android/RNSecurityPackOnLoad.cpp +54 -0
  32. package/nitrogen/generated/android/RNSecurityPackOnLoad.hpp +34 -0
  33. package/nitrogen/generated/android/c++/JHybridSecurityPackSpec.cpp +92 -0
  34. package/nitrogen/generated/android/c++/JHybridSecurityPackSpec.hpp +64 -0
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnsecuritypack/HybridSecurityPackSpec.kt +59 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnsecuritypack/RNSecurityPackOnLoad.kt +35 -0
  37. package/nitrogen/generated/ios/RNSecurityPack+autolinking.rb +62 -0
  38. package/nitrogen/generated/ios/RNSecurityPack-Swift-Cxx-Bridge.cpp +57 -0
  39. package/nitrogen/generated/ios/RNSecurityPack-Swift-Cxx-Bridge.hpp +166 -0
  40. package/nitrogen/generated/ios/RNSecurityPack-Swift-Cxx-Umbrella.hpp +46 -0
  41. package/nitrogen/generated/ios/RNSecurityPackAutolinking.mm +33 -0
  42. package/nitrogen/generated/ios/RNSecurityPackAutolinking.swift +26 -0
  43. package/nitrogen/generated/ios/c++/HybridSecurityPackSpecSwift.cpp +11 -0
  44. package/nitrogen/generated/ios/c++/HybridSecurityPackSpecSwift.hpp +92 -0
  45. package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
  46. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  47. package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +46 -0
  48. package/nitrogen/generated/ios/swift/HybridSecurityPackSpec.swift +56 -0
  49. package/nitrogen/generated/ios/swift/HybridSecurityPackSpec_cxx.swift +170 -0
  50. package/nitrogen/generated/shared/c++/HybridSecurityPackSpec.cpp +22 -0
  51. package/nitrogen/generated/shared/c++/HybridSecurityPackSpec.hpp +65 -0
  52. package/package.json +36 -42
  53. package/react-native-security-pack.podspec +18 -27
  54. package/react-native.config.js +1 -0
  55. package/src/index.ts +39 -0
  56. package/src/specs/SecurityPack.nitro.ts +7 -0
  57. package/android/src/main/AndroidManifestNew.xml +0 -2
  58. package/android/src/main/java/com/leerman/rnsecuritypack/SecurityPackModule.kt +0 -85
  59. package/android/src/main/java/com/leerman/rnsecuritypack/SecurityPackPackage.kt +0 -35
  60. package/android/src/newarch/SecurityPackSpec.kt +0 -7
  61. package/android/src/oldarch/SecurityPackSpec.kt +0 -12
  62. package/ios/SecurityPack.h +0 -12
  63. package/ios/SecurityPack.mm +0 -25
  64. package/lib/commonjs/NativeSecurityPack.js +0 -9
  65. package/lib/commonjs/NativeSecurityPack.js.map +0 -1
  66. package/lib/module/NativeSecurityPack.js +0 -5
  67. package/lib/module/NativeSecurityPack.js.map +0 -1
  68. package/lib/typescript/commonjs/src/NativeSecurityPack.d.ts +0 -8
  69. package/lib/typescript/commonjs/src/NativeSecurityPack.d.ts.map +0 -1
  70. package/lib/typescript/module/src/NativeSecurityPack.d.ts +0 -8
  71. package/lib/typescript/module/src/NativeSecurityPack.d.ts.map +0 -1
  72. package/src/NativeSecurityPack.ts +0 -9
  73. package/src/index.tsx +0 -43
@@ -1,35 +0,0 @@
1
- package com.leerman.rnsecuritypack
2
-
3
- import com.facebook.react.TurboReactPackage
4
- import com.facebook.react.bridge.ReactApplicationContext
5
- import com.facebook.react.bridge.NativeModule
6
- import com.facebook.react.module.model.ReactModuleInfoProvider
7
- import com.facebook.react.module.model.ReactModuleInfo
8
- import java.util.HashMap
9
-
10
- class SecurityPackPackage : TurboReactPackage() {
11
- override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
12
- return if (name == SecurityPackModule.NAME) {
13
- SecurityPackModule(reactContext)
14
- } else {
15
- null
16
- }
17
- }
18
-
19
- override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
20
- return ReactModuleInfoProvider {
21
- val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
22
- val isTurboModule: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
23
- moduleInfos[SecurityPackModule.NAME] = ReactModuleInfo(
24
- SecurityPackModule.NAME,
25
- SecurityPackModule.NAME,
26
- false, // canOverrideExistingModule
27
- false, // needsEagerInit
28
- true, // hasConstants
29
- false, // isCxxModule
30
- isTurboModule // isTurboModule
31
- )
32
- moduleInfos
33
- }
34
- }
35
- }
@@ -1,7 +0,0 @@
1
- package com.leerman.rnsecuritypack
2
-
3
- import com.facebook.react.bridge.ReactApplicationContext
4
-
5
- abstract class SecurityPackSpec internal constructor(context: ReactApplicationContext) :
6
- NativeSecurityPackSpec(context) {
7
- }
@@ -1,12 +0,0 @@
1
- package com.leerman.rnsecuritypack
2
-
3
- import com.facebook.react.bridge.ReactApplicationContext
4
- import com.facebook.react.bridge.ReactContextBaseJavaModule
5
- import com.facebook.react.bridge.Promise
6
-
7
- abstract class SecurityPackSpec internal constructor(context: ReactApplicationContext) :
8
- ReactContextBaseJavaModule(context) {
9
-
10
- abstract fun getSignatures(promise: Promise)
11
- abstract fun isRooted(promise: Promise)
12
- }
@@ -1,12 +0,0 @@
1
-
2
- #ifdef RCT_NEW_ARCH_ENABLED
3
- #import "RNSecurityPackSpec.h"
4
-
5
- @interface SecurityPack : NSObject <NativeSecurityPackSpec>
6
- #else
7
- #import <React/RCTBridgeModule.h>
8
-
9
- @interface SecurityPack : NSObject <RCTBridgeModule>
10
- #endif
11
-
12
- @end
@@ -1,25 +0,0 @@
1
- #import "SecurityPack.h"
2
- #import <DTTJailbreakDetection/DTTJailbreakDetection.h>
3
-
4
- @implementation SecurityPack
5
- RCT_EXPORT_MODULE()
6
-
7
- // Example method
8
- // See // https://reactnative.dev/docs/native-modules-ios
9
- RCT_EXPORT_METHOD(isRooted:(RCTPromiseResolveBlock)resolve
10
- reject:(RCTPromiseRejectBlock)reject)
11
- {
12
- BOOL rooted = [DTTJailbreakDetection isJailbroken];
13
- resolve(@(rooted));
14
- }
15
-
16
- // Don't compile this code when we build for the old architecture.
17
- #ifdef RCT_NEW_ARCH_ENABLED
18
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
19
- (const facebook::react::ObjCTurboModule::InitParams &)params
20
- {
21
- return std::make_shared<facebook::react::NativeSecurityPackSpecJSI>(params);
22
- }
23
- #endif
24
-
25
- @end
@@ -1,9 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _reactNative = require("react-native");
8
- var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('SecurityPack');
9
- //# sourceMappingURL=NativeSecurityPack.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeSecurityPack.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAOpCC,gCAAmB,CAACC,YAAY,CAAO,cAAc,CAAC","ignoreList":[]}
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- import { TurboModuleRegistry } from 'react-native';
4
- export default TurboModuleRegistry.getEnforcing('SecurityPack');
5
- //# sourceMappingURL=NativeSecurityPack.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeSecurityPack.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAOlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,cAAc,CAAC","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import type { TurboModule } from 'react-native';
2
- export interface Spec extends TurboModule {
3
- getSignatures(): Promise<string[]>;
4
- isRooted(): Promise<boolean>;
5
- }
6
- declare const _default: Spec;
7
- export default _default;
8
- //# sourceMappingURL=NativeSecurityPack.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NativeSecurityPack.d.ts","sourceRoot":"","sources":["../../../../src/NativeSecurityPack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACnC,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9B;;AAED,wBAAsE"}
@@ -1,8 +0,0 @@
1
- import type { TurboModule } from 'react-native';
2
- export interface Spec extends TurboModule {
3
- getSignatures(): Promise<string[]>;
4
- isRooted(): Promise<boolean>;
5
- }
6
- declare const _default: Spec;
7
- export default _default;
8
- //# sourceMappingURL=NativeSecurityPack.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NativeSecurityPack.d.ts","sourceRoot":"","sources":["../../../../src/NativeSecurityPack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACnC,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9B;;AAED,wBAAsE"}
@@ -1,9 +0,0 @@
1
- import type { TurboModule } from 'react-native';
2
- import { TurboModuleRegistry } from 'react-native';
3
-
4
- export interface Spec extends TurboModule {
5
- getSignatures(): Promise<string[]>;
6
- isRooted(): Promise<boolean>;
7
- }
8
-
9
- export default TurboModuleRegistry.getEnforcing<Spec>('SecurityPack');
package/src/index.tsx DELETED
@@ -1,43 +0,0 @@
1
- import { NativeModules, Platform } from 'react-native';
2
-
3
- const LINKING_ERROR =
4
- `The package 'react-native-security-pack' doesn't seem to be linked. Make sure: \n\n` +
5
- Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
6
- '- You rebuilt the app after installing the package\n' +
7
- '- You are not using Expo Go\n';
8
-
9
- // @ts-expect-error
10
- const isTurboModuleEnabled = global.__turboModuleProxy != null;
11
-
12
- const SecurityPackModule = isTurboModuleEnabled
13
- ? require('./NativeSecurityPack').default
14
- : NativeModules.SecurityPack;
15
-
16
- const SecurityPack = SecurityPackModule
17
- ? SecurityPackModule
18
- : new Proxy(
19
- {},
20
- {
21
- get() {
22
- throw new Error(LINKING_ERROR);
23
- },
24
- }
25
- );
26
-
27
- async function getSignatures(): Promise<string[]> {
28
- return (await SecurityPack.getSignatures()).map((item: string) =>
29
- item.toUpperCase()
30
- );
31
- }
32
-
33
- export async function containsSignatures(sigs: string[]): Promise<boolean> {
34
- if (Platform.OS === 'ios') return true;
35
-
36
- const signatures: string[] = await getSignatures();
37
- const sigUpper = sigs.map((item) => item.toUpperCase());
38
- return signatures.some((item) => sigUpper.includes(item));
39
- }
40
-
41
- export async function isRooted(): Promise<boolean> {
42
- return SecurityPack.isRooted();
43
- }