@breeztech/breez-sdk-spark-react-native 0.6.4-dev2 → 0.6.4-dev5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breeztech/breez-sdk-spark-react-native",
3
- "version": "0.6.4-dev2",
3
+ "version": "0.6.4-dev5",
4
4
  "description": "React Native bindings for the Breez SDK - Nodeless (Spark Implementation)",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
@@ -195,5 +195,9 @@
195
195
  "type": "turbo-module",
196
196
  "languages": "cpp",
197
197
  "version": "0.49.0"
198
+ },
199
+ "checksums": {
200
+ "android": "2c89ea9184b14313c3c3abf495fc16609e39db1f7311ef291d0180921af4a11c",
201
+ "ios": "52174887ad7cbe1cb76b7d5bbc3ebf0db9f77b75208e2f61df7bde802e764a07"
198
202
  }
199
203
  }
@@ -71,23 +71,52 @@ async function downloadBinaryArtifacts() {
71
71
  const packageJsonPath = path.join(packageRoot, 'package.json');
72
72
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
73
73
  const version = packageJson.version;
74
+ const androidChecksum = packageJson.checksums?.android;
75
+ const iosChecksum = packageJson.checksums?.ios;
76
+ if (!androidChecksum || !iosChecksum) {
77
+ throw new Error('Binary checksums not found in package.json');
78
+ }
74
79
  const repo = 'https://github.com/breez/breez-sdk-spark-react-native';
75
80
  const androidUrl = `${repo}/releases/download/${version}/android-artifacts.zip`;
76
81
  const iosUrl = `${repo}/releases/download/${version}/ios-artifacts.zip`;
77
- // Download Android artifacts
82
+ // Download and verify Android artifacts
78
83
  try {
79
- (0, child_process_1.execSync)(`curl -L "${androidUrl}" --output android-artifacts.zip && unzip -o android-artifacts.zip && rm -rf android-artifacts.zip`, { cwd: packageRoot, stdio: 'inherit' });
84
+ (0, child_process_1.execSync)(`curl -L "${androidUrl}" --output android-artifacts.zip`, {
85
+ cwd: packageRoot,
86
+ stdio: 'inherit',
87
+ });
88
+ const actualAndroidChecksum = (0, child_process_1.execSync)('shasum -a 256 android-artifacts.zip | cut -d" " -f1', { cwd: packageRoot, encoding: 'utf-8' }).trim();
89
+ if (actualAndroidChecksum !== androidChecksum) {
90
+ throw new Error(`Android artifacts checksum mismatch. Expected: ${androidChecksum}, Got: ${actualAndroidChecksum}`);
91
+ }
92
+ (0, child_process_1.execSync)('unzip -o android-artifacts.zip && rm -rf android-artifacts.zip', {
93
+ cwd: packageRoot,
94
+ stdio: 'inherit',
95
+ });
80
96
  }
81
97
  catch (error) {
82
- console.error('Failed to download Android artifacts');
98
+ (0, child_process_1.execSync)('rm -f android-artifacts.zip', { cwd: packageRoot });
99
+ console.error('Failed to download or verify Android artifacts');
83
100
  throw error;
84
101
  }
85
- // Download iOS artifacts
102
+ // Download and verify iOS artifacts
86
103
  try {
87
- (0, child_process_1.execSync)(`curl -L "${iosUrl}" --output ios-artifacts.zip && unzip -o ios-artifacts.zip && rm -rf ios-artifacts.zip`, { cwd: packageRoot, stdio: 'inherit' });
104
+ (0, child_process_1.execSync)(`curl -L "${iosUrl}" --output ios-artifacts.zip`, {
105
+ cwd: packageRoot,
106
+ stdio: 'inherit',
107
+ });
108
+ const actualIosChecksum = (0, child_process_1.execSync)('shasum -a 256 ios-artifacts.zip | cut -d" " -f1', { cwd: packageRoot, encoding: 'utf-8' }).trim();
109
+ if (actualIosChecksum !== iosChecksum) {
110
+ throw new Error(`iOS artifacts checksum mismatch. Expected: ${iosChecksum}, Got: ${actualIosChecksum}`);
111
+ }
112
+ (0, child_process_1.execSync)('unzip -o ios-artifacts.zip && rm -rf ios-artifacts.zip', {
113
+ cwd: packageRoot,
114
+ stdio: 'inherit',
115
+ });
88
116
  }
89
117
  catch (error) {
90
- console.error('Failed to download iOS artifacts');
118
+ (0, child_process_1.execSync)('rm -f ios-artifacts.zip', { cwd: packageRoot });
119
+ console.error('Failed to download or verify iOS artifacts');
91
120
  throw error;
92
121
  }
93
122
  }
@@ -1,14 +0,0 @@
1
- #!/bin/sh
2
- # Download prebuilt binary artifacts from the release
3
- REPO=https://github.com/breez/breez-sdk-spark-react-native
4
- TAG=$(node -p "require('./package.json').version")
5
-
6
- ANDROID_URL=$REPO/releases/download/$TAG/android-artifacts.zip
7
- curl -L $ANDROID_URL --output android-artifacts.zip
8
- unzip -o android-artifacts.zip
9
- rm -rf android-artifacts.zip
10
-
11
- IOS_URL=$REPO/releases/download/$TAG/ios-artifacts.zip
12
- curl -L $IOS_URL --output ios-artifacts.zip
13
- unzip -o ios-artifacts.zip
14
- rm -rf ios-artifacts.zip