react-native-quick-crypto 1.0.0-beta.16 → 1.0.0-beta.18
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/android/CMakeLists.txt +2 -0
- package/app.plugin.js +3 -0
- package/cpp/cipher/ChaCha20Cipher.cpp +97 -0
- package/cpp/cipher/ChaCha20Cipher.hpp +25 -0
- package/cpp/cipher/ChaCha20Poly1305Cipher.cpp +170 -0
- package/cpp/cipher/ChaCha20Poly1305Cipher.hpp +30 -0
- package/cpp/cipher/HybridCipherFactory.hpp +19 -1
- package/deps/fastpbkdf2/fastpbkdf2.c +5 -1
- package/lib/commonjs/cipher.js.map +1 -1
- package/lib/commonjs/expo-plugin/@types.js +2 -0
- package/lib/commonjs/expo-plugin/@types.js.map +1 -0
- package/lib/commonjs/expo-plugin/withRNQC.js +25 -0
- package/lib/commonjs/expo-plugin/withRNQC.js.map +1 -0
- package/lib/commonjs/expo-plugin/withSodiumAndroid.js +25 -0
- package/lib/commonjs/expo-plugin/withSodiumAndroid.js.map +1 -0
- package/lib/commonjs/expo-plugin/withSodiumIos.js +26 -0
- package/lib/commonjs/expo-plugin/withSodiumIos.js.map +1 -0
- package/lib/commonjs/expo-plugin/withXCode.js +51 -0
- package/lib/commonjs/expo-plugin/withXCode.js.map +1 -0
- package/lib/module/cipher.js.map +1 -1
- package/lib/module/expo-plugin/@types.js +2 -0
- package/lib/module/expo-plugin/@types.js.map +1 -0
- package/lib/module/expo-plugin/withRNQC.js +21 -0
- package/lib/module/expo-plugin/withRNQC.js.map +1 -0
- package/lib/module/expo-plugin/withSodiumAndroid.js +20 -0
- package/lib/module/expo-plugin/withSodiumAndroid.js.map +1 -0
- package/lib/module/expo-plugin/withSodiumIos.js +20 -0
- package/lib/module/expo-plugin/withSodiumIos.js.map +1 -0
- package/lib/module/expo-plugin/withXCode.js +46 -0
- package/lib/module/expo-plugin/withXCode.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/typescript/cipher.d.ts +3 -1
- package/lib/typescript/cipher.d.ts.map +1 -1
- package/lib/typescript/expo-plugin/@types.d.ts +8 -0
- package/lib/typescript/expo-plugin/@types.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/withRNQC.d.ts +4 -0
- package/lib/typescript/expo-plugin/withRNQC.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/withSodiumAndroid.d.ts +4 -0
- package/lib/typescript/expo-plugin/withSodiumAndroid.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/withSodiumIos.d.ts +4 -0
- package/lib/typescript/expo-plugin/withSodiumIos.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/withXCode.d.ts +9 -0
- package/lib/typescript/expo-plugin/withXCode.d.ts.map +1 -0
- package/package.json +18 -7
- package/src/cipher.ts +7 -0
- package/src/expo-plugin/@types.ts +7 -0
- package/src/expo-plugin/withRNQC.ts +23 -0
- package/src/expo-plugin/withSodiumAndroid.ts +24 -0
- package/src/expo-plugin/withSodiumIos.ts +30 -0
- package/src/expo-plugin/withXCode.ts +55 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withSodiumAndroid.d.ts","sourceRoot":"","sources":["../../../src/expo-plugin/withSodiumAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,WAAW,CAmBvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withSodiumIos.d.ts","sourceRoot":"","sources":["../../../src/expo-plugin/withSodiumIos.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,WAAW,CAuBnD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConfigPlugin } from 'expo/config-plugins';
|
|
2
|
+
import type { ConfigProps } from './@types';
|
|
3
|
+
/**
|
|
4
|
+
* Workaround for some jank XCode releases that break React Native native modules
|
|
5
|
+
*
|
|
6
|
+
* see: https://github.com/mrousavy/nitro/issues/422#issuecomment-2545988256
|
|
7
|
+
*/
|
|
8
|
+
export declare const withXCode: ConfigPlugin<ConfigProps>;
|
|
9
|
+
//# sourceMappingURL=withXCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withXCode.d.ts","sourceRoot":"","sources":["../../../src/expo-plugin/withXCode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAM5C;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,YAAY,CAAC,WAAW,CA0C/C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-quick-crypto",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.18",
|
|
4
4
|
"description": "A fast implementation of Node's `crypto` module written in C/C++ JSI",
|
|
5
|
-
"type": "module",
|
|
6
5
|
"main": "lib/commonjs/index",
|
|
7
6
|
"module": "lib/module/index",
|
|
8
7
|
"types": "lib/typescript/index.d.ts",
|
|
@@ -33,9 +32,9 @@
|
|
|
33
32
|
"deps",
|
|
34
33
|
"nitrogen",
|
|
35
34
|
"react-native.config.js",
|
|
36
|
-
"app.plugin.js",
|
|
37
35
|
"*.podspec",
|
|
38
36
|
"README.md",
|
|
37
|
+
"app.plugin.js",
|
|
39
38
|
"!**/__tests__",
|
|
40
39
|
"!**/__fixtures__",
|
|
41
40
|
"!**/__mocks__"
|
|
@@ -45,9 +44,13 @@
|
|
|
45
44
|
"ios",
|
|
46
45
|
"android",
|
|
47
46
|
"jsi",
|
|
47
|
+
"nitro",
|
|
48
48
|
"crypto",
|
|
49
|
+
"cryptography",
|
|
50
|
+
"cryptocurrency",
|
|
49
51
|
"c++",
|
|
50
52
|
"fast",
|
|
53
|
+
"quick",
|
|
51
54
|
"web3"
|
|
52
55
|
],
|
|
53
56
|
"repository": {
|
|
@@ -68,18 +71,20 @@
|
|
|
68
71
|
"registry": "https://registry.npmjs.org/"
|
|
69
72
|
},
|
|
70
73
|
"dependencies": {
|
|
71
|
-
"@craftzdog/react-native-buffer": "6.0
|
|
74
|
+
"@craftzdog/react-native-buffer": "6.1.0",
|
|
72
75
|
"events": "3.3.0",
|
|
73
|
-
"react-native-quick-base64": "2.
|
|
76
|
+
"react-native-quick-base64": "2.2.0",
|
|
74
77
|
"readable-stream": "4.5.2",
|
|
75
78
|
"util": "0.12.5"
|
|
76
79
|
},
|
|
77
80
|
"devDependencies": {
|
|
78
81
|
"@types/jest": "29.5.11",
|
|
79
|
-
"@types/node": "
|
|
82
|
+
"@types/node": "22.0.0",
|
|
80
83
|
"@types/react": "18.3.3",
|
|
81
84
|
"@types/readable-stream": "4.0.18",
|
|
82
85
|
"del-cli": "6.0.0",
|
|
86
|
+
"expo": "^47.0.0",
|
|
87
|
+
"expo-build-properties": "0.14.6",
|
|
83
88
|
"jest": "29.7.0",
|
|
84
89
|
"nitro-codegen": "0.25.2",
|
|
85
90
|
"react-native-builder-bob": "0.39.1",
|
|
@@ -88,7 +93,13 @@
|
|
|
88
93
|
"peerDependencies": {
|
|
89
94
|
"react": "*",
|
|
90
95
|
"react-native": "*",
|
|
91
|
-
"react-native-nitro-modules": "*"
|
|
96
|
+
"react-native-nitro-modules": "*",
|
|
97
|
+
"expo": ">=47.0.0"
|
|
98
|
+
},
|
|
99
|
+
"peerDependenciesMeta": {
|
|
100
|
+
"expo": {
|
|
101
|
+
"optional": true
|
|
102
|
+
}
|
|
92
103
|
},
|
|
93
104
|
"release-it": {
|
|
94
105
|
"npm": {
|
package/src/cipher.ts
CHANGED
|
@@ -96,6 +96,13 @@ class CipherCommon extends Stream.Transform {
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
update(data: Buffer): Buffer;
|
|
100
|
+
update(data: BinaryLike, inputEncoding?: Encoding): Buffer;
|
|
101
|
+
update(
|
|
102
|
+
data: BinaryLike,
|
|
103
|
+
inputEncoding: Encoding,
|
|
104
|
+
outputEncoding: Encoding,
|
|
105
|
+
): string;
|
|
99
106
|
update(
|
|
100
107
|
data: BinaryLike,
|
|
101
108
|
inputEncoding?: Encoding,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createRunOncePlugin } from 'expo/config-plugins';
|
|
2
|
+
import type { ConfigPlugin } from 'expo/config-plugins';
|
|
3
|
+
import type { ConfigProps } from './@types';
|
|
4
|
+
import { withSodiumIos } from './withSodiumIos';
|
|
5
|
+
import { withSodiumAndroid } from './withSodiumAndroid';
|
|
6
|
+
import { withXCode } from './withXCode';
|
|
7
|
+
|
|
8
|
+
const withRNQCInternal: ConfigPlugin<ConfigProps> = (config, props = {}) => {
|
|
9
|
+
// add XCode workarounds for some 16.x releases that are not RN-friendly
|
|
10
|
+
config = withXCode(config, props);
|
|
11
|
+
|
|
12
|
+
// enable libsodium algorithms
|
|
13
|
+
if (props.sodiumEnabled) {
|
|
14
|
+
config = withSodiumIos(config, props);
|
|
15
|
+
config = withSodiumAndroid(config, props);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return config;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export function createRNQCPlugin(name: string, version: string) {
|
|
22
|
+
return createRunOncePlugin(withRNQCInternal, name, version);
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ConfigPlugin } from 'expo/config-plugins';
|
|
2
|
+
import { withGradleProperties } from 'expo/config-plugins';
|
|
3
|
+
import type { ConfigProps } from './@types';
|
|
4
|
+
|
|
5
|
+
export const withSodiumAndroid: ConfigPlugin<ConfigProps> = config => {
|
|
6
|
+
return withGradleProperties(config, config => {
|
|
7
|
+
config.modResults = config.modResults || [];
|
|
8
|
+
|
|
9
|
+
// Check if the property already exists
|
|
10
|
+
const existingProperty = config.modResults.find(
|
|
11
|
+
item => item.type === 'property' && item.key === 'sodiumEnabled',
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
if (!existingProperty) {
|
|
15
|
+
config.modResults.push({
|
|
16
|
+
type: 'property',
|
|
17
|
+
key: 'sodiumEnabled',
|
|
18
|
+
value: 'true',
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return config;
|
|
23
|
+
});
|
|
24
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ConfigPlugin } from 'expo/config-plugins';
|
|
2
|
+
import { withDangerousMod } from 'expo/config-plugins';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import type { ConfigProps } from './@types';
|
|
6
|
+
|
|
7
|
+
export const withSodiumIos: ConfigPlugin<ConfigProps> = config => {
|
|
8
|
+
return withDangerousMod(config, [
|
|
9
|
+
'ios',
|
|
10
|
+
config => {
|
|
11
|
+
const podfilePath = path.join(
|
|
12
|
+
config.modRequest.platformProjectRoot,
|
|
13
|
+
'Podfile',
|
|
14
|
+
);
|
|
15
|
+
let contents = fs.readFileSync(podfilePath, 'utf-8');
|
|
16
|
+
|
|
17
|
+
// Check if SODIUM_ENABLED is already set
|
|
18
|
+
if (!contents.includes("ENV['SODIUM_ENABLED']")) {
|
|
19
|
+
// Add it right after the RCT_NEW_ARCH_ENABLED ENV variable
|
|
20
|
+
contents = contents.replace(
|
|
21
|
+
/^(ENV\['RCT_NEW_ARCH_ENABLED'\].*$)/m,
|
|
22
|
+
`$1\nENV['SODIUM_ENABLED'] = '1'`,
|
|
23
|
+
);
|
|
24
|
+
fs.writeFileSync(podfilePath, contents);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return config;
|
|
28
|
+
},
|
|
29
|
+
]);
|
|
30
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ConfigPlugin } from 'expo/config-plugins';
|
|
2
|
+
import type { ConfigProps } from './@types';
|
|
3
|
+
import { withBuildProperties } from 'expo-build-properties';
|
|
4
|
+
import { withDangerousMod } from 'expo/config-plugins';
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Workaround for some jank XCode releases that break React Native native modules
|
|
10
|
+
*
|
|
11
|
+
* see: https://github.com/mrousavy/nitro/issues/422#issuecomment-2545988256
|
|
12
|
+
*/
|
|
13
|
+
export const withXCode: ConfigPlugin<ConfigProps> = config => {
|
|
14
|
+
// Use expo-build-properties to bump iOS deployment target
|
|
15
|
+
config = withBuildProperties(config, { ios: { deploymentTarget: '16.0' } });
|
|
16
|
+
// Patch the generated Podfile fallback to ensure platform is always 16.0
|
|
17
|
+
config = withDangerousMod(config, [
|
|
18
|
+
'ios',
|
|
19
|
+
modConfig => {
|
|
20
|
+
const podfilePath = path.join(
|
|
21
|
+
modConfig.modRequest.platformProjectRoot,
|
|
22
|
+
'Podfile',
|
|
23
|
+
);
|
|
24
|
+
let contents = fs.readFileSync(podfilePath, 'utf-8');
|
|
25
|
+
|
|
26
|
+
// Check if the IPHONEOS_DEPLOYMENT_TARGET setting is already present
|
|
27
|
+
// We search for the key being assigned, e.g., config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] =
|
|
28
|
+
const deploymentTargetSettingExists =
|
|
29
|
+
/\.build_settings\s*\[\s*['"]IPHONEOS_DEPLOYMENT_TARGET['"]\s*\]\s*=/.test(
|
|
30
|
+
contents,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
if (!deploymentTargetSettingExists) {
|
|
34
|
+
// IPHONEOS_DEPLOYMENT_TARGET setting not found, proceed to add it.
|
|
35
|
+
contents = contents.replace(
|
|
36
|
+
/(post_install\s+do\s+\|installer\|[\s\S]*?)(\r?\n\s\send\s*)$/m,
|
|
37
|
+
`$1
|
|
38
|
+
|
|
39
|
+
# Expo Build Properties: force deployment target
|
|
40
|
+
# https://github.com/mrousavy/nitro/issues/422#issuecomment-2545988256
|
|
41
|
+
installer.pods_project.targets.each do |target|
|
|
42
|
+
target.build_configurations.each do |config|
|
|
43
|
+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0'
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
$2`,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
fs.writeFileSync(podfilePath, contents);
|
|
51
|
+
return modConfig;
|
|
52
|
+
},
|
|
53
|
+
]);
|
|
54
|
+
return config;
|
|
55
|
+
};
|