react-native-security-suite 0.9.22 → 1.0.0-rc.2
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 +291 -69
- package/android/build.gradle +11 -0
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/securitysuite/CryptoConfig.java +106 -0
- package/android/src/main/java/com/securitysuite/CryptoUtils.java +155 -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 +317 -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 +73 -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 +427 -134
- 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 +29 -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 +29 -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 +25 -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 +25 -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 +40 -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 +84 -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
package/lib/module/index.js
CHANGED
|
@@ -1,192 +1,191 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { NativeModules, Platform } from 'react-native';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
4
|
+
import { jsonParse } from "./helpers.js";
|
|
5
|
+
import { toNativeCryptoOptions } from "./legacy/cryptoOptions.js";
|
|
6
|
+
import { toNativeGenerateJWSOptions, toNativeJwsFetchOptions } from "./jws.js";
|
|
6
7
|
export * from "./SecureView.js";
|
|
8
|
+
export { SecurityError, SecurityErrorCode, mapNativeError, isSecurityError } from "./errors.js";
|
|
9
|
+
export { DeviceSecurity } from "./device/index.js";
|
|
10
|
+
export { RuntimeSecurity } from "./runtime/index.js";
|
|
11
|
+
export { AppIntegrity } from "./integrity/index.js";
|
|
12
|
+
export { Crypto } from "./crypto/index.js";
|
|
13
|
+
export { SecuritySuite } from "./securitySuite/index.js";
|
|
7
14
|
|
|
8
|
-
|
|
9
|
-
* SSL Pinnning start
|
|
10
|
-
*/
|
|
15
|
+
/** @deprecated Use `JwsHeaders` (optional `Record<string, JwsHeaderValue>`) instead. */
|
|
11
16
|
|
|
12
17
|
const LINKING_ERROR = `The package 'react-native-security-suite' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
13
18
|
ios: "- You have run 'pod install'\n",
|
|
14
19
|
default: ''
|
|
15
20
|
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
|
|
16
|
-
const
|
|
21
|
+
const NativeSecuritySuiteModule = NativeModules.SecuritySuite ? NativeModules.SecuritySuite : new Proxy({}, {
|
|
17
22
|
get() {
|
|
18
23
|
throw new Error(LINKING_ERROR);
|
|
19
24
|
}
|
|
20
25
|
});
|
|
21
|
-
export const getPublicKey = () =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
export const getPublicKey = () => NativeSecuritySuiteModule.getPublicKey();
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Prefer `Crypto.establishSharedKey()` which keeps the derived key in native memory.
|
|
30
|
+
*/
|
|
31
|
+
export const getSharedKey = (serverPublicKey, options) => NativeSecuritySuiteModule.getSharedKey(serverPublicKey, toNativeCryptoOptions(options));
|
|
32
|
+
export const encryptBySharedKey = (input, options) => {
|
|
33
|
+
if (!input || typeof input !== 'string') {
|
|
34
|
+
return Promise.reject(new Error('Input must be a non-empty string'));
|
|
35
|
+
}
|
|
36
|
+
return NativeSecuritySuiteModule.encrypt(input, toNativeCryptoOptions(options));
|
|
37
|
+
};
|
|
38
|
+
export const decryptBySharedKey = (input, options) => {
|
|
39
|
+
if (!input || typeof input !== 'string') {
|
|
40
|
+
return Promise.reject(new Error('Input must be a non-empty string'));
|
|
41
|
+
}
|
|
42
|
+
return NativeSecuritySuiteModule.decrypt(input, toNativeCryptoOptions(options));
|
|
43
|
+
};
|
|
44
|
+
export const generateJWS = options => {
|
|
45
|
+
const nativeOptions = toNativeGenerateJWSOptions(options);
|
|
46
|
+
return NativeSecuritySuiteModule.generateJWS(nativeOptions);
|
|
47
|
+
};
|
|
48
|
+
function normalizeFetchOptions(options) {
|
|
49
|
+
if (!options.jws) {
|
|
50
|
+
return options;
|
|
51
|
+
}
|
|
52
|
+
const nativeJws = toNativeJwsFetchOptions(options.jws);
|
|
53
|
+
return {
|
|
54
|
+
...options,
|
|
55
|
+
jws: {
|
|
56
|
+
algorithm: nativeJws.algorithm,
|
|
57
|
+
secret: nativeJws.secret,
|
|
58
|
+
headers: nativeJws.headers,
|
|
59
|
+
detached: nativeJws.detached,
|
|
60
|
+
...(options.jws.headerName ? {
|
|
61
|
+
headerName: options.jws.headerName
|
|
62
|
+
} : {}),
|
|
63
|
+
...(options.jws.payload !== undefined ? {
|
|
64
|
+
payload: nativeJws.payload
|
|
65
|
+
} : {})
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Local obfuscation only — NOT secure encryption. Requires an explicit secret.
|
|
72
|
+
* Never use for credentials, tokens, or PII at rest.
|
|
73
|
+
*/
|
|
74
|
+
export const obfuscate = (input, secret) => NativeSecuritySuiteModule.obfuscate(input, secret);
|
|
75
|
+
export const deobfuscate = (input, secret) => NativeSecuritySuiteModule.deobfuscate(input, secret);
|
|
25
76
|
export const getDeviceId = () => new Promise((resolve, reject) => {
|
|
26
|
-
|
|
27
|
-
if (error !== null) reject(error);else resolve(result);
|
|
77
|
+
NativeSecuritySuiteModule.getDeviceId((result, error) => {
|
|
78
|
+
if (error !== null) reject(error);else if (result !== null) resolve(result);else reject(new Error('GET_DEVICE_ID_ERROR'));
|
|
28
79
|
});
|
|
29
80
|
});
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @deprecated Use `obfuscate()` with an explicit secret, or `SecureStorage` for at-rest data.
|
|
84
|
+
*/
|
|
30
85
|
export const encrypt = (input, hardEncryption = true, secretKey = null) => new Promise((resolve, reject) => {
|
|
31
|
-
if (!input)
|
|
32
|
-
|
|
33
|
-
|
|
86
|
+
if (!input) {
|
|
87
|
+
resolve(input);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (!secretKey) {
|
|
91
|
+
reject(new Error('secretKey is required. Device identifiers are not accepted as encryption keys.'));
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
NativeSecuritySuiteModule.storageEncrypt(input, secretKey, hardEncryption, (result, error) => {
|
|
95
|
+
if (error !== null) reject(error);else if (result !== null) resolve(result);else reject(new Error('ENCRYPT_ERROR'));
|
|
34
96
|
});
|
|
35
97
|
});
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated Use `deobfuscate()` with an explicit secret, or `SecureStorage` for at-rest data.
|
|
101
|
+
*/
|
|
36
102
|
export const decrypt = (input, hardEncryption = true, secretKey = null) => new Promise((resolve, reject) => {
|
|
37
|
-
if (!input)
|
|
38
|
-
|
|
39
|
-
|
|
103
|
+
if (!input) {
|
|
104
|
+
resolve(input);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (!secretKey) {
|
|
108
|
+
reject(new Error('secretKey is required. Device identifiers are not accepted as encryption keys.'));
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
NativeSecuritySuiteModule.storageDecrypt(input, secretKey, hardEncryption, (result, error) => {
|
|
112
|
+
if (error !== null) reject(error);else if (result !== null) resolve(result);else reject(new Error('DECRYPT_ERROR'));
|
|
40
113
|
});
|
|
41
114
|
});
|
|
115
|
+
const SECURE_STORAGE_FAILED = 'Secure storage operation failed';
|
|
116
|
+
function wrapSecureStorage(operation, promise) {
|
|
117
|
+
return promise.catch(error => {
|
|
118
|
+
const detail = error instanceof Error ? error.message : typeof error === 'string' ? error : 'Unknown error';
|
|
119
|
+
throw new Error(`${SECURE_STORAGE_FAILED} (${operation}): ${detail}`);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Hardware-backed encrypted storage (Keychain on iOS, EncryptedSharedPreferences on Android). */
|
|
42
124
|
export const SecureStorage = {
|
|
43
|
-
setItem:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
125
|
+
setItem: (key, value) => wrapSecureStorage('setItem', NativeSecuritySuiteModule.secureStorageSetItem(key, value)),
|
|
126
|
+
getItem: key => wrapSecureStorage('getItem', NativeSecuritySuiteModule.secureStorageGetItem(key)),
|
|
127
|
+
removeItem: key => wrapSecureStorage('removeItem', NativeSecuritySuiteModule.secureStorageRemoveItem(key)),
|
|
128
|
+
getAllKeys: () => wrapSecureStorage('getAllKeys', NativeSecuritySuiteModule.secureStorageGetAllKeys()),
|
|
129
|
+
clear: () => wrapSecureStorage('clear', NativeSecuritySuiteModule.secureStorageClear()),
|
|
130
|
+
multiSet: async keyValuePairs => {
|
|
131
|
+
await Promise.all(keyValuePairs.map(([key, value]) => SecureStorage.setItem(key, value)));
|
|
51
132
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const encryptedData = await AsyncStorage.getItem(encryptedKey);
|
|
56
|
-
return decrypt(encryptedData ?? '');
|
|
57
|
-
} catch (e) {
|
|
58
|
-
console.error('getItem error: ', e);
|
|
59
|
-
return '';
|
|
60
|
-
}
|
|
133
|
+
multiGet: async keys => Promise.all(keys.map(async key => [key, await SecureStorage.getItem(key)])),
|
|
134
|
+
multiRemove: async keys => {
|
|
135
|
+
await Promise.all(keys.map(key => SecureStorage.removeItem(key)));
|
|
61
136
|
},
|
|
137
|
+
/** @deprecated Use multiSet instead. */
|
|
62
138
|
mergeItem: async (key, value) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (!isJsonString(data) || !isJsonString(value)) return;
|
|
68
|
-
const mergedData = await JSON.stringify(Object.assign(JSON.parse(data), JSON.parse(value)));
|
|
69
|
-
const encryptedValue = await encrypt(mergedData);
|
|
70
|
-
return AsyncStorage.setItem(encryptedKey, encryptedValue);
|
|
71
|
-
} catch (e) {
|
|
72
|
-
console.error('mergeItem error: ', e);
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
removeItem: async key => {
|
|
76
|
-
try {
|
|
77
|
-
const encryptedKey = await encrypt(key, false);
|
|
78
|
-
return AsyncStorage.removeItem(encryptedKey);
|
|
79
|
-
} catch (e) {
|
|
80
|
-
console.error('removeItem error: ', e);
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
getAllKeys: async () => {
|
|
84
|
-
try {
|
|
85
|
-
const encryptedKeys = await AsyncStorage.getAllKeys();
|
|
86
|
-
return await Promise.all(encryptedKeys.map(async item => {
|
|
87
|
-
const decryptedKey = await decrypt(item, false);
|
|
88
|
-
return decryptedKey ? decryptedKey : item;
|
|
89
|
-
}));
|
|
90
|
-
} catch (e) {
|
|
91
|
-
console.error('getAllKeys error: ', e);
|
|
92
|
-
return [];
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
multiSet: async keyValuePairs => {
|
|
96
|
-
try {
|
|
97
|
-
const encryptedKeyValuePairs = await Promise.all(keyValuePairs.map(async item => {
|
|
98
|
-
if (item.length === 2 && item[0] && item[1]) {
|
|
99
|
-
const encryptedKey = await encrypt(item[0], false);
|
|
100
|
-
const encryptedValue = await encrypt(item[1]);
|
|
101
|
-
return [encryptedKey, encryptedValue];
|
|
102
|
-
}
|
|
103
|
-
return null;
|
|
104
|
-
}));
|
|
105
|
-
AsyncStorage.multiSet(encryptedKeyValuePairs);
|
|
106
|
-
} catch (e) {
|
|
107
|
-
console.error('multiSet error: ', e);
|
|
139
|
+
const existing = await SecureStorage.getItem(key);
|
|
140
|
+
if (!existing) {
|
|
141
|
+
await SecureStorage.setItem(key, value);
|
|
142
|
+
return;
|
|
108
143
|
}
|
|
109
|
-
},
|
|
110
|
-
multiGet: async keys => {
|
|
111
144
|
try {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return await Promise.all(encryptedItems && encryptedItems.length ? encryptedItems.map(async item => {
|
|
116
|
-
const decryptedKey = await decrypt(item[0], false);
|
|
117
|
-
const decryptedalue = await decrypt(item[1]);
|
|
118
|
-
return [decryptedKey, decryptedalue];
|
|
119
|
-
}) : []);
|
|
120
|
-
} catch (e) {
|
|
121
|
-
console.error('multiGet error: ', e);
|
|
122
|
-
return [];
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
multiMerge: async keyValuePairs => {
|
|
126
|
-
try {
|
|
127
|
-
keyValuePairs.map(async item => {
|
|
128
|
-
if (item.length === 2 && item[0] && item[1]) {
|
|
129
|
-
const encryptedKey = await encrypt(item[0], false);
|
|
130
|
-
const encryptedData = await AsyncStorage.getItem(item[0]);
|
|
131
|
-
const data = await decrypt(encryptedData ?? '');
|
|
132
|
-
if (!isJsonString(data) || !isJsonString(item[1])) return null;
|
|
133
|
-
const mergedData = await JSON.stringify(Object.assign(JSON.parse(data), JSON.parse(item[1])));
|
|
134
|
-
const encryptedValue = await encrypt(mergedData, false);
|
|
135
|
-
return AsyncStorage.setItem(encryptedKey, encryptedValue);
|
|
136
|
-
}
|
|
137
|
-
return null;
|
|
145
|
+
const merged = JSON.stringify({
|
|
146
|
+
...JSON.parse(existing),
|
|
147
|
+
...JSON.parse(value)
|
|
138
148
|
});
|
|
139
|
-
|
|
140
|
-
|
|
149
|
+
await SecureStorage.setItem(key, merged);
|
|
150
|
+
} catch {
|
|
151
|
+
throw new Error('mergeItem requires valid JSON strings');
|
|
141
152
|
}
|
|
142
153
|
},
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const encryptedKeys = await Promise.all(keys.map(async item => await encrypt(item, false)));
|
|
147
|
-
return AsyncStorage.multiRemove(encryptedKeys);
|
|
148
|
-
} catch (e) {
|
|
149
|
-
console.error('multiRemove error: ', e);
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
clear: async () => {
|
|
153
|
-
try {
|
|
154
|
-
return AsyncStorage.clear();
|
|
155
|
-
} catch (e) {
|
|
156
|
-
console.error('clear error: ', e);
|
|
157
|
-
}
|
|
154
|
+
/** @deprecated Use multiSet instead. */
|
|
155
|
+
multiMerge: async keyValuePairs => {
|
|
156
|
+
await Promise.all(keyValuePairs.map(([key, value]) => SecureStorage.mergeItem(key, value)));
|
|
158
157
|
}
|
|
159
158
|
};
|
|
160
|
-
export function fetch(url, options, loggerIsEnabled =
|
|
159
|
+
export function fetch(url, options, loggerIsEnabled = __DEV__) {
|
|
161
160
|
return new Promise((resolve, reject) => {
|
|
162
|
-
|
|
163
|
-
...options,
|
|
161
|
+
NativeSecuritySuiteModule.fetch(url, {
|
|
162
|
+
...normalizeFetchOptions(options),
|
|
164
163
|
loggerIsEnabled
|
|
165
164
|
}, (result, error) => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
165
|
+
if (error === null) {
|
|
166
|
+
resolve({
|
|
167
|
+
...result,
|
|
168
|
+
json: () => jsonParse(result.response)
|
|
169
|
+
});
|
|
170
|
+
} else {
|
|
171
|
+
const errorJson = jsonParse(typeof error?.error === 'string' ? error.error : JSON.stringify(error));
|
|
172
|
+
reject({
|
|
173
|
+
json: () => errorJson,
|
|
174
|
+
error: error?.error ?? error,
|
|
175
|
+
status: error?.status ?? 0,
|
|
176
|
+
url: error?.url ?? url,
|
|
177
|
+
path: errorJson?.path ?? '',
|
|
178
|
+
message: errorJson?.message ?? String(error?.error ?? error),
|
|
179
|
+
code: errorJson?.code ?? '',
|
|
180
|
+
duration: error?.duration ?? '',
|
|
181
|
+
...errorJson
|
|
182
|
+
});
|
|
184
183
|
}
|
|
185
184
|
});
|
|
186
185
|
});
|
|
187
186
|
}
|
|
188
187
|
export function deviceHasSecurityRisk() {
|
|
189
|
-
return
|
|
188
|
+
return NativeSecuritySuiteModule.deviceHasSecurityRisk();
|
|
190
189
|
}
|
|
191
|
-
export default
|
|
190
|
+
export default NativeSecuritySuiteModule;
|
|
192
191
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","jsonParse","toNativeCryptoOptions","toNativeGenerateJWSOptions","toNativeJwsFetchOptions","SecurityError","SecurityErrorCode","mapNativeError","isSecurityError","DeviceSecurity","RuntimeSecurity","AppIntegrity","Crypto","SecuritySuite","LINKING_ERROR","select","ios","default","NativeSecuritySuiteModule","Proxy","get","Error","getPublicKey","getSharedKey","serverPublicKey","options","encryptBySharedKey","input","Promise","reject","encrypt","decryptBySharedKey","decrypt","generateJWS","nativeOptions","normalizeFetchOptions","jws","nativeJws","algorithm","secret","headers","detached","headerName","payload","undefined","obfuscate","deobfuscate","getDeviceId","resolve","result","error","hardEncryption","secretKey","storageEncrypt","storageDecrypt","SECURE_STORAGE_FAILED","wrapSecureStorage","operation","promise","catch","detail","message","SecureStorage","setItem","key","value","secureStorageSetItem","getItem","secureStorageGetItem","removeItem","secureStorageRemoveItem","getAllKeys","secureStorageGetAllKeys","clear","secureStorageClear","multiSet","keyValuePairs","all","map","multiGet","keys","multiRemove","mergeItem","existing","merged","JSON","stringify","parse","multiMerge","fetch","url","loggerIsEnabled","__DEV__","json","response","errorJson","status","path","String","code","duration","deviceHasSecurityRisk"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,SAASC,SAAS,QAAQ,cAAW;AACrC,SACEC,qBAAqB,QAEhB,2BAAwB;AAC/B,SACEC,0BAA0B,EAC1BC,uBAAuB,QAGlB,UAAO;AAEd,cAAc,iBAAc;AAmB5B,SAASC,aAAa,EAAEC,iBAAiB,EAAEC,cAAc,EAAEC,eAAe,QAAQ,aAAU;AAC5F,SAASC,cAAc,QAAQ,mBAAU;AACzC,SAASC,eAAe,QAAQ,oBAAW;AAC3C,SAASC,YAAY,QAAQ,sBAAa;AAC1C,SAASC,MAAM,QAAQ,mBAAU;AACjC,SAASC,aAAa,QAAQ,0BAAiB;;AAW/C;;AAyEA,MAAMC,aAAa,GACjB,sFAAsF,GACtFd,QAAQ,CAACe,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAE/C,MAAMC,yBAAyB,GAAGnB,aAAa,CAACc,aAAa,GACzDd,aAAa,CAACc,aAAa,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GL;QACL,CAAC,CAAC;MACJ;IACF,CACF,CAAC;EACH,CAAC,CAAC;AACJ;AAEA,OAAO,SAASM,qBAAqBA,CAAA,EAAqB;EACxD,OAAOnF,yBAAyB,CAACmF,qBAAqB,CAAC,CAAC;AAC1D;AAEA,eAAenF,yBAAyB","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { getNativeModule } from "../native/bridge.js";
|
|
4
|
+
function parseBuildType(value) {
|
|
5
|
+
if (value === 'debug' || value === 'release' || value === 'testflight') {
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
return 'release';
|
|
9
|
+
}
|
|
10
|
+
function parseIntegrityReport(raw) {
|
|
11
|
+
const report = {
|
|
12
|
+
validSignature: Boolean(raw.validSignature),
|
|
13
|
+
debuggable: Boolean(raw.debuggable),
|
|
14
|
+
tampered: Boolean(raw.tampered),
|
|
15
|
+
buildType: parseBuildType(raw.buildType)
|
|
16
|
+
};
|
|
17
|
+
if (raw.installerTrusted !== undefined) {
|
|
18
|
+
report.installerTrusted = Boolean(raw.installerTrusted);
|
|
19
|
+
}
|
|
20
|
+
if (typeof raw.signingCertificateSha256 === 'string') {
|
|
21
|
+
report.signingCertificateSha256 = raw.signingCertificateSha256;
|
|
22
|
+
}
|
|
23
|
+
if (raw.installerPackage === null || typeof raw.installerPackage === 'string') {
|
|
24
|
+
report.installerPackage = raw.installerPackage;
|
|
25
|
+
}
|
|
26
|
+
if (typeof raw.bundleIdentifier === 'string') {
|
|
27
|
+
report.bundleIdentifier = raw.bundleIdentifier;
|
|
28
|
+
}
|
|
29
|
+
return report;
|
|
30
|
+
}
|
|
31
|
+
export const AppIntegrity = {
|
|
32
|
+
verify() {
|
|
33
|
+
return getNativeModule().appIntegrityVerify().then(result => parseIntegrityReport(result));
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getNativeModule","parseBuildType","value","parseIntegrityReport","raw","report","validSignature","Boolean","debuggable","tampered","buildType","installerTrusted","undefined","signingCertificateSha256","installerPackage","bundleIdentifier","AppIntegrity","verify","appIntegrityVerify","then","result"],"sourceRoot":"../../../src","sources":["integrity/index.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,qBAAkB;AAGlD,SAASC,cAAcA,CAACC,KAAc,EAAa;EACjD,IAAIA,KAAK,KAAK,OAAO,IAAIA,KAAK,KAAK,SAAS,IAAIA,KAAK,KAAK,YAAY,EAAE;IACtE,OAAOA,KAAK;EACd;EACA,OAAO,SAAS;AAClB;AAEA,SAASC,oBAAoBA,CAACC,GAA4B,EAAsB;EAC9E,MAAMC,MAA0B,GAAG;IACjCC,cAAc,EAAEC,OAAO,CAACH,GAAG,CAACE,cAAc,CAAC;IAC3CE,UAAU,EAAED,OAAO,CAACH,GAAG,CAACI,UAAU,CAAC;IACnCC,QAAQ,EAAEF,OAAO,CAACH,GAAG,CAACK,QAAQ,CAAC;IAC/BC,SAAS,EAAET,cAAc,CAACG,GAAG,CAACM,SAAS;EACzC,CAAC;EAED,IAAIN,GAAG,CAACO,gBAAgB,KAAKC,SAAS,EAAE;IACtCP,MAAM,CAACM,gBAAgB,GAAGJ,OAAO,CAACH,GAAG,CAACO,gBAAgB,CAAC;EACzD;EAEA,IAAI,OAAOP,GAAG,CAACS,wBAAwB,KAAK,QAAQ,EAAE;IACpDR,MAAM,CAACQ,wBAAwB,GAAGT,GAAG,CAACS,wBAAwB;EAChE;EAEA,IAAIT,GAAG,CAACU,gBAAgB,KAAK,IAAI,IAAI,OAAOV,GAAG,CAACU,gBAAgB,KAAK,QAAQ,EAAE;IAC7ET,MAAM,CAACS,gBAAgB,GAAGV,GAAG,CAACU,gBAAiC;EACjE;EAEA,IAAI,OAAOV,GAAG,CAACW,gBAAgB,KAAK,QAAQ,EAAE;IAC5CV,MAAM,CAACU,gBAAgB,GAAGX,GAAG,CAACW,gBAAgB;EAChD;EAEA,OAAOV,MAAM;AACf;AAEA,OAAO,MAAMW,YAAY,GAAG;EAC1BC,MAAMA,CAAA,EAAgC;IACpC,OAAOjB,eAAe,CAAC,CAAC,CACrBkB,kBAAkB,CAAC,CAAC,CACpBC,IAAI,CAAEC,MAAM,IAAKjB,oBAAoB,CAACiB,MAAM,CAAC,CAAC;EACnD;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const SUPPORTED_ALGORITHMS = ['HS256', 'HS384', 'HS512'];
|
|
4
|
+
const SAFE_HEADER_KEY = /^[a-zA-Z][a-zA-Z0-9_-]*$/;
|
|
5
|
+
export function isEmptyJwsPayload(payload) {
|
|
6
|
+
return payload === undefined || payload === null || typeof payload === 'string' && payload.length === 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Normalizes a JWS payload to the exact UTF-8 string used for signing.
|
|
11
|
+
* Empty payload cases return an empty string (never "null" or "undefined").
|
|
12
|
+
*/
|
|
13
|
+
export function normalizeJwsPayload(payload) {
|
|
14
|
+
if (isEmptyJwsPayload(payload)) {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
if (typeof payload === 'string') {
|
|
18
|
+
return payload;
|
|
19
|
+
}
|
|
20
|
+
if (typeof payload === 'number' || typeof payload === 'boolean') {
|
|
21
|
+
return JSON.stringify(payload);
|
|
22
|
+
}
|
|
23
|
+
return JSON.stringify(payload);
|
|
24
|
+
}
|
|
25
|
+
export function validateJwsAlgorithm(algorithm) {
|
|
26
|
+
if (!algorithm) {
|
|
27
|
+
return 'HS256';
|
|
28
|
+
}
|
|
29
|
+
if (!SUPPORTED_ALGORITHMS.includes(algorithm)) {
|
|
30
|
+
throw new Error(`Unsupported JWS algorithm: ${algorithm}`);
|
|
31
|
+
}
|
|
32
|
+
return algorithm;
|
|
33
|
+
}
|
|
34
|
+
export function validateJwsSecret(secret) {
|
|
35
|
+
if (typeof secret !== 'string' || secret.trim().length === 0) {
|
|
36
|
+
throw new Error('JWS secret is required and must be a non-empty string');
|
|
37
|
+
}
|
|
38
|
+
return secret;
|
|
39
|
+
}
|
|
40
|
+
export function validateJwsHeaderKey(key) {
|
|
41
|
+
if (!SAFE_HEADER_KEY.test(key)) {
|
|
42
|
+
throw new Error(`Invalid JWS header key: ${key}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export function validateJwsHeaderValue(key, value) {
|
|
46
|
+
if (value === null || typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
47
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
48
|
+
for (let i = 0; i < value.length; i++) {
|
|
49
|
+
const code = value.charCodeAt(i);
|
|
50
|
+
if (code < 0x20 || code > 0x7e) {
|
|
51
|
+
throw new Error(`Invalid JWS header value for key: ${key}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
throw new Error(`JWS header values must be JSON-serializable primitives: ${key}`);
|
|
58
|
+
}
|
|
59
|
+
export function validateJwsHeaders(headers) {
|
|
60
|
+
if (headers === undefined || headers === null) {
|
|
61
|
+
return {};
|
|
62
|
+
}
|
|
63
|
+
if (typeof headers !== 'object' || Array.isArray(headers)) {
|
|
64
|
+
throw new Error('JWS headers must be an object when provided');
|
|
65
|
+
}
|
|
66
|
+
const result = {};
|
|
67
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
68
|
+
validateJwsHeaderKey(key);
|
|
69
|
+
result[key] = validateJwsHeaderValue(key, value);
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Resolves the JWS algorithm from options and/or protected headers.
|
|
76
|
+
*/
|
|
77
|
+
export function resolveJwsAlgorithm(algorithm, headers) {
|
|
78
|
+
const headerAlg = headers.alg !== undefined && headers.alg !== null ? String(headers.alg) : undefined;
|
|
79
|
+
if (algorithm && headerAlg && algorithm !== headerAlg) {
|
|
80
|
+
throw new Error('JWS algorithm mismatch: options.algorithm and headers.alg must match');
|
|
81
|
+
}
|
|
82
|
+
if (algorithm) {
|
|
83
|
+
return validateJwsAlgorithm(algorithm);
|
|
84
|
+
}
|
|
85
|
+
if (headerAlg) {
|
|
86
|
+
return validateJwsAlgorithm(headerAlg);
|
|
87
|
+
}
|
|
88
|
+
return 'HS256';
|
|
89
|
+
}
|
|
90
|
+
export function toNativeGenerateJWSOptions(options, detached = false) {
|
|
91
|
+
const secret = validateJwsSecret(options.secret);
|
|
92
|
+
const headers = validateJwsHeaders(options.headers);
|
|
93
|
+
const algorithm = resolveJwsAlgorithm(options.algorithm, headers);
|
|
94
|
+
const payload = normalizeJwsPayload(options.payload);
|
|
95
|
+
return {
|
|
96
|
+
payload,
|
|
97
|
+
algorithm,
|
|
98
|
+
secret,
|
|
99
|
+
headers: {
|
|
100
|
+
...headers,
|
|
101
|
+
alg: algorithm
|
|
102
|
+
},
|
|
103
|
+
detached
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export function toNativeJwsFetchOptions(jws) {
|
|
107
|
+
const secret = validateJwsSecret(jws.secret);
|
|
108
|
+
const headers = validateJwsHeaders(jws.headers);
|
|
109
|
+
const algorithm = resolveJwsAlgorithm(jws.algorithm, headers);
|
|
110
|
+
return {
|
|
111
|
+
payload: normalizeJwsPayload(jws.payload),
|
|
112
|
+
algorithm,
|
|
113
|
+
secret,
|
|
114
|
+
headers: {
|
|
115
|
+
...headers,
|
|
116
|
+
alg: algorithm
|
|
117
|
+
},
|
|
118
|
+
detached: jws.detached ?? false
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export function assertCompactJwsShape(jws) {
|
|
122
|
+
const segments = jws.split('.');
|
|
123
|
+
if (segments.length !== 3) {
|
|
124
|
+
throw new Error(`Invalid compact JWS: expected 3 segments, got ${segments.length}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=jws.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SUPPORTED_ALGORITHMS","SAFE_HEADER_KEY","isEmptyJwsPayload","payload","undefined","length","normalizeJwsPayload","JSON","stringify","validateJwsAlgorithm","algorithm","includes","Error","validateJwsSecret","secret","trim","validateJwsHeaderKey","key","test","validateJwsHeaderValue","value","i","code","charCodeAt","validateJwsHeaders","headers","Array","isArray","result","Object","entries","resolveJwsAlgorithm","headerAlg","alg","String","toNativeGenerateJWSOptions","options","detached","toNativeJwsFetchOptions","jws","assertCompactJwsShape","segments","split"],"sourceRoot":"../../src","sources":["jws.ts"],"mappings":";;AAeA,MAAMA,oBAA6C,GAAG,CACpD,OAAO,EACP,OAAO,EACP,OAAO,CACR;AAED,MAAMC,eAAe,GAAG,0BAA0B;AAkBlD,OAAO,SAASC,iBAAiBA,CAACC,OAA+B,EAAW;EAC1E,OACEA,OAAO,KAAKC,SAAS,IACrBD,OAAO,KAAK,IAAI,IACf,OAAOA,OAAO,KAAK,QAAQ,IAAIA,OAAO,CAACE,MAAM,KAAK,CAAE;AAEzD;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAACH,OAA+B,EAAU;EAC3E,IAAID,iBAAiB,CAACC,OAAO,CAAC,EAAE;IAC9B,OAAO,EAAE;EACX;EAEA,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;IAC/B,OAAOA,OAAO;EAChB;EAEA,IAAI,OAAOA,OAAO,KAAK,QAAQ,IAAI,OAAOA,OAAO,KAAK,SAAS,EAAE;IAC/D,OAAOI,IAAI,CAACC,SAAS,CAACL,OAAO,CAAC;EAChC;EAEA,OAAOI,IAAI,CAACC,SAAS,CAACL,OAAO,CAAC;AAChC;AAEA,OAAO,SAASM,oBAAoBA,CAClCC,SAA6B,EACf;EACd,IAAI,CAACA,SAAS,EAAE;IACd,OAAO,OAAO;EAChB;EACA,IAAI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,GAAGD,kBAAkB,CAACY,OAAO,CAACX,OAAO,CAAC;EACnD,MAAMf,SAAS,GAAGqB,mBAAmB,CAACK,OAAO,CAAC1B,SAAS,EAAEe,OAAO,CAAC;EACjE,MAAMtB,OAAO,GAAGG,mBAAmB,CAAC8B,OAAO,CAACjC,OAAO,CAAC;EAEpD,OAAO;IACLA,OAAO;IACPO,SAAS;IACTI,MAAM;IACNW,OAAO,EAAE;MAAE,GAAGA,OAAO;MAAEQ,GAAG,EAAEvB;IAAU,CAAC;IACvC2B;EACF,CAAC;AACH;AAEA,OAAO,SAASC,uBAAuBA,CACrCC,GAAoB,EACM;EAC1B,MAAMzB,MAAM,GAAGD,iBAAiB,CAAC0B,GAAG,CAACzB,MAAM,CAAC;EAC5C,MAAMW,OAAO,GAAGD,kBAAkB,CAACe,GAAG,CAACd,OAAO,CAAC;EAC/C,MAAMf,SAAS,GAAGqB,mBAAmB,CAACQ,GAAG,CAAC7B,SAAS,EAAEe,OAAO,CAAC;EAE7D,OAAO;IACLtB,OAAO,EAAEG,mBAAmB,CAACiC,GAAG,CAACpC,OAAO,CAAC;IACzCO,SAAS;IACTI,MAAM;IACNW,OAAO,EAAE;MAAE,GAAGA,OAAO;MAAEQ,GAAG,EAAEvB;IAAU,CAAC;IACvC2B,QAAQ,EAAEE,GAAG,CAACF,QAAQ,IAAI;EAC5B,CAAC;AACH;AAEA,OAAO,SAASG,qBAAqBA,CAACD,GAAW,EAAQ;EACvD,MAAME,QAAQ,GAAGF,GAAG,CAACG,KAAK,CAAC,GAAG,CAAC;EAC/B,IAAID,QAAQ,CAACpC,MAAM,KAAK,CAAC,EAAE;IACzB,MAAM,IAAIO,KAAK,CACb,iDAAiD6B,QAAQ,CAACpC,MAAM,EAClE,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/** Shared crypto option types used by legacy exports and the Crypto namespace. */
|
|
4
|
+
|
|
5
|
+
function requireCryptoOption(value, key) {
|
|
6
|
+
if (value === undefined || value === null || value === '') {
|
|
7
|
+
throw new Error(`Missing required crypto option: ${key}`);
|
|
8
|
+
}
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
export function toNativeCryptoOptions(options) {
|
|
12
|
+
if (!options) {
|
|
13
|
+
throw new Error('Crypto options are required');
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
keyAgreementAlgorithm: requireCryptoOption(options.keyAgreementAlgorithm, 'keyAgreementAlgorithm'),
|
|
17
|
+
keyFactoryAlgorithm: requireCryptoOption(options.keyType ?? options.keyFactoryAlgorithm, 'keyFactoryAlgorithm'),
|
|
18
|
+
encryptionKeyAlgorithm: requireCryptoOption(options.encryptionKeyAlgorithm, 'encryptionKeyAlgorithm'),
|
|
19
|
+
hmacKeyAlgorithm: requireCryptoOption(options.hmacAlgorithm ?? options.hmacKeyAlgorithm, 'hmacKeyAlgorithm'),
|
|
20
|
+
cipherTransformation: requireCryptoOption(options.cipher ?? options.cipherTransformation, 'cipherTransformation'),
|
|
21
|
+
gcmTagLength: requireCryptoOption(options.tagLength ?? options.gcmTagLength, 'gcmTagLength'),
|
|
22
|
+
gcmIvLength: requireCryptoOption(options.ivLength ?? options.gcmIvLength, 'gcmIvLength')
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=cryptoOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["requireCryptoOption","value","key","undefined","Error","toNativeCryptoOptions","options","keyAgreementAlgorithm","keyFactoryAlgorithm","keyType","encryptionKeyAlgorithm","hmacKeyAlgorithm","hmacAlgorithm","cipherTransformation","cipher","gcmTagLength","tagLength","gcmIvLength","ivLength"],"sourceRoot":"../../../src","sources":["legacy/cryptoOptions.ts"],"mappings":";;AAAA;;AAsCA,SAASA,mBAAmBA,CAC1BC,KAA2B,EAC3BC,GAAW,EACR;EACH,IAAID,KAAK,KAAKE,SAAS,IAAIF,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAK,EAAE,EAAE;IACzD,MAAM,IAAIG,KAAK,CAAC,mCAAmCF,GAAG,EAAE,CAAC;EAC3D;EACA,OAAOD,KAAK;AACd;AAEA,OAAO,SAASI,qBAAqBA,CAACC,OAA8B,EAAE;EACpE,IAAI,CAACA,OAAO,EAAE;IACZ,MAAM,IAAIF,KAAK,CAAC,6BAA6B,CAAC;EAChD;EAEA,OAAO;IACLG,qBAAqB,EAAEP,mBAAmB,CACxCM,OAAO,CAACC,qBAAqB,EAC7B,uBACF,CAAC;IACDC,mBAAmB,EAAER,mBAAmB,CACtCM,OAAO,CAACG,OAAO,IAAIH,OAAO,CAACE,mBAAmB,EAC9C,qBACF,CAAC;IACDE,sBAAsB,EAAEV,mBAAmB,CACzCM,OAAO,CAACI,sBAAsB,EAC9B,wBACF,CAAC;IACDC,gBAAgB,EAAEX,mBAAmB,CACnCM,OAAO,CAACM,aAAa,IAAIN,OAAO,CAACK,gBAAgB,EACjD,kBACF,CAAC;IACDE,oBAAoB,EAAEb,mBAAmB,CACvCM,OAAO,CAACQ,MAAM,IAAIR,OAAO,CAACO,oBAAoB,EAC9C,sBACF,CAAC;IACDE,YAAY,EAAEf,mBAAmB,CAC/BM,OAAO,CAACU,SAAS,IAAIV,OAAO,CAACS,YAAY,EACzC,cACF,CAAC;IACDE,WAAW,EAAEjB,mBAAmB,CAC9BM,OAAO,CAACY,QAAQ,IAAIZ,OAAO,CAACW,WAAW,EACvC,aACF;EACF,CAAC;AACH","ignoreList":[]}
|