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.
- package/README.md +181 -13
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +55 -60
- package/android/fix-prefab.gradle +44 -0
- package/android/gradle.properties +5 -5
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/leerman/rnsecuritypack/RNSecurityPackPackage.kt +23 -0
- package/android/src/main/java/com/margelo/nitro/rnsecuritypack/HybridSecurityPack.kt +85 -0
- package/ios/HybridSecurityPack.swift +17 -0
- package/jest/mock.js +7 -0
- package/lib/commonjs/index.js +24 -17
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/SecurityPack.nitro.js +6 -0
- package/lib/commonjs/specs/SecurityPack.nitro.js.map +1 -0
- package/lib/module/index.js +25 -18
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/SecurityPack.nitro.js +4 -0
- package/lib/module/specs/SecurityPack.nitro.js.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +7 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/SecurityPack.nitro.d.ts +9 -0
- package/lib/typescript/commonjs/src/specs/SecurityPack.nitro.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +7 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/SecurityPack.nitro.d.ts +9 -0
- package/lib/typescript/module/src/specs/SecurityPack.nitro.d.ts.map +1 -0
- package/nitro.json +24 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/RNSecurityPack+autolinking.cmake +81 -0
- package/nitrogen/generated/android/RNSecurityPack+autolinking.gradle +27 -0
- package/nitrogen/generated/android/RNSecurityPackOnLoad.cpp +54 -0
- package/nitrogen/generated/android/RNSecurityPackOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JHybridSecurityPackSpec.cpp +92 -0
- package/nitrogen/generated/android/c++/JHybridSecurityPackSpec.hpp +64 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnsecuritypack/HybridSecurityPackSpec.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnsecuritypack/RNSecurityPackOnLoad.kt +35 -0
- package/nitrogen/generated/ios/RNSecurityPack+autolinking.rb +62 -0
- package/nitrogen/generated/ios/RNSecurityPack-Swift-Cxx-Bridge.cpp +57 -0
- package/nitrogen/generated/ios/RNSecurityPack-Swift-Cxx-Bridge.hpp +166 -0
- package/nitrogen/generated/ios/RNSecurityPack-Swift-Cxx-Umbrella.hpp +46 -0
- package/nitrogen/generated/ios/RNSecurityPackAutolinking.mm +33 -0
- package/nitrogen/generated/ios/RNSecurityPackAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridSecurityPackSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridSecurityPackSpecSwift.hpp +92 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridSecurityPackSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridSecurityPackSpec_cxx.swift +170 -0
- package/nitrogen/generated/shared/c++/HybridSecurityPackSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridSecurityPackSpec.hpp +65 -0
- package/package.json +36 -42
- package/react-native-security-pack.podspec +18 -27
- package/react-native.config.js +1 -0
- package/src/index.ts +39 -0
- package/src/specs/SecurityPack.nitro.ts +7 -0
- package/android/src/main/AndroidManifestNew.xml +0 -2
- package/android/src/main/java/com/leerman/rnsecuritypack/SecurityPackModule.kt +0 -85
- package/android/src/main/java/com/leerman/rnsecuritypack/SecurityPackPackage.kt +0 -35
- package/android/src/newarch/SecurityPackSpec.kt +0 -7
- package/android/src/oldarch/SecurityPackSpec.kt +0 -12
- package/ios/SecurityPack.h +0 -12
- package/ios/SecurityPack.mm +0 -25
- package/lib/commonjs/NativeSecurityPack.js +0 -9
- package/lib/commonjs/NativeSecurityPack.js.map +0 -1
- package/lib/module/NativeSecurityPack.js +0 -5
- package/lib/module/NativeSecurityPack.js.map +0 -1
- package/lib/typescript/commonjs/src/NativeSecurityPack.d.ts +0 -8
- package/lib/typescript/commonjs/src/NativeSecurityPack.d.ts.map +0 -1
- package/lib/typescript/module/src/NativeSecurityPack.d.ts +0 -8
- package/lib/typescript/module/src/NativeSecurityPack.d.ts.map +0 -1
- package/src/NativeSecurityPack.ts +0 -9
- 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,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
|
-
}
|
package/ios/SecurityPack.h
DELETED
package/ios/SecurityPack.mm
DELETED
|
@@ -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 +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
|
-
}
|