react-native-security-suite 0.6.5 → 0.6.7
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 +1 -1
- package/README.md +2 -2
- package/android/build.gradle +46 -28
- package/android/src/main/AndroidManifest.xml +47 -0
- package/android/src/main/{AndroidManifestDeprecated.xml → AndroidManifestNew.xml} +1 -2
- package/android/src/main/java/com/securitysuite/NetworkLogger.java +25 -0
- package/android/src/main/java/com/securitysuite/Sslpinning.java +39 -54
- package/android/src/main/java/com/securitysuite/api/BodyDecoder.kt +35 -0
- package/android/src/main/java/com/securitysuite/api/Chucker.kt +108 -0
- package/android/src/main/java/com/securitysuite/api/ChuckerCollector.kt +129 -0
- package/android/src/main/java/com/securitysuite/api/ChuckerInterceptor.kt +280 -0
- package/android/src/main/java/com/securitysuite/api/ExportFormat.kt +12 -0
- package/android/src/main/java/com/securitysuite/api/RetentionManager.kt +109 -0
- package/android/src/main/java/com/securitysuite/internal/data/entity/HttpHeader.kt +8 -0
- package/android/src/main/java/com/securitysuite/internal/data/entity/HttpTransaction.kt +344 -0
- package/android/src/main/java/com/securitysuite/internal/data/entity/HttpTransactionTuple.kt +62 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/Har.kt +13 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/Log.kt +24 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/Browser.kt +11 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/Creator.kt +11 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/Entry.kt +49 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/Page.kt +14 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/entry/Cache.kt +12 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/entry/Header.kt +17 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/entry/Request.kt +35 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/entry/Response.kt +33 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/entry/Timings.kt +25 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/entry/cache/SecondaryRequest.kt +13 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/entry/request/PostData.kt +20 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/entry/request/QueryString.kt +23 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/entry/request/postdata/Params.kt +13 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/entry/response/Content.kt +30 -0
- package/android/src/main/java/com/securitysuite/internal/data/har/log/page/PageTimings.kt +11 -0
- package/android/src/main/java/com/securitysuite/internal/data/model/DialogData.kt +8 -0
- package/android/src/main/java/com/securitysuite/internal/data/repository/HttpTransactionDatabaseRepository.kt +60 -0
- package/android/src/main/java/com/securitysuite/internal/data/repository/HttpTransactionRepository.kt +33 -0
- package/android/src/main/java/com/securitysuite/internal/data/repository/RepositoryProvider.kt +38 -0
- package/android/src/main/java/com/securitysuite/internal/data/room/ChuckerDatabase.kt +22 -0
- package/android/src/main/java/com/securitysuite/internal/data/room/HttpTransactionDao.kt +53 -0
- package/android/src/main/java/com/securitysuite/internal/support/BitmapUtils.kt +45 -0
- package/android/src/main/java/com/securitysuite/internal/support/CacheDirectoryProvider.kt +11 -0
- package/android/src/main/java/com/securitysuite/internal/support/ChessboardDrawable.kt +76 -0
- package/android/src/main/java/com/securitysuite/internal/support/ChuckerFileProvider.kt +9 -0
- package/android/src/main/java/com/securitysuite/internal/support/ClearDatabaseJobIntentServiceReceiver.kt +14 -0
- package/android/src/main/java/com/securitysuite/internal/support/ClearDatabaseService.kt +32 -0
- package/android/src/main/java/com/securitysuite/internal/support/ContextExt.kt +22 -0
- package/android/src/main/java/com/securitysuite/internal/support/DepletingSource.kt +37 -0
- package/android/src/main/java/com/securitysuite/internal/support/FileFactory.kt +30 -0
- package/android/src/main/java/com/securitysuite/internal/support/FileSaver.kt +41 -0
- package/android/src/main/java/com/securitysuite/internal/support/FormatUtils.kt +117 -0
- package/android/src/main/java/com/securitysuite/internal/support/FormattedUrl.kt +76 -0
- package/android/src/main/java/com/securitysuite/internal/support/HarUtils.kt +28 -0
- package/android/src/main/java/com/securitysuite/internal/support/HttpUrlUtils.kt +11 -0
- package/android/src/main/java/com/securitysuite/internal/support/JsonConverter.kt +19 -0
- package/android/src/main/java/com/securitysuite/internal/support/LimitingSource.kt +22 -0
- package/android/src/main/java/com/securitysuite/internal/support/LiveDataUtils.kt +68 -0
- package/android/src/main/java/com/securitysuite/internal/support/Logger.kt +43 -0
- package/android/src/main/java/com/securitysuite/internal/support/NotificationHelper.kt +149 -0
- package/android/src/main/java/com/securitysuite/internal/support/OkHttpUtils.kt +86 -0
- package/android/src/main/java/com/securitysuite/internal/support/OkioUtils.kt +34 -0
- package/android/src/main/java/com/securitysuite/internal/support/PlainTextDecoder.kt +30 -0
- package/android/src/main/java/com/securitysuite/internal/support/ReportingSink.kt +114 -0
- package/android/src/main/java/com/securitysuite/internal/support/RequestProcessor.kt +102 -0
- package/android/src/main/java/com/securitysuite/internal/support/ResponseProcessor.kt +170 -0
- package/android/src/main/java/com/securitysuite/internal/support/SearchHighlightUtil.kt +80 -0
- package/android/src/main/java/com/securitysuite/internal/support/Sharable.kt +86 -0
- package/android/src/main/java/com/securitysuite/internal/support/SpanTextUtil.kt +202 -0
- package/android/src/main/java/com/securitysuite/internal/support/TeeSource.kt +68 -0
- package/android/src/main/java/com/securitysuite/internal/support/TransactionCurlCommandSharable.kt +46 -0
- package/android/src/main/java/com/securitysuite/internal/support/TransactionDetailsHarSharable.kt +11 -0
- package/android/src/main/java/com/securitysuite/internal/support/TransactionDetailsSharable.kt +73 -0
- package/android/src/main/java/com/securitysuite/internal/support/TransactionDiffCallback.kt +26 -0
- package/android/src/main/java/com/securitysuite/internal/support/TransactionListDetailsSharable.kt +23 -0
- package/android/src/main/java/com/securitysuite/internal/ui/BaseChuckerActivity.kt +35 -0
- package/android/src/main/java/com/securitysuite/internal/ui/MainActivity.kt +375 -0
- package/android/src/main/java/com/securitysuite/internal/ui/MainViewModel.kt +47 -0
- package/android/src/main/java/com/securitysuite/internal/ui/transaction/PayloadType.kt +6 -0
- package/android/src/main/java/com/securitysuite/internal/ui/transaction/ProtocolResources.kt +14 -0
- package/android/src/main/java/com/securitysuite/internal/ui/transaction/TransactionActivity.kt +186 -0
- package/android/src/main/java/com/securitysuite/internal/ui/transaction/TransactionAdapter.kt +139 -0
- package/android/src/main/java/com/securitysuite/internal/ui/transaction/TransactionOverviewFragment.kt +100 -0
- package/android/src/main/java/com/securitysuite/internal/ui/transaction/TransactionPagerAdapter.kt +29 -0
- package/android/src/main/java/com/securitysuite/internal/ui/transaction/TransactionPayloadAdapter.kt +269 -0
- package/android/src/main/java/com/securitysuite/internal/ui/transaction/TransactionPayloadFragment.kt +529 -0
- package/android/src/main/java/com/securitysuite/internal/ui/transaction/TransactionViewModel.kt +69 -0
- package/android/src/main/res/A.java +12 -0
- package/android/src/main/res/color/chucker_fab_background_colour.xml +5 -0
- package/android/src/main/res/drawable/chucker_empty_payload.xml +10 -0
- package/android/src/main/res/drawable/chucker_ic_arrow_down.xml +10 -0
- package/android/src/main/res/drawable/chucker_ic_copy.xml +12 -0
- package/android/src/main/res/drawable/chucker_ic_decoded_url_white.xml +10 -0
- package/android/src/main/res/drawable/chucker_ic_delete_white.xml +9 -0
- package/android/src/main/res/drawable/chucker_ic_encoded_url_white.xml +11 -0
- package/android/src/main/res/drawable/chucker_ic_graphql.xml +27 -0
- package/android/src/main/res/drawable/chucker_ic_http.xml +10 -0
- package/android/src/main/res/drawable/chucker_ic_https.xml +9 -0
- package/android/src/main/res/drawable/chucker_ic_launcher_foreground.xml +14 -0
- package/android/src/main/res/drawable/chucker_ic_save_white.xml +9 -0
- package/android/src/main/res/drawable/chucker_ic_search_white.xml +9 -0
- package/android/src/main/res/drawable/chucker_ic_share_white.xml +9 -0
- package/android/src/main/res/drawable/chucker_ic_transaction_notification.xml +9 -0
- package/android/src/main/res/layout/activity_main.xml +83 -0
- package/android/src/main/res/layout/activity_transaction.xml +48 -0
- package/android/src/main/res/layout/fragment_transaction_overview.xml +365 -0
- package/android/src/main/res/layout/fragment_transaction_payload.xml +132 -0
- package/android/src/main/res/layout/list_item_transaction.xml +122 -0
- package/android/src/main/res/layout/transaction_item_body_line.xml +13 -0
- package/android/src/main/res/layout/transaction_item_copy.xml +19 -0
- package/android/src/main/res/layout/transaction_item_headers.xml +12 -0
- package/android/src/main/res/layout/transaction_item_image.xml +16 -0
- package/android/src/main/res/menu/chucker_transaction.xml +46 -0
- package/android/src/main/res/menu/chucker_transactions_list.xml +41 -0
- package/android/src/main/res/mipmap-anydpi-v26/chucker_ic_launcher.xml +5 -0
- package/android/src/main/res/mipmap-hdpi/chucker_ic_launcher.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/chucker_ic_launcher.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/chucker_ic_launcher.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/chucker_ic_launcher.png +0 -0
- package/android/src/main/res/values/chucker_ic_launcher_background.xml +4 -0
- package/android/src/main/res/values/colors.xml +38 -0
- package/android/src/main/res/values/dimens.xml +10 -0
- package/android/src/main/res/values/public.xml +5 -0
- package/android/src/main/res/values/strings.xml +77 -0
- package/android/src/main/res/values/styles.xml +44 -0
- package/android/src/main/res/values-es/strings.xml +75 -0
- package/android/src/main/res/values-night/colors.xml +32 -0
- package/android/src/main/res/xml/chucker_provider_paths.xml +4 -0
- package/ios/SecuritySuite.swift +0 -2
- package/ios/SslPinning.swift +0 -26
- package/lib/commonjs/helpers.js +1 -1
- package/lib/commonjs/helpers.js.map +1 -1
- package/lib/commonjs/index.js +23 -40
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/helpers.js +3 -1
- package/lib/module/helpers.js.map +1 -1
- package/lib/module/index.js +21 -33
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/helpers.d.ts.map +1 -0
- package/lib/typescript/{index.d.ts → commonjs/src/index.d.ts} +1 -6
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/helpers.d.ts +3 -0
- package/lib/typescript/module/src/helpers.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +72 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +70 -43
- package/react-native-security-suite.podspec +23 -15
- package/src/helpers.ts +1 -1
- package/src/index.tsx +5 -18
- package/android/src/main/java/com/securitysuite/AndroidLogger.kt +0 -19
- package/android/src/main/java/com/securitysuite/modifier/Base64Decoder.kt +0 -11
- package/android/src/main/java/com/securitysuite/modifier/BasicAuthorizationHeaderModifier.kt +0 -16
- package/ios/SecuritySuite.xcodeproj/project.pbxproj +0 -293
- package/ios/SecuritySuite.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/SecuritySuite.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/SecuritySuite.xcodeproj/project.xcworkspace/xcuserdata/m.navabifar.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/SecuritySuite.xcodeproj/xcuserdata/m.navabifar.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/lib/typescript/helpers.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- /package/lib/typescript/{helpers.d.ts → commonjs/src/helpers.d.ts} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
interface Response {
|
|
2
|
+
status: number;
|
|
3
|
+
url: string;
|
|
4
|
+
json: () => Promise<{
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}>;
|
|
7
|
+
duration: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SuccessResponse extends Response {
|
|
10
|
+
response: string;
|
|
11
|
+
responseJSON: Promise<{
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export interface ErrorResponse extends Response {
|
|
16
|
+
error: string;
|
|
17
|
+
path: string;
|
|
18
|
+
message: string;
|
|
19
|
+
code: string;
|
|
20
|
+
}
|
|
21
|
+
interface Header {
|
|
22
|
+
[key: string]: string;
|
|
23
|
+
}
|
|
24
|
+
export interface Options {
|
|
25
|
+
body?: string | object;
|
|
26
|
+
headers: Header;
|
|
27
|
+
method?: 'DELETE' | 'GET' | 'POST' | 'PUT';
|
|
28
|
+
certificates?: string[];
|
|
29
|
+
validDomains?: string[];
|
|
30
|
+
timeout?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface FetchEventResponse {
|
|
33
|
+
url: string;
|
|
34
|
+
options: Options;
|
|
35
|
+
response: {
|
|
36
|
+
response: string;
|
|
37
|
+
error: string;
|
|
38
|
+
path: string;
|
|
39
|
+
message: string;
|
|
40
|
+
code: string;
|
|
41
|
+
status: number;
|
|
42
|
+
url: string;
|
|
43
|
+
json: () => Promise<{
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
}>;
|
|
46
|
+
duration: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
declare const SecuritySuite: any;
|
|
50
|
+
export declare const getPublicKey: () => Promise<string>;
|
|
51
|
+
export declare const getSharedKey: (serverPublicKey: string) => Promise<string>;
|
|
52
|
+
export declare const encryptBySharedKey: (input: string) => Promise<string>;
|
|
53
|
+
export declare const decryptBySharedKey: (input: string) => any;
|
|
54
|
+
export declare const getDeviceId: () => Promise<string>;
|
|
55
|
+
export declare const encrypt: (input: string, hardEncryption?: boolean, secretKey?: null) => Promise<string>;
|
|
56
|
+
export declare const decrypt: (input: string, hardEncryption?: boolean, secretKey?: null) => Promise<string>;
|
|
57
|
+
export declare const SecureStorage: {
|
|
58
|
+
setItem: (key: string, value: string) => Promise<void>;
|
|
59
|
+
getItem: (key: string) => Promise<string | null>;
|
|
60
|
+
mergeItem: (key: string, value: string) => Promise<void>;
|
|
61
|
+
removeItem: (key: string) => Promise<void>;
|
|
62
|
+
getAllKeys: () => Promise<readonly string[]>;
|
|
63
|
+
multiSet: (keyValuePairs: Array<Array<string>>) => Promise<void>;
|
|
64
|
+
multiGet: (keys: Array<string>) => Promise<readonly [string, string | null][]>;
|
|
65
|
+
multiMerge: (keyValuePairs: Array<Array<string>>) => Promise<void>;
|
|
66
|
+
multiRemove: (keys: Array<string>) => Promise<void>;
|
|
67
|
+
clear: () => Promise<void>;
|
|
68
|
+
};
|
|
69
|
+
export declare function fetch(url: string, options: Options, loggerIsEnabled?: boolean): Promise<SuccessResponse | ErrorResponse>;
|
|
70
|
+
export declare function deviceHasSecurityRisk(): Promise<boolean>;
|
|
71
|
+
export default SecuritySuite;
|
|
72
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-security-suite",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
4
|
"description": "Security solution for React Native",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
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
|
+
},
|
|
10
20
|
"files": [
|
|
11
21
|
"src",
|
|
12
22
|
"lib",
|
|
@@ -14,7 +24,7 @@
|
|
|
14
24
|
"ios",
|
|
15
25
|
"cpp",
|
|
16
26
|
"*.podspec",
|
|
17
|
-
"
|
|
27
|
+
"react-native.config.js",
|
|
18
28
|
"!ios/build",
|
|
19
29
|
"!android/build",
|
|
20
30
|
"!android/gradle",
|
|
@@ -27,24 +37,24 @@
|
|
|
27
37
|
"!**/.*"
|
|
28
38
|
],
|
|
29
39
|
"scripts": {
|
|
40
|
+
"example": "yarn workspace react-native-security-suite-example",
|
|
30
41
|
"test": "jest",
|
|
31
|
-
"typecheck": "tsc
|
|
42
|
+
"typecheck": "tsc",
|
|
32
43
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"build:android": "cd example/android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
|
|
37
|
-
"build:ios": "cd example/ios && xcodebuild -workspace SecuritySuiteExample.xcworkspace -scheme SecuritySuiteExample -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO",
|
|
38
|
-
"bootstrap": "yarn example && yarn install && yarn example pods",
|
|
39
|
-
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
|
|
44
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
45
|
+
"prepare": "bob build",
|
|
46
|
+
"release": "release-it"
|
|
40
47
|
},
|
|
41
48
|
"keywords": [
|
|
42
49
|
"react-native",
|
|
43
50
|
"ios",
|
|
44
51
|
"android"
|
|
45
52
|
],
|
|
46
|
-
"repository":
|
|
47
|
-
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/mohamadnavabi/react-native-security-suite.git"
|
|
56
|
+
},
|
|
57
|
+
"author": "Mohammad Navabi <7navabi@gmail.com> (https://github.com/mohamadnavabi)",
|
|
48
58
|
"license": "MIT",
|
|
49
59
|
"bugs": {
|
|
50
60
|
"url": "https://github.com/mohamadnavabi/react-native-security-suite/issues"
|
|
@@ -55,29 +65,28 @@
|
|
|
55
65
|
},
|
|
56
66
|
"devDependencies": {
|
|
57
67
|
"@commitlint/config-conventional": "^17.0.2",
|
|
58
|
-
"@evilmartians/lefthook": "^1.
|
|
59
|
-
"@react-native-community/
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@types/
|
|
63
|
-
"@types/react
|
|
68
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
69
|
+
"@react-native-community/cli": "15.0.1",
|
|
70
|
+
"@react-native/eslint-config": "^0.73.1",
|
|
71
|
+
"@release-it/conventional-changelog": "^9.0.2",
|
|
72
|
+
"@types/jest": "^29.5.5",
|
|
73
|
+
"@types/react": "^18.2.44",
|
|
64
74
|
"commitlint": "^17.0.2",
|
|
65
|
-
"del-cli": "^5.
|
|
66
|
-
"eslint": "^8.
|
|
67
|
-
"eslint-config-prettier": "^
|
|
68
|
-
"eslint-plugin-prettier": "^
|
|
69
|
-
"jest": "^
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"react": "
|
|
73
|
-
"react-native": "0.
|
|
74
|
-
"
|
|
75
|
-
"release-it": "^15.0.0",
|
|
75
|
+
"del-cli": "^5.1.0",
|
|
76
|
+
"eslint": "^8.51.0",
|
|
77
|
+
"eslint-config-prettier": "^9.0.0",
|
|
78
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
79
|
+
"jest": "^29.7.0",
|
|
80
|
+
"prettier": "^3.0.3",
|
|
81
|
+
"react": "18.3.1",
|
|
82
|
+
"react-native": "0.76.5",
|
|
83
|
+
"react-native-builder-bob": "^0.35.2",
|
|
84
|
+
"release-it": "^17.10.0",
|
|
76
85
|
"turbo": "^1.10.7",
|
|
77
|
-
"typescript": "^5.
|
|
86
|
+
"typescript": "^5.2.2"
|
|
78
87
|
},
|
|
79
88
|
"resolutions": {
|
|
80
|
-
"@types/react": "
|
|
89
|
+
"@types/react": "^18.2.44"
|
|
81
90
|
},
|
|
82
91
|
"peerDependencies": {
|
|
83
92
|
"@react-native-async-storage/async-storage": "*",
|
|
@@ -89,9 +98,10 @@
|
|
|
89
98
|
"optional": false
|
|
90
99
|
}
|
|
91
100
|
},
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
|
|
101
|
+
"workspaces": [
|
|
102
|
+
"example"
|
|
103
|
+
],
|
|
104
|
+
"packageManager": "yarn@3.6.1",
|
|
95
105
|
"jest": {
|
|
96
106
|
"preset": "react-native",
|
|
97
107
|
"modulePathIgnorePatterns": [
|
|
@@ -124,10 +134,11 @@
|
|
|
124
134
|
"eslintConfig": {
|
|
125
135
|
"root": true,
|
|
126
136
|
"extends": [
|
|
127
|
-
"@react-native
|
|
137
|
+
"@react-native",
|
|
128
138
|
"prettier"
|
|
129
139
|
],
|
|
130
140
|
"rules": {
|
|
141
|
+
"react/react-in-jsx-scope": "off",
|
|
131
142
|
"prettier/prettier": [
|
|
132
143
|
"error",
|
|
133
144
|
{
|
|
@@ -155,16 +166,32 @@
|
|
|
155
166
|
"source": "src",
|
|
156
167
|
"output": "lib",
|
|
157
168
|
"targets": [
|
|
158
|
-
|
|
159
|
-
|
|
169
|
+
[
|
|
170
|
+
"commonjs",
|
|
171
|
+
{
|
|
172
|
+
"esm": true
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
[
|
|
176
|
+
"module",
|
|
177
|
+
{
|
|
178
|
+
"esm": true
|
|
179
|
+
}
|
|
180
|
+
],
|
|
160
181
|
[
|
|
161
182
|
"typescript",
|
|
162
183
|
{
|
|
163
|
-
"project": "tsconfig.build.json"
|
|
184
|
+
"project": "tsconfig.build.json",
|
|
185
|
+
"esm": true
|
|
164
186
|
}
|
|
165
187
|
]
|
|
166
188
|
]
|
|
167
189
|
},
|
|
190
|
+
"create-react-native-library": {
|
|
191
|
+
"type": "legacy-module",
|
|
192
|
+
"languages": "kotlin-swift",
|
|
193
|
+
"version": "0.45.5"
|
|
194
|
+
},
|
|
168
195
|
"dependencies": {
|
|
169
196
|
"@react-native-async-storage/async-storage": "^1.19.0"
|
|
170
197
|
}
|
|
@@ -11,26 +11,34 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.license = package["license"]
|
|
12
12
|
s.authors = package["author"]
|
|
13
13
|
|
|
14
|
-
s.platforms = { :ios =>
|
|
14
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
15
15
|
s.source = { :git => "https://github.com/mohamadnavabi/react-native-security-suite.git", :tag => "#{s.version}" }
|
|
16
16
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
s.dependency "React-Core"
|
|
20
20
|
s.dependency "IOSSecuritySuite"
|
|
21
21
|
|
|
22
|
-
#
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
s
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
23
|
+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
24
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
25
|
+
install_modules_dependencies(s)
|
|
26
|
+
else
|
|
27
|
+
s.dependency "React-Core"
|
|
28
|
+
|
|
29
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
30
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
31
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
32
|
+
s.pod_target_xcconfig = {
|
|
33
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
34
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
35
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
36
|
+
}
|
|
37
|
+
s.dependency "React-Codegen"
|
|
38
|
+
s.dependency "RCT-Folly"
|
|
39
|
+
s.dependency "RCTRequired"
|
|
40
|
+
s.dependency "RCTTypeSafety"
|
|
41
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
42
|
+
end
|
|
35
43
|
end
|
|
36
44
|
end
|
package/src/helpers.ts
CHANGED
package/src/index.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { NativeModules, Platform } from 'react-native';
|
|
2
2
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
3
3
|
import { isJsonString, jsonParse } from './helpers';
|
|
4
|
-
import { EventEmitter } from 'events';
|
|
5
4
|
|
|
6
5
|
/*
|
|
7
6
|
* SSL Pinnning start
|
|
@@ -10,7 +9,6 @@ interface Response {
|
|
|
10
9
|
status: number;
|
|
11
10
|
url: string;
|
|
12
11
|
json: () => Promise<{ [key: string]: any }>;
|
|
13
|
-
curl: string;
|
|
14
12
|
duration: string;
|
|
15
13
|
}
|
|
16
14
|
|
|
@@ -51,7 +49,6 @@ export interface FetchEventResponse {
|
|
|
51
49
|
status: number;
|
|
52
50
|
url: string;
|
|
53
51
|
json: () => Promise<{ [key: string]: any }>;
|
|
54
|
-
curl: string;
|
|
55
52
|
duration: string;
|
|
56
53
|
};
|
|
57
54
|
}
|
|
@@ -276,20 +273,13 @@ export const SecureStorage = {
|
|
|
276
273
|
export function fetch(
|
|
277
274
|
url: string,
|
|
278
275
|
options: Options,
|
|
279
|
-
|
|
276
|
+
loggerIsEnabled = false
|
|
280
277
|
): Promise<SuccessResponse | ErrorResponse> {
|
|
281
278
|
return new Promise((resolve, reject) => {
|
|
282
279
|
SecuritySuite.fetch(
|
|
283
280
|
url,
|
|
284
|
-
options,
|
|
281
|
+
{ ...options, loggerIsEnabled },
|
|
285
282
|
(result: SuccessResponse, error: ErrorResponse) => {
|
|
286
|
-
if (eventEnabled)
|
|
287
|
-
SSEventEmitter.emit('fetch', {
|
|
288
|
-
url,
|
|
289
|
-
options,
|
|
290
|
-
response: result || error,
|
|
291
|
-
});
|
|
292
|
-
|
|
293
283
|
try {
|
|
294
284
|
if (error === null) {
|
|
295
285
|
resolve({
|
|
@@ -300,10 +290,9 @@ export function fetch(
|
|
|
300
290
|
const errorJson = jsonParse(error.error);
|
|
301
291
|
reject({
|
|
302
292
|
json: () => errorJson,
|
|
303
|
-
error: error?.error,
|
|
304
|
-
status: error?.status,
|
|
305
|
-
url: error?.url,
|
|
306
|
-
curl: error?.curl,
|
|
293
|
+
error: error?.error ?? error,
|
|
294
|
+
status: error?.status ?? '',
|
|
295
|
+
url: error?.url ?? '',
|
|
307
296
|
...errorJson,
|
|
308
297
|
});
|
|
309
298
|
}
|
|
@@ -319,6 +308,4 @@ export function deviceHasSecurityRisk(): Promise<boolean> {
|
|
|
319
308
|
return SecuritySuite.deviceHasSecurityRisk();
|
|
320
309
|
}
|
|
321
310
|
|
|
322
|
-
export const SSEventEmitter = new EventEmitter();
|
|
323
|
-
|
|
324
311
|
export default SecuritySuite;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
package com.securitysuite
|
|
2
|
-
|
|
3
|
-
import android.util.Log
|
|
4
|
-
import com.moczul.ok2curl.logger.Logger
|
|
5
|
-
|
|
6
|
-
class AndroidLogger : Logger {
|
|
7
|
-
|
|
8
|
-
override fun log(message: String) {
|
|
9
|
-
curl = message
|
|
10
|
-
|
|
11
|
-
// Log.v(TAG, message)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
companion object {
|
|
15
|
-
const val TAG = "Ok2Curl"
|
|
16
|
-
|
|
17
|
-
@JvmStatic var curl : String? = null
|
|
18
|
-
}
|
|
19
|
-
}
|
package/android/src/main/java/com/securitysuite/modifier/BasicAuthorizationHeaderModifier.kt
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
package com.securitysuite.modifier
|
|
2
|
-
|
|
3
|
-
import com.moczul.ok2curl.Header
|
|
4
|
-
import com.moczul.ok2curl.modifier.HeaderModifier
|
|
5
|
-
|
|
6
|
-
class BasicAuthorizationHeaderModifier(private val base64Decoder: Base64Decoder) : HeaderModifier {
|
|
7
|
-
override fun matches(header: Header): Boolean {
|
|
8
|
-
return "Authorization" == header.name && header.value.startsWith("Basic")
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
override fun modify(header: Header): Header {
|
|
12
|
-
val valueToDecode = header.value.replace("Basic", "").trim()
|
|
13
|
-
val decodedHeaderValue = base64Decoder.decode(valueToDecode)
|
|
14
|
-
return Header(name = header.name, value = decodedHeaderValue)
|
|
15
|
-
}
|
|
16
|
-
}
|