react-native-security-suite 0.9.22 → 1.0.0-rc.1
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 +235 -69
- package/android/build.gradle +11 -0
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/securitysuite/CryptoConfig.java +158 -0
- package/android/src/main/java/com/securitysuite/CryptoUtils.java +152 -0
- package/android/src/main/java/com/securitysuite/EcdhKeyStore.java +60 -0
- package/android/src/main/java/com/securitysuite/HeaderSanitizer.java +75 -0
- package/android/src/main/java/com/securitysuite/JWSGenerator.java +237 -32
- package/android/src/main/java/com/securitysuite/JwsFetchPayload.java +81 -0
- package/android/src/main/java/com/securitysuite/Obfuscation.java +57 -0
- package/android/src/main/java/com/securitysuite/SecureStorageNative.java +211 -0
- package/android/src/main/java/com/securitysuite/SecureView.java +2 -10
- package/android/src/main/java/com/securitysuite/SecureWindowHelper.java +30 -0
- package/android/src/main/java/com/securitysuite/SecuritySuiteModule.java +310 -102
- package/android/src/main/java/com/securitysuite/Sslpinning.java +219 -106
- package/android/src/main/java/com/securitysuite/security/AppIntegrityChecker.java +133 -0
- package/android/src/main/java/com/securitysuite/security/EmulatorDetector.java +145 -0
- package/android/src/main/java/com/securitysuite/security/RuntimeDetector.java +234 -0
- package/android/src/test/java/com/securitysuite/JWSGeneratorTest.java +153 -0
- package/android/src/test/java/com/securitysuite/SecureStorageNativeTest.java +37 -0
- package/ios/CryptoConfig.swift +124 -0
- package/ios/JWSGenerator.swift +288 -0
- package/ios/JWSGeneratorTests.swift +168 -0
- package/ios/KeychainHelper.swift +104 -0
- package/ios/Obfuscation.swift +42 -0
- package/ios/SecureStorageNative.swift +84 -0
- package/ios/Security/AppIntegrityChecker.swift +85 -0
- package/ios/Security/EmulatorDetector.swift +45 -0
- package/ios/Security/RuntimeDetector.swift +107 -0
- package/ios/SecuritySuite.mm +28 -4
- package/ios/SecuritySuite.swift +407 -131
- package/ios/SslPinning.swift +242 -263
- package/lib/commonjs/clipboard/index.js +3 -0
- package/lib/commonjs/clipboard/index.js.map +1 -0
- package/lib/commonjs/crypto/index.js +39 -0
- package/lib/commonjs/crypto/index.js.map +1 -0
- package/lib/commonjs/device/index.js +40 -0
- package/lib/commonjs/device/index.js.map +1 -0
- package/lib/commonjs/errors.js +62 -0
- package/lib/commonjs/errors.js.map +1 -0
- package/lib/commonjs/index.js +220 -151
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/integrity/index.js +40 -0
- package/lib/commonjs/integrity/index.js.map +1 -0
- package/lib/commonjs/jws.js +141 -0
- package/lib/commonjs/jws.js.map +1 -0
- package/lib/commonjs/legacy/cryptoOptions.js +20 -0
- package/lib/commonjs/legacy/cryptoOptions.js.map +1 -0
- package/lib/commonjs/native/bridge.js +23 -0
- package/lib/commonjs/native/bridge.js.map +1 -0
- package/lib/commonjs/network/index.js +3 -0
- package/lib/commonjs/network/index.js.map +1 -0
- package/lib/commonjs/risk/score.js +36 -0
- package/lib/commonjs/risk/score.js.map +1 -0
- package/lib/commonjs/runtime/index.js +31 -0
- package/lib/commonjs/runtime/index.js.map +1 -0
- package/lib/commonjs/screen/index.js +13 -0
- package/lib/commonjs/screen/index.js.map +1 -0
- package/lib/commonjs/securitySuite/index.js +42 -0
- package/lib/commonjs/securitySuite/index.js.map +1 -0
- package/lib/commonjs/storage/index.js +3 -0
- package/lib/commonjs/storage/index.js.map +1 -0
- package/lib/commonjs/types/detection.js +2 -0
- package/lib/commonjs/types/detection.js.map +1 -0
- package/lib/module/clipboard/index.js +3 -0
- package/lib/module/clipboard/index.js.map +1 -0
- package/lib/module/crypto/index.js +35 -0
- package/lib/module/crypto/index.js.map +1 -0
- package/lib/module/device/index.js +36 -0
- package/lib/module/device/index.js.map +1 -0
- package/lib/module/errors.js +55 -0
- package/lib/module/errors.js.map +1 -0
- package/lib/module/index.js +147 -148
- package/lib/module/index.js.map +1 -1
- package/lib/module/integrity/index.js +36 -0
- package/lib/module/integrity/index.js.map +1 -0
- package/lib/module/jws.js +127 -0
- package/lib/module/jws.js.map +1 -0
- package/lib/module/legacy/cryptoOptions.js +16 -0
- package/lib/module/legacy/cryptoOptions.js.map +1 -0
- package/lib/module/native/bridge.js +19 -0
- package/lib/module/native/bridge.js.map +1 -0
- package/lib/module/network/index.js +3 -0
- package/lib/module/network/index.js.map +1 -0
- package/lib/module/risk/score.js +32 -0
- package/lib/module/risk/score.js.map +1 -0
- package/lib/module/runtime/index.js +27 -0
- package/lib/module/runtime/index.js.map +1 -0
- package/lib/module/screen/index.js +5 -0
- package/lib/module/screen/index.js.map +1 -0
- package/lib/module/securitySuite/index.js +38 -0
- package/lib/module/securitySuite/index.js.map +1 -0
- package/lib/module/storage/index.js +3 -0
- package/lib/module/storage/index.js.map +1 -0
- package/lib/module/types/detection.js +2 -0
- package/lib/module/types/detection.js.map +1 -0
- package/lib/typescript/commonjs/docs/api-v1-proposal.d.ts +215 -0
- package/lib/typescript/commonjs/docs/api-v1-proposal.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/SecureView.d.ts +1 -1
- package/lib/typescript/commonjs/src/SecureView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/clipboard/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/clipboard/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/crypto/index.d.ts +15 -0
- package/lib/typescript/commonjs/src/crypto/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/device/index.d.ts +11 -0
- package/lib/typescript/commonjs/src/device/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/errors.d.ts +17 -0
- package/lib/typescript/commonjs/src/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/helpers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +77 -24
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/integrity/index.d.ts +6 -0
- package/lib/typescript/commonjs/src/integrity/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/jws.d.ts +44 -0
- package/lib/typescript/commonjs/src/jws.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/legacy/cryptoOptions.d.ts +35 -0
- package/lib/typescript/commonjs/src/legacy/cryptoOptions.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/native/bridge.d.ts +12 -0
- package/lib/typescript/commonjs/src/native/bridge.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/network/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/network/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/risk/score.d.ts +12 -0
- package/lib/typescript/commonjs/src/risk/score.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/index.d.ts +6 -0
- package/lib/typescript/commonjs/src/runtime/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/screen/index.d.ts +3 -0
- package/lib/typescript/commonjs/src/screen/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/securitySuite/index.d.ts +6 -0
- package/lib/typescript/commonjs/src/securitySuite/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/storage/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/storage/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/detection.d.ts +41 -0
- package/lib/typescript/commonjs/src/types/detection.d.ts.map +1 -0
- package/lib/typescript/module/docs/api-v1-proposal.d.ts +215 -0
- package/lib/typescript/module/docs/api-v1-proposal.d.ts.map +1 -0
- package/lib/typescript/module/src/SecureView.d.ts +1 -1
- package/lib/typescript/module/src/SecureView.d.ts.map +1 -1
- package/lib/typescript/module/src/clipboard/index.d.ts +2 -0
- package/lib/typescript/module/src/clipboard/index.d.ts.map +1 -0
- package/lib/typescript/module/src/crypto/index.d.ts +15 -0
- package/lib/typescript/module/src/crypto/index.d.ts.map +1 -0
- package/lib/typescript/module/src/device/index.d.ts +11 -0
- package/lib/typescript/module/src/device/index.d.ts.map +1 -0
- package/lib/typescript/module/src/errors.d.ts +17 -0
- package/lib/typescript/module/src/errors.d.ts.map +1 -0
- package/lib/typescript/module/src/helpers.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +77 -24
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/integrity/index.d.ts +6 -0
- package/lib/typescript/module/src/integrity/index.d.ts.map +1 -0
- package/lib/typescript/module/src/jws.d.ts +44 -0
- package/lib/typescript/module/src/jws.d.ts.map +1 -0
- package/lib/typescript/module/src/legacy/cryptoOptions.d.ts +35 -0
- package/lib/typescript/module/src/legacy/cryptoOptions.d.ts.map +1 -0
- package/lib/typescript/module/src/native/bridge.d.ts +12 -0
- package/lib/typescript/module/src/native/bridge.d.ts.map +1 -0
- package/lib/typescript/module/src/network/index.d.ts +2 -0
- package/lib/typescript/module/src/network/index.d.ts.map +1 -0
- package/lib/typescript/module/src/risk/score.d.ts +12 -0
- package/lib/typescript/module/src/risk/score.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/index.d.ts +6 -0
- package/lib/typescript/module/src/runtime/index.d.ts.map +1 -0
- package/lib/typescript/module/src/screen/index.d.ts +3 -0
- package/lib/typescript/module/src/screen/index.d.ts.map +1 -0
- package/lib/typescript/module/src/securitySuite/index.d.ts +6 -0
- package/lib/typescript/module/src/securitySuite/index.d.ts.map +1 -0
- package/lib/typescript/module/src/storage/index.d.ts +2 -0
- package/lib/typescript/module/src/storage/index.d.ts.map +1 -0
- package/lib/typescript/module/src/types/detection.d.ts +41 -0
- package/lib/typescript/module/src/types/detection.d.ts.map +1 -0
- package/package.json +2 -10
- package/src/clipboard/index.ts +1 -0
- package/src/crypto/index.ts +49 -0
- package/src/device/index.ts +47 -0
- package/src/errors.ts +84 -0
- package/src/index.tsx +293 -195
- package/src/integrity/index.ts +46 -0
- package/src/jws.ts +213 -0
- package/src/legacy/cryptoOptions.ts +49 -0
- package/src/native/bridge.ts +37 -0
- package/src/network/index.ts +1 -0
- package/src/risk/score.ts +49 -0
- package/src/runtime/index.ts +43 -0
- package/src/screen/index.ts +2 -0
- package/src/securitySuite/index.ts +45 -0
- package/src/storage/index.ts +1 -0
- package/src/types/detection.ts +46 -0
- package/android/src/main/java/com/securitysuite/StorageEncryption.java +0 -52
- package/ios/StorageEncryption.swift +0 -89
|
@@ -1,4 +1,49 @@
|
|
|
1
|
+
import { type CryptoOptions } from './legacy/cryptoOptions';
|
|
2
|
+
import { type GenerateJWSOptions, type JwsFetchOptions } from './jws';
|
|
1
3
|
export * from './SecureView';
|
|
4
|
+
export type { GenerateJWSOptions, JwsAlgorithm, JwsFetchOptions, JwsHeaderValue, JwsHeaders, JwsPayload, } from './jws';
|
|
5
|
+
export type { CryptoOptions, KeyAgreementAlgorithm, KeyType, EncryptionKeyAlgorithm, HmacAlgorithm, CipherAlgorithm, } from './legacy/cryptoOptions';
|
|
6
|
+
export { SecurityError, SecurityErrorCode, mapNativeError, isSecurityError } from './errors';
|
|
7
|
+
export { DeviceSecurity } from './device';
|
|
8
|
+
export { RuntimeSecurity } from './runtime';
|
|
9
|
+
export { AppIntegrity } from './integrity';
|
|
10
|
+
export { Crypto } from './crypto';
|
|
11
|
+
export { SecuritySuite } from './securitySuite';
|
|
12
|
+
export type { RuntimeThreatReport, AppIntegrityReport, DeviceEnvironment, DeviceSecurityReport, SecurityReport, RiskLevel, BuildType, } from './types/detection';
|
|
13
|
+
/** @deprecated Use `JwsHeaders` (optional `Record<string, JwsHeaderValue>`) instead. */
|
|
14
|
+
export interface LegacyJwsHeaders {
|
|
15
|
+
kid: string;
|
|
16
|
+
request_id: string;
|
|
17
|
+
[key: string]: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SslPinningOptions {
|
|
20
|
+
/** Base64-encoded SPKI SHA-256 hashes (with or without `sha256/` prefix). */
|
|
21
|
+
certificates: string[];
|
|
22
|
+
/** Allowed hostnames. Request host must match one of these before pinning is evaluated. */
|
|
23
|
+
validDomains: string[];
|
|
24
|
+
}
|
|
25
|
+
interface Header {
|
|
26
|
+
[key: string]: string;
|
|
27
|
+
}
|
|
28
|
+
export interface Options {
|
|
29
|
+
body?: string | object;
|
|
30
|
+
headers: Header;
|
|
31
|
+
method?: 'DELETE' | 'GET' | 'POST' | 'PUT' | 'PATCH';
|
|
32
|
+
timeout?: number;
|
|
33
|
+
/** SSL pinning configuration. Both certificates and validDomains are required together. */
|
|
34
|
+
certificates?: string[];
|
|
35
|
+
validDomains?: string[];
|
|
36
|
+
/** @deprecated Use `jws` instead. */
|
|
37
|
+
keyId?: string;
|
|
38
|
+
/** @deprecated Use `jws` instead. */
|
|
39
|
+
requestId?: string;
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Legacy signing secret. Use `jws.secret` instead.
|
|
42
|
+
*/
|
|
43
|
+
secret?: string;
|
|
44
|
+
/** JWS request-signing configuration. */
|
|
45
|
+
jws?: JwsFetchOptions;
|
|
46
|
+
}
|
|
2
47
|
interface Response {
|
|
3
48
|
status: number;
|
|
4
49
|
url: string;
|
|
@@ -19,17 +64,6 @@ export interface ErrorResponse extends Response {
|
|
|
19
64
|
message: string;
|
|
20
65
|
code: string;
|
|
21
66
|
}
|
|
22
|
-
interface Header {
|
|
23
|
-
[key: string]: string;
|
|
24
|
-
}
|
|
25
|
-
export interface Options {
|
|
26
|
-
body?: string | object;
|
|
27
|
-
headers: Header;
|
|
28
|
-
method?: 'DELETE' | 'GET' | 'POST' | 'PUT';
|
|
29
|
-
certificates?: string[];
|
|
30
|
-
validDomains?: string[];
|
|
31
|
-
timeout?: number;
|
|
32
|
-
}
|
|
33
67
|
export interface FetchEventResponse {
|
|
34
68
|
url: string;
|
|
35
69
|
options: Options;
|
|
@@ -47,27 +81,46 @@ export interface FetchEventResponse {
|
|
|
47
81
|
duration: string;
|
|
48
82
|
};
|
|
49
83
|
}
|
|
50
|
-
declare const
|
|
84
|
+
declare const NativeSecuritySuiteModule: any;
|
|
51
85
|
export declare const getPublicKey: () => Promise<string>;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
86
|
+
/**
|
|
87
|
+
* @deprecated Prefer `Crypto.establishSharedKey()` which keeps the derived key in native memory.
|
|
88
|
+
*/
|
|
89
|
+
export declare const getSharedKey: (serverPublicKey: string, options?: CryptoOptions) => Promise<string>;
|
|
90
|
+
export declare const encryptBySharedKey: (input: string, options?: CryptoOptions) => Promise<string>;
|
|
91
|
+
export declare const decryptBySharedKey: (input: string, options?: CryptoOptions) => Promise<string>;
|
|
92
|
+
export declare const generateJWS: (options: GenerateJWSOptions) => Promise<string>;
|
|
93
|
+
/**
|
|
94
|
+
* Local obfuscation only — NOT secure encryption. Requires an explicit secret.
|
|
95
|
+
* Never use for credentials, tokens, or PII at rest.
|
|
96
|
+
*/
|
|
97
|
+
export declare const obfuscate: (input: string, secret: string) => Promise<string>;
|
|
98
|
+
export declare const deobfuscate: (input: string, secret: string) => Promise<string>;
|
|
55
99
|
export declare const getDeviceId: () => Promise<string>;
|
|
56
|
-
|
|
57
|
-
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated Use `obfuscate()` with an explicit secret, or `SecureStorage` for at-rest data.
|
|
102
|
+
*/
|
|
103
|
+
export declare const encrypt: (input: string, hardEncryption?: boolean, secretKey?: string | null) => Promise<string>;
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated Use `deobfuscate()` with an explicit secret, or `SecureStorage` for at-rest data.
|
|
106
|
+
*/
|
|
107
|
+
export declare const decrypt: (input: string, hardEncryption?: boolean, secretKey?: string | null) => Promise<string>;
|
|
108
|
+
/** Hardware-backed encrypted storage (Keychain on iOS, EncryptedSharedPreferences on Android). */
|
|
58
109
|
export declare const SecureStorage: {
|
|
59
110
|
setItem: (key: string, value: string) => Promise<void>;
|
|
60
111
|
getItem: (key: string) => Promise<string | null>;
|
|
61
|
-
mergeItem: (key: string, value: string) => Promise<void>;
|
|
62
112
|
removeItem: (key: string) => Promise<void>;
|
|
63
|
-
getAllKeys: () => Promise<
|
|
64
|
-
multiSet: (keyValuePairs: Array<Array<string>>) => Promise<void>;
|
|
65
|
-
multiGet: (keys: Array<string>) => Promise<readonly [string, string | null][]>;
|
|
66
|
-
multiMerge: (keyValuePairs: Array<Array<string>>) => Promise<void>;
|
|
67
|
-
multiRemove: (keys: Array<string>) => Promise<void>;
|
|
113
|
+
getAllKeys: () => Promise<string[]>;
|
|
68
114
|
clear: () => Promise<void>;
|
|
115
|
+
multiSet: (keyValuePairs: Array<[string, string]>) => Promise<void>;
|
|
116
|
+
multiGet: (keys: string[]) => Promise<readonly [string, string | null][]>;
|
|
117
|
+
multiRemove: (keys: string[]) => Promise<void>;
|
|
118
|
+
/** @deprecated Use multiSet instead. */
|
|
119
|
+
mergeItem: (key: string, value: string) => Promise<void>;
|
|
120
|
+
/** @deprecated Use multiSet instead. */
|
|
121
|
+
multiMerge: (keyValuePairs: Array<[string, string]>) => Promise<void>;
|
|
69
122
|
};
|
|
70
123
|
export declare function fetch(url: string, options: Options, loggerIsEnabled?: boolean): Promise<SuccessResponse | ErrorResponse>;
|
|
71
124
|
export declare function deviceHasSecurityRisk(): Promise<boolean>;
|
|
72
|
-
export default
|
|
125
|
+
export default NativeSecuritySuiteModule;
|
|
73
126
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACrB,MAAM,OAAO,CAAC;AAEf,cAAc,cAAc,CAAC;AAC7B,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,UAAU,EACV,UAAU,GACX,MAAM,OAAO,CAAC;AAEf,YAAY,EACV,aAAa,EACb,qBAAqB,EACrB,OAAO,EACP,sBAAsB,EACtB,aAAa,EACb,eAAe,GAChB,MAA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,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAG,OAAO,CAAC,IAAI,CAAC;qBAO/D,MAAM,EAAE,KACb,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;wBAQpB,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAAC;IAIlD,wCAAwC;qBACjB,MAAM,SAAS,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;IAiB5D,wCAAwC;gCACN,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAG,OAAO,CAAC,IAAI,CAAC;CAK1E,CAAC;AAEF,wBAAgB,KAAK,CACnB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,eAAe,UAAU,GACxB,OAAO,CAAC,eAAe,GAAG,aAAa,CAAC,CA8B1C;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC,CAExD;AAED,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/integrity/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAoCxE,eAAO,MAAM,YAAY;cACb,OAAO,CAAC,kBAAkB,CAAC;CAKtC,CAAC;AAEF,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type JwsAlgorithm = 'HS256' | 'HS384' | 'HS512';
|
|
2
|
+
export type JwsPayload = string | Record<string, unknown> | unknown[] | number | boolean | null | undefined;
|
|
3
|
+
export type JwsHeaderValue = string | number | boolean | null;
|
|
4
|
+
export type JwsHeaders = Record<string, JwsHeaderValue>;
|
|
5
|
+
export interface GenerateJWSOptions {
|
|
6
|
+
payload?: JwsPayload;
|
|
7
|
+
algorithm?: JwsAlgorithm;
|
|
8
|
+
headers?: JwsHeaders;
|
|
9
|
+
secret: string;
|
|
10
|
+
}
|
|
11
|
+
export interface JwsFetchOptions {
|
|
12
|
+
algorithm?: JwsAlgorithm;
|
|
13
|
+
headers?: JwsHeaders;
|
|
14
|
+
secret: string;
|
|
15
|
+
payload?: JwsPayload;
|
|
16
|
+
detached?: boolean;
|
|
17
|
+
headerName?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function isEmptyJwsPayload(payload: JwsPayload | undefined): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Normalizes a JWS payload to the exact UTF-8 string used for signing.
|
|
22
|
+
* Empty payload cases return an empty string (never "null" or "undefined").
|
|
23
|
+
*/
|
|
24
|
+
export declare function normalizeJwsPayload(payload: JwsPayload | undefined): string;
|
|
25
|
+
export declare function validateJwsAlgorithm(algorithm: string | undefined): JwsAlgorithm;
|
|
26
|
+
export declare function validateJwsSecret(secret: unknown): string;
|
|
27
|
+
export declare function validateJwsHeaderKey(key: string): void;
|
|
28
|
+
export declare function validateJwsHeaderValue(key: string, value: unknown): JwsHeaderValue;
|
|
29
|
+
export declare function validateJwsHeaders(headers: unknown): JwsHeaders;
|
|
30
|
+
/**
|
|
31
|
+
* Resolves the JWS algorithm from options and/or protected headers.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveJwsAlgorithm(algorithm: JwsAlgorithm | undefined, headers: JwsHeaders): JwsAlgorithm;
|
|
34
|
+
export interface NativeGenerateJWSOptions {
|
|
35
|
+
payload: string;
|
|
36
|
+
algorithm: JwsAlgorithm;
|
|
37
|
+
secret: string;
|
|
38
|
+
headers: JwsHeaders;
|
|
39
|
+
detached: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare function toNativeGenerateJWSOptions(options: GenerateJWSOptions, detached?: boolean): NativeGenerateJWSOptions;
|
|
42
|
+
export declare function toNativeJwsFetchOptions(jws: JwsFetchOptions): NativeGenerateJWSOptions;
|
|
43
|
+
export declare function assertCompactJwsShape(j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D;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAItD;AAED,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,OAAO,GACb,cAAc,CAqBhB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CAc/D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,YAAY,GAAG,SAAS,EACnC,OAAO,EAAE,UAAU,GAClB,YAAY,CAqBd;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,YAAY,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,UAAQ,GACf,wBAAwB,CAa1B;AAED,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,eAAe,GACnB,wBAAwB,CAY1B;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAOvD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Shared crypto option types used by legacy exports and the Crypto namespace. */
|
|
2
|
+
export type KeyAgreementAlgorithm = 'X25519' | 'ECDH' | (string & {});
|
|
3
|
+
export type KeyType = 'OKP' | 'EC' | (string & {});
|
|
4
|
+
export type EncryptionKeyAlgorithm = 'AES-256' | 'AES' | (string & {});
|
|
5
|
+
export type HmacAlgorithm = 'HMAC-SHA-256' | 'HMAC-SHA-384' | 'HMAC-SHA-512' | 'HmacSHA256' | 'HmacSHA384' | 'HmacSHA512' | (string & {});
|
|
6
|
+
export type CipherAlgorithm = 'AES-GCM' | 'AES/GCM/NoPadding' | (string & {});
|
|
7
|
+
export interface CryptoOptions {
|
|
8
|
+
keyAgreementAlgorithm?: KeyAgreementAlgorithm;
|
|
9
|
+
keyType?: KeyType;
|
|
10
|
+
encryptionKeyAlgorithm?: EncryptionKeyAlgorithm;
|
|
11
|
+
hmacAlgorithm?: HmacAlgorithm;
|
|
12
|
+
cipher?: CipherAlgorithm;
|
|
13
|
+
tagLength?: number;
|
|
14
|
+
ivLength?: number;
|
|
15
|
+
/** @deprecated Use `keyType` instead. */
|
|
16
|
+
keyFactoryAlgorithm?: KeyType;
|
|
17
|
+
/** @deprecated Use `hmacAlgorithm` instead. */
|
|
18
|
+
hmacKeyAlgorithm?: HmacAlgorithm;
|
|
19
|
+
/** @deprecated Use `cipher` instead. */
|
|
20
|
+
cipherTransformation?: CipherAlgorithm;
|
|
21
|
+
/** @deprecated Use `tagLength` instead. */
|
|
22
|
+
gcmTagLength?: number;
|
|
23
|
+
/** @deprecated Use `ivLength` instead. */
|
|
24
|
+
gcmIvLength?: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function toNativeCryptoOptions(options?: CryptoOptions | null): {
|
|
27
|
+
keyAgreementAlgorithm: KeyAgreementAlgorithm;
|
|
28
|
+
keyFactoryAlgorithm: KeyType;
|
|
29
|
+
encryptionKeyAlgorithm: EncryptionKeyAlgorithm;
|
|
30
|
+
hmacKeyAlgorithm: HmacAlgorithm;
|
|
31
|
+
cipherTransformation: CipherAlgorithm;
|
|
32
|
+
gcmTagLength: number;
|
|
33
|
+
gcmIvLength: number;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=cryptoOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cryptoOptions.d.ts","sourceRoot":"","sources":["../../../../../src/legacy/cryptoOptions.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEtE,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEnD,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,KAAK,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEvE,MAAM,MAAM,aAAa,GACrB,cAAc,GACd,cAAc,GACd,cAAc,GACd,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,mBAAmB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAE9E,MAAM,WAAW,aAAa;IAC5B,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,+CAA+C;IAC/C,gBAAgB,CAAC,EAAE,aAAa,CAAC;IACjC,wCAAwC;IACxC,oBAAoB,CAAC,EAAE,eAAe,CAAC;IACvC,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI;;;;;;;;EAUnE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface SecuritySuiteNativeModule {
|
|
2
|
+
getPublicKey(): Promise<string>;
|
|
3
|
+
getSharedKey(serverPK: string, options: Record<string, unknown>): Promise<string>;
|
|
4
|
+
establishSharedKey?(serverPK: string, options: Record<string, unknown>): Promise<void>;
|
|
5
|
+
runtimeDetect(): Promise<Record<string, unknown>>;
|
|
6
|
+
appIntegrityVerify(): Promise<Record<string, unknown>>;
|
|
7
|
+
deviceGetEnvironment(): Promise<Record<string, unknown>>;
|
|
8
|
+
deviceHasSecurityRisk(): Promise<boolean>;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export declare function getNativeModule(): SecuritySuiteNativeModule;
|
|
12
|
+
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../../../../src/native/bridge.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,yBAAyB;IACxC,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAClF,kBAAkB,CAAC,CACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACzD,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAgB,eAAe,IAAI,yBAAyB,CAc3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/network/index.ts"],"names":[],"mappings":"AAAA,uFAAuF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AppIntegrityReport, DeviceEnvironment, RiskLevel, RuntimeThreatReport } from '../types/detection';
|
|
2
|
+
export declare function computeRiskScore(input: {
|
|
3
|
+
isRooted: boolean;
|
|
4
|
+
isJailbroken: boolean;
|
|
5
|
+
runtime: RuntimeThreatReport;
|
|
6
|
+
app: AppIntegrityReport;
|
|
7
|
+
environment: DeviceEnvironment;
|
|
8
|
+
}): {
|
|
9
|
+
riskScore: number;
|
|
10
|
+
riskLevel: RiskLevel;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=score.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.d.ts","sourceRoot":"","sources":["../../../../../src/risk/score.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,EACT,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,GAAG,EAAE,kBAAkB,CAAC;IACxB,WAAW,EAAE,iBAAiB,CAAC;CAChC,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,CAmC9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAiC9D,eAAO,MAAM,eAAe;cAChB,OAAO,CAAC,mBAAmB,CAAC;CAKvC,CAAC;AAEF,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/screen/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/securitySuite/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,eAAO,MAAM,aAAa;yBACG,OAAO,CAAC,cAAc,CAAC;CAiCnD,CAAC;AAEF,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/storage/index.ts"],"names":[],"mappings":"AAAA,mGAAmG"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface RuntimeThreatReport {
|
|
2
|
+
debuggerAttached: boolean;
|
|
3
|
+
fridaDetected: boolean;
|
|
4
|
+
xposedDetected?: boolean;
|
|
5
|
+
substrateDetected?: boolean;
|
|
6
|
+
magiskDetected?: boolean;
|
|
7
|
+
suspiciousLibraries: string[];
|
|
8
|
+
suspiciousPorts: number[];
|
|
9
|
+
}
|
|
10
|
+
export type BuildType = 'debug' | 'release' | 'testflight';
|
|
11
|
+
export interface AppIntegrityReport {
|
|
12
|
+
validSignature: boolean;
|
|
13
|
+
installerTrusted?: boolean;
|
|
14
|
+
debuggable: boolean;
|
|
15
|
+
tampered: boolean;
|
|
16
|
+
buildType: BuildType;
|
|
17
|
+
signingCertificateSha256?: string;
|
|
18
|
+
installerPackage?: string | null;
|
|
19
|
+
bundleIdentifier?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface DeviceEnvironment {
|
|
22
|
+
isEmulator: boolean;
|
|
23
|
+
isSimulator: boolean;
|
|
24
|
+
indicators: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface DeviceSecurityReport {
|
|
27
|
+
isRooted: boolean;
|
|
28
|
+
isJailbroken: boolean;
|
|
29
|
+
isEmulator: boolean;
|
|
30
|
+
isSimulator: boolean;
|
|
31
|
+
environmentIndicators: string[];
|
|
32
|
+
}
|
|
33
|
+
export type RiskLevel = 'low' | 'medium' | 'high';
|
|
34
|
+
export interface SecurityReport {
|
|
35
|
+
device: DeviceSecurityReport;
|
|
36
|
+
runtime: RuntimeThreatReport;
|
|
37
|
+
app: AppIntegrityReport;
|
|
38
|
+
riskScore: number;
|
|
39
|
+
riskLevel: RiskLevel;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detection.d.ts","sourceRoot":"","sources":["../../../../../src/types/detection.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,CAAC;AAE3D,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,qBAAqB,EAAE,MAAM,EAAE,CAAC;CACjC;AAED,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAElD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,oBAAoB,CAAC;IAC7B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,GAAG,EAAE,kBAAkB,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;CACtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-security-suite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
4
|
"description": "Comprehensive security suite for React Native apps - Root/Jailbreak detection, SSL pinning, encryption, secure storage, screenshot protection, and network monitoring",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
|
@@ -106,15 +106,9 @@
|
|
|
106
106
|
"@types/react": "^18.2.44"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
109
|
-
"@react-native-async-storage/async-storage": "*",
|
|
110
109
|
"react": "*",
|
|
111
110
|
"react-native": "*"
|
|
112
111
|
},
|
|
113
|
-
"peerDependenciesMeta": {
|
|
114
|
-
"@react-native-async-storage/async-storage": {
|
|
115
|
-
"optional": false
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
112
|
"workspaces": [
|
|
119
113
|
"example"
|
|
120
114
|
],
|
|
@@ -209,7 +203,5 @@
|
|
|
209
203
|
"languages": "kotlin-swift",
|
|
210
204
|
"version": "0.45.5"
|
|
211
205
|
},
|
|
212
|
-
"dependencies": {
|
|
213
|
-
"@react-native-async-storage/async-storage": "^1.19.0"
|
|
214
|
-
}
|
|
206
|
+
"dependencies": {}
|
|
215
207
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/** Phase 2+ namespace placeholder. */
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { getNativeModule } from '../native/bridge';
|
|
2
|
+
import type { CryptoOptions } from '../legacy/cryptoOptions';
|
|
3
|
+
|
|
4
|
+
function toNativeCryptoOptions(options?: CryptoOptions | null) {
|
|
5
|
+
return {
|
|
6
|
+
keyAgreementAlgorithm: options?.keyAgreementAlgorithm ?? 'X25519',
|
|
7
|
+
keyFactoryAlgorithm: options?.keyType ?? options?.keyFactoryAlgorithm ?? 'OKP',
|
|
8
|
+
encryptionKeyAlgorithm: options?.encryptionKeyAlgorithm ?? 'AES-256',
|
|
9
|
+
hmacKeyAlgorithm: options?.hmacAlgorithm ?? options?.hmacKeyAlgorithm ?? 'HMAC-SHA-512',
|
|
10
|
+
cipherTransformation: options?.cipher ?? options?.cipherTransformation ?? 'AES-GCM',
|
|
11
|
+
gcmTagLength: options?.tagLength ?? options?.gcmTagLength ?? 128,
|
|
12
|
+
gcmIvLength: options?.ivLength ?? options?.gcmIvLength ?? 12,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface EstablishSharedKeyOptions extends CryptoOptions {
|
|
17
|
+
/** @deprecated Prefer native-only flow; set true only for legacy compatibility. */
|
|
18
|
+
returnSharedKey?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Crypto = {
|
|
22
|
+
getPublicKey(): Promise<string> {
|
|
23
|
+
return getNativeModule().getPublicKey();
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Derives a shared encryption key natively without returning it to JavaScript.
|
|
28
|
+
* Call `encryptBySharedKey` / `decryptBySharedKey` afterward (legacy bridge methods).
|
|
29
|
+
*/
|
|
30
|
+
establishSharedKey(
|
|
31
|
+
serverPublicKey: string,
|
|
32
|
+
options?: EstablishSharedKeyOptions
|
|
33
|
+
): Promise<string | void> {
|
|
34
|
+
const native = getNativeModule();
|
|
35
|
+
const nativeOptions = toNativeCryptoOptions(options);
|
|
36
|
+
|
|
37
|
+
if (options?.returnSharedKey) {
|
|
38
|
+
return native.getSharedKey(serverPublicKey, nativeOptions);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (typeof native.establishSharedKey === 'function') {
|
|
42
|
+
return native.establishSharedKey(serverPublicKey, nativeOptions);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return native.getSharedKey(serverPublicKey, nativeOptions).then(() => undefined);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type { CryptoOptions } from '../legacy/cryptoOptions';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { getNativeModule } from '../native/bridge';
|
|
4
|
+
import type { DeviceEnvironment } from '../types/detection';
|
|
5
|
+
|
|
6
|
+
function parseEnvironment(raw: Record<string, unknown>): DeviceEnvironment {
|
|
7
|
+
return {
|
|
8
|
+
isEmulator: Boolean(raw.isEmulator),
|
|
9
|
+
isSimulator: Boolean(raw.isSimulator),
|
|
10
|
+
indicators: Array.isArray(raw.indicators)
|
|
11
|
+
? raw.indicators.filter((item): item is string => typeof item === 'string')
|
|
12
|
+
: [],
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const DeviceSecurity = {
|
|
17
|
+
/** @deprecated Use `isCompromised()` or `SecuritySuite.getSecurityReport()`. */
|
|
18
|
+
hasSecurityRisk(): Promise<boolean> {
|
|
19
|
+
return getNativeModule().deviceHasSecurityRisk();
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
isCompromised(): Promise<boolean> {
|
|
23
|
+
return getNativeModule().deviceHasSecurityRisk();
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
isRooted(): Promise<boolean> {
|
|
27
|
+
if (Platform.OS !== 'android') {
|
|
28
|
+
return Promise.resolve(false);
|
|
29
|
+
}
|
|
30
|
+
return getNativeModule().deviceHasSecurityRisk();
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
isJailbroken(): Promise<boolean> {
|
|
34
|
+
if (Platform.OS !== 'ios') {
|
|
35
|
+
return Promise.resolve(false);
|
|
36
|
+
}
|
|
37
|
+
return getNativeModule().deviceHasSecurityRisk();
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
getEnvironment(): Promise<DeviceEnvironment> {
|
|
41
|
+
return getNativeModule()
|
|
42
|
+
.deviceGetEnvironment()
|
|
43
|
+
.then((result) => parseEnvironment(result));
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type { DeviceEnvironment };
|
package/src/errors.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export enum SecurityErrorCode {
|
|
2
|
+
ROOT_DETECTED = 'ROOT_DETECTED',
|
|
3
|
+
JAILBREAK_DETECTED = 'JAILBREAK_DETECTED',
|
|
4
|
+
FRIDA_DETECTED = 'FRIDA_DETECTED',
|
|
5
|
+
DEBUGGER_DETECTED = 'DEBUGGER_DETECTED',
|
|
6
|
+
SSL_PINNING_FAILED = 'SSL_PINNING_FAILED',
|
|
7
|
+
SECURE_STORAGE_UNAVAILABLE = 'SECURE_STORAGE_UNAVAILABLE',
|
|
8
|
+
CRYPTO_KEY_NOT_FOUND = 'CRYPTO_KEY_NOT_FOUND',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const NATIVE_CODE_MAP: Record<string, SecurityErrorCode> = {
|
|
12
|
+
ROOT_DETECTED: SecurityErrorCode.ROOT_DETECTED,
|
|
13
|
+
JAILBREAK_DETECTED: SecurityErrorCode.JAILBREAK_DETECTED,
|
|
14
|
+
FRIDA_DETECTED: SecurityErrorCode.FRIDA_DETECTED,
|
|
15
|
+
DEBUGGER_DETECTED: SecurityErrorCode.DEBUGGER_DETECTED,
|
|
16
|
+
SSL_PINNING_FAILED: SecurityErrorCode.SSL_PINNING_FAILED,
|
|
17
|
+
SECURE_STORAGE_ERROR: SecurityErrorCode.SECURE_STORAGE_UNAVAILABLE,
|
|
18
|
+
SECURE_STORAGE_UNAVAILABLE: SecurityErrorCode.SECURE_STORAGE_UNAVAILABLE,
|
|
19
|
+
GET_SHARED_KEY_ERROR: SecurityErrorCode.CRYPTO_KEY_NOT_FOUND,
|
|
20
|
+
ENCRYPT_ERROR: SecurityErrorCode.CRYPTO_KEY_NOT_FOUND,
|
|
21
|
+
DECRYPT_ERROR: SecurityErrorCode.CRYPTO_KEY_NOT_FOUND,
|
|
22
|
+
CRYPTO_KEY_NOT_FOUND: SecurityErrorCode.CRYPTO_KEY_NOT_FOUND,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export class SecurityError extends Error {
|
|
26
|
+
readonly code: SecurityErrorCode;
|
|
27
|
+
readonly details?: Record<string, unknown>;
|
|
28
|
+
|
|
29
|
+
constructor(
|
|
30
|
+
code: SecurityErrorCode,
|
|
31
|
+
message: string,
|
|
32
|
+
details?: Record<string, unknown>
|
|
33
|
+
) {
|
|
34
|
+
super(message);
|
|
35
|
+
this.name = 'SecurityError';
|
|
36
|
+
this.code = code;
|
|
37
|
+
this.details = details;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function isSecurityError(error: unknown): error is SecurityError {
|
|
42
|
+
return error instanceof SecurityError;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function mapNativeError(error: unknown): SecurityError | Error {
|
|
46
|
+
if (error instanceof SecurityError) {
|
|
47
|
+
return error;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const nativeError = error as {
|
|
51
|
+
code?: string;
|
|
52
|
+
message?: string;
|
|
53
|
+
userInfo?: Record<string, unknown>;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const code =
|
|
57
|
+
typeof nativeError?.code === 'string'
|
|
58
|
+
? nativeError.code
|
|
59
|
+
: error instanceof Error && 'code' in error
|
|
60
|
+
? String((error as Error & { code?: string }).code)
|
|
61
|
+
: undefined;
|
|
62
|
+
|
|
63
|
+
const message =
|
|
64
|
+
typeof nativeError?.message === 'string'
|
|
65
|
+
? nativeError.message
|
|
66
|
+
: error instanceof Error
|
|
67
|
+
? error.message
|
|
68
|
+
: typeof error === 'string'
|
|
69
|
+
? error
|
|
70
|
+
: 'Unknown security error';
|
|
71
|
+
|
|
72
|
+
if (code && NATIVE_CODE_MAP[code]) {
|
|
73
|
+
return new SecurityError(NATIVE_CODE_MAP[code], message, {
|
|
74
|
+
nativeCode: code,
|
|
75
|
+
...(nativeError?.userInfo ?? {}),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (error instanceof Error) {
|
|
80
|
+
return error;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return new Error(message);
|
|
84
|
+
}
|