react-native-security-pack 1.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/LICENSE +20 -0
- package/README.md +33 -0
- package/android/build.gradle +130 -0
- package/android/generated/java/com/leerman/rnsecuritypack/NativeSecurityPackSpec.java +42 -0
- package/android/generated/jni/CMakeLists.txt +49 -0
- package/android/generated/jni/RNSecurityPackSpec-generated.cpp +38 -0
- package/android/generated/jni/RNSecurityPackSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNSecurityPackSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/jni/react/renderer/components/RNSecurityPackSpec/ComponentDescriptors.h +24 -0
- package/android/generated/jni/react/renderer/components/RNSecurityPackSpec/EventEmitters.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNSecurityPackSpec/EventEmitters.h +17 -0
- package/android/generated/jni/react/renderer/components/RNSecurityPackSpec/Props.cpp +19 -0
- package/android/generated/jni/react/renderer/components/RNSecurityPackSpec/Props.h +18 -0
- package/android/generated/jni/react/renderer/components/RNSecurityPackSpec/RNSecurityPackSpecJSI-generated.cpp +32 -0
- package/android/generated/jni/react/renderer/components/RNSecurityPackSpec/RNSecurityPackSpecJSI.h +76 -0
- package/android/generated/jni/react/renderer/components/RNSecurityPackSpec/ShadowNodes.cpp +17 -0
- package/android/generated/jni/react/renderer/components/RNSecurityPackSpec/ShadowNodes.h +23 -0
- package/android/generated/jni/react/renderer/components/RNSecurityPackSpec/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNSecurityPackSpec/States.h +19 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/leerman/rnsecuritypack/SecurityPackModule.kt +85 -0
- package/android/src/main/java/com/leerman/rnsecuritypack/SecurityPackPackage.kt +35 -0
- package/android/src/newarch/SecurityPackSpec.kt +7 -0
- package/android/src/oldarch/SecurityPackSpec.kt +12 -0
- package/ios/SecurityPack.h +12 -0
- package/ios/SecurityPack.mm +25 -0
- package/ios/generated/RNSecurityPackSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/RNSecurityPackSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/RNSecurityPackSpec/EventEmitters.cpp +16 -0
- package/ios/generated/RNSecurityPackSpec/EventEmitters.h +17 -0
- package/ios/generated/RNSecurityPackSpec/Props.cpp +19 -0
- package/ios/generated/RNSecurityPackSpec/Props.h +18 -0
- package/ios/generated/RNSecurityPackSpec/RCTComponentViewHelpers.h +18 -0
- package/ios/generated/RNSecurityPackSpec/RNSecurityPackSpec-generated.mm +36 -0
- package/ios/generated/RNSecurityPackSpec/RNSecurityPackSpec.h +52 -0
- package/ios/generated/RNSecurityPackSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/RNSecurityPackSpec/ShadowNodes.h +23 -0
- package/ios/generated/RNSecurityPackSpec/States.cpp +16 -0
- package/ios/generated/RNSecurityPackSpec/States.h +19 -0
- package/ios/generated/RNSecurityPackSpecJSI-generated.cpp +32 -0
- package/ios/generated/RNSecurityPackSpecJSI.h +76 -0
- package/lib/commonjs/NativeSecurityPack.js +9 -0
- package/lib/commonjs/NativeSecurityPack.js.map +1 -0
- package/lib/commonjs/index.js +34 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/NativeSecurityPack.js +5 -0
- package/lib/module/NativeSecurityPack.js.map +1 -0
- package/lib/module/index.js +29 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeSecurityPack.d.ts +8 -0
- package/lib/typescript/commonjs/src/NativeSecurityPack.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +3 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeSecurityPack.d.ts +8 -0
- package/lib/typescript/module/src/NativeSecurityPack.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +3 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +201 -0
- package/react-native-security-pack.podspec +43 -0
- package/src/NativeSecurityPack.ts +9 -0
- package/src/index.tsx +43 -0
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeModules, Platform } from 'react-native';
|
|
4
|
+
const LINKING_ERROR = `The package 'react-native-security-pack' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
5
|
+
ios: "- You have run 'pod install'\n",
|
|
6
|
+
default: ''
|
|
7
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
8
|
+
|
|
9
|
+
// @ts-expect-error
|
|
10
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
11
|
+
const SecurityPackModule = isTurboModuleEnabled ? require('./NativeSecurityPack').default : NativeModules.SecurityPack;
|
|
12
|
+
const SecurityPack = SecurityPackModule ? SecurityPackModule : new Proxy({}, {
|
|
13
|
+
get() {
|
|
14
|
+
throw new Error(LINKING_ERROR);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
async function getSignatures() {
|
|
18
|
+
return (await SecurityPack.getSignatures()).map(item => item.toUpperCase());
|
|
19
|
+
}
|
|
20
|
+
export async function containsSignatures(sigs) {
|
|
21
|
+
if (Platform.OS === 'ios') return true;
|
|
22
|
+
const signatures = await getSignatures();
|
|
23
|
+
const sigUpper = sigs.map(item => item.toUpperCase());
|
|
24
|
+
return signatures.some(item => sigUpper.includes(item));
|
|
25
|
+
}
|
|
26
|
+
export async function isRooted() {
|
|
27
|
+
return SecurityPack.isRooted();
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","SecurityPackModule","require","SecurityPack","Proxy","get","Error","getSignatures","map","item","toUpperCase","containsSignatures","sigs","OS","signatures","sigUpper","some","includes","isRooted"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,qFAAqF,GACrFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,kBAAkB,IAAI,IAAI;AAE9D,MAAMC,kBAAkB,GAAGH,oBAAoB,GAC3CI,OAAO,CAAC,sBAAsB,CAAC,CAACL,OAAO,GACvCL,aAAa,CAACW,YAAY;AAE9B,MAAMA,YAAY,GAAGF,kBAAkB,GACnCA,kBAAkB,GAClB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACZ,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,eAAea,aAAaA,CAAA,EAAsB;EAChD,OAAO,CAAC,MAAMJ,YAAY,CAACI,aAAa,CAAC,CAAC,EAAEC,GAAG,CAAEC,IAAY,IAC3DA,IAAI,CAACC,WAAW,CAAC,CACnB,CAAC;AACH;AAEA,OAAO,eAAeC,kBAAkBA,CAACC,IAAc,EAAoB;EACzE,IAAInB,QAAQ,CAACoB,EAAE,KAAK,KAAK,EAAE,OAAO,IAAI;EAEtC,MAAMC,UAAoB,GAAG,MAAMP,aAAa,CAAC,CAAC;EAClD,MAAMQ,QAAQ,GAAGH,IAAI,CAACJ,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACC,WAAW,CAAC,CAAC,CAAC;EACvD,OAAOI,UAAU,CAACE,IAAI,CAAEP,IAAI,IAAKM,QAAQ,CAACE,QAAQ,CAACR,IAAI,CAAC,CAAC;AAC3D;AAEA,OAAO,eAAeS,QAAQA,CAAA,EAAqB;EACjD,OAAOf,YAAY,CAACe,QAAQ,CAAC,CAAC;AAChC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAgCA,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAMzE;AAED,wBAAsB,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,CAEjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAgCA,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAMzE;AAED,wBAAsB,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,CAEjD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-security-pack",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "security",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/commonjs/index.js",
|
|
7
|
+
"module": "./lib/module/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
12
|
+
"default": "./lib/module/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
16
|
+
"default": "./lib/commonjs/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"src",
|
|
22
|
+
"lib",
|
|
23
|
+
"android",
|
|
24
|
+
"ios",
|
|
25
|
+
"cpp",
|
|
26
|
+
"*.podspec",
|
|
27
|
+
"!ios/build",
|
|
28
|
+
"!android/build",
|
|
29
|
+
"!android/gradle",
|
|
30
|
+
"!android/gradlew",
|
|
31
|
+
"!android/gradlew.bat",
|
|
32
|
+
"!android/local.properties",
|
|
33
|
+
"!**/__tests__",
|
|
34
|
+
"!**/__fixtures__",
|
|
35
|
+
"!**/__mocks__",
|
|
36
|
+
"!**/.*"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"example": "yarn workspace react-native-security-pack-example",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"typecheck": "tsc",
|
|
42
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
43
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
44
|
+
"prepare": "bob build",
|
|
45
|
+
"release": "release-it"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"react-native",
|
|
49
|
+
"ios",
|
|
50
|
+
"android"
|
|
51
|
+
],
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "git+https://github.com/leerman/react-native-security-pack.git"
|
|
55
|
+
},
|
|
56
|
+
"author": "Andrew Timofeev <leerman@live.ru> (https://github.com/leerman)",
|
|
57
|
+
"license": "MIT",
|
|
58
|
+
"bugs": {
|
|
59
|
+
"url": "https://github.com/leerman/react-native-security-pack/issues"
|
|
60
|
+
},
|
|
61
|
+
"homepage": "https://github.com/leerman/react-native-security-pack#readme",
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"registry": "https://registry.npmjs.org/"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
67
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
68
|
+
"@react-native/eslint-config": "^0.73.1",
|
|
69
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
|
70
|
+
"@types/jest": "^29.5.5",
|
|
71
|
+
"@types/react": "^18.2.44",
|
|
72
|
+
"commitlint": "^17.0.2",
|
|
73
|
+
"del-cli": "^5.1.0",
|
|
74
|
+
"eslint": "^8.51.0",
|
|
75
|
+
"eslint-config-prettier": "^9.0.0",
|
|
76
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
77
|
+
"jest": "^29.7.0",
|
|
78
|
+
"prettier": "^3.0.3",
|
|
79
|
+
"react": "18.3.1",
|
|
80
|
+
"react-native": "0.75.2",
|
|
81
|
+
"react-native-builder-bob": "^0.30.0",
|
|
82
|
+
"release-it": "^15.0.0",
|
|
83
|
+
"turbo": "^1.10.7",
|
|
84
|
+
"typescript": "^5.2.2"
|
|
85
|
+
},
|
|
86
|
+
"resolutions": {
|
|
87
|
+
"@types/react": "^18.2.44"
|
|
88
|
+
},
|
|
89
|
+
"peerDependencies": {
|
|
90
|
+
"react": "*",
|
|
91
|
+
"react-native": "*"
|
|
92
|
+
},
|
|
93
|
+
"workspaces": [
|
|
94
|
+
"example"
|
|
95
|
+
],
|
|
96
|
+
"packageManager": "yarn@3.6.1",
|
|
97
|
+
"jest": {
|
|
98
|
+
"preset": "react-native",
|
|
99
|
+
"modulePathIgnorePatterns": [
|
|
100
|
+
"<rootDir>/example/node_modules",
|
|
101
|
+
"<rootDir>/lib/"
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
"commitlint": {
|
|
105
|
+
"extends": [
|
|
106
|
+
"@commitlint/config-conventional"
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"release-it": {
|
|
110
|
+
"git": {
|
|
111
|
+
"commitMessage": "chore: release ${version}",
|
|
112
|
+
"tagName": "v${version}"
|
|
113
|
+
},
|
|
114
|
+
"npm": {
|
|
115
|
+
"publish": true
|
|
116
|
+
},
|
|
117
|
+
"github": {
|
|
118
|
+
"release": true
|
|
119
|
+
},
|
|
120
|
+
"plugins": {
|
|
121
|
+
"@release-it/conventional-changelog": {
|
|
122
|
+
"preset": "angular"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"eslintConfig": {
|
|
127
|
+
"root": true,
|
|
128
|
+
"extends": [
|
|
129
|
+
"@react-native",
|
|
130
|
+
"prettier"
|
|
131
|
+
],
|
|
132
|
+
"rules": {
|
|
133
|
+
"react/react-in-jsx-scope": "off",
|
|
134
|
+
"prettier/prettier": [
|
|
135
|
+
"error",
|
|
136
|
+
{
|
|
137
|
+
"quoteProps": "consistent",
|
|
138
|
+
"singleQuote": true,
|
|
139
|
+
"tabWidth": 2,
|
|
140
|
+
"trailingComma": "es5",
|
|
141
|
+
"useTabs": false
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"eslintIgnore": [
|
|
147
|
+
"node_modules/",
|
|
148
|
+
"lib/"
|
|
149
|
+
],
|
|
150
|
+
"prettier": {
|
|
151
|
+
"quoteProps": "consistent",
|
|
152
|
+
"singleQuote": true,
|
|
153
|
+
"tabWidth": 2,
|
|
154
|
+
"trailingComma": "es5",
|
|
155
|
+
"useTabs": false
|
|
156
|
+
},
|
|
157
|
+
"react-native-builder-bob": {
|
|
158
|
+
"source": "src",
|
|
159
|
+
"output": "lib",
|
|
160
|
+
"targets": [
|
|
161
|
+
"codegen",
|
|
162
|
+
[
|
|
163
|
+
"commonjs",
|
|
164
|
+
{
|
|
165
|
+
"esm": true
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
[
|
|
169
|
+
"module",
|
|
170
|
+
{
|
|
171
|
+
"esm": true
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
[
|
|
175
|
+
"typescript",
|
|
176
|
+
{
|
|
177
|
+
"project": "tsconfig.build.json",
|
|
178
|
+
"esm": true
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
"codegenConfig": {
|
|
184
|
+
"name": "RNSecurityPackSpec",
|
|
185
|
+
"type": "all",
|
|
186
|
+
"jsSrcsDir": "src",
|
|
187
|
+
"outputDir": {
|
|
188
|
+
"ios": "ios/generated",
|
|
189
|
+
"android": "android/generated"
|
|
190
|
+
},
|
|
191
|
+
"android": {
|
|
192
|
+
"javaPackageName": "com.leerman.rnsecuritypack"
|
|
193
|
+
},
|
|
194
|
+
"includesGeneratedCode": true
|
|
195
|
+
},
|
|
196
|
+
"create-react-native-library": {
|
|
197
|
+
"type": "module-mixed",
|
|
198
|
+
"languages": "kotlin-objc",
|
|
199
|
+
"version": "0.41.0"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
+
|
|
6
|
+
Pod::Spec.new do |s|
|
|
7
|
+
s.name = "react-native-security-pack"
|
|
8
|
+
s.version = package["version"]
|
|
9
|
+
s.summary = package["description"]
|
|
10
|
+
s.homepage = package["homepage"]
|
|
11
|
+
s.license = package["license"]
|
|
12
|
+
s.authors = package["author"]
|
|
13
|
+
|
|
14
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
15
|
+
s.source = { :git => "https://github.com/leerman/react-native-security-pack.git", :tag => "#{s.version}" }
|
|
16
|
+
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp}"
|
|
18
|
+
|
|
19
|
+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
20
|
+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
21
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
22
|
+
install_modules_dependencies(s)
|
|
23
|
+
else
|
|
24
|
+
s.dependency "React-Core"
|
|
25
|
+
|
|
26
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
27
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
28
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
29
|
+
s.pod_target_xcconfig = {
|
|
30
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
31
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
32
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
33
|
+
}
|
|
34
|
+
s.dependency "React-Codegen"
|
|
35
|
+
s.dependency "RCT-Folly"
|
|
36
|
+
s.dependency "RCTRequired"
|
|
37
|
+
s.dependency "RCTTypeSafety"
|
|
38
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
s.dependency "DTTJailbreakDetection"
|
|
43
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
}
|