@onekeyfe/react-native-bundle-update 6.7.0-alpha.310 → 6.7.0-alpha.312

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.
@@ -395,9 +395,9 @@ object BundleUpdateStoreAndroid {
395
395
  }
396
396
 
397
397
  val metadata = parseMetadataJson(readFileContent(metadataFile))
398
- if (!validateEntryBundlesSha256(bundleDirPath.absolutePath, metadata)) {
399
- OneKeyLog.error("BundleUpdate", "processPreLaunchPendingTask: entry bundle SHA256 verification failed for $folderName")
400
- failPendingTask(mmkv, taskObj, "ERR_VERIFY_FAILED:Entry bundle SHA256 verification failed")
398
+ if (!validateAllFilesInDir(context, bundleDirPath.absolutePath, metadata, appVersion, bundleVersion)) {
399
+ OneKeyLog.error("BundleUpdate", "processPreLaunchPendingTask: extracted file verification failed for $folderName")
400
+ failPendingTask(mmkv, taskObj, "ERR_VERIFY_FAILED:Extracted file verification failed")
401
401
  return
402
402
  }
403
403
  if (!validateBundlePairCompatibility(context, bundleDirPath.absolutePath, metadata)) {
@@ -2075,8 +2075,8 @@ class ReactNativeBundleUpdate : HybridReactNativeBundleUpdateSpec() {
2075
2075
  }
2076
2076
 
2077
2077
  val metadata = BundleUpdateStoreAndroid.parseMetadataJson(BundleUpdateStoreAndroid.readFileContent(metadataFile))
2078
- if (!BundleUpdateStoreAndroid.validateEntryBundlesSha256(bundleDirPath.absolutePath, metadata)) {
2079
- OneKeyLog.error("BundleUpdate", "installBundle: entry bundle SHA256 verification failed for $folderName")
2078
+ if (!BundleUpdateStoreAndroid.validateAllFilesInDir(context, bundleDirPath.absolutePath, metadata, appVersion, bundleVersion)) {
2079
+ OneKeyLog.error("BundleUpdate", "installBundle: extracted file verification failed for $folderName")
2080
2080
  throw BundleUpdateError("INTEGRITY_FAILED", "install")
2081
2081
  }
2082
2082
  if (!BundleUpdateStoreAndroid.validateBundlePairCompatibility(context, bundleDirPath.absolutePath, metadata)) {
@@ -2466,8 +2466,8 @@ class ReactNativeBundleUpdate : HybridReactNativeBundleUpdateSpec() {
2466
2466
  throw BundleUpdateError("PACKAGE_MISSING", "install")
2467
2467
  }
2468
2468
  val metadata = BundleUpdateStoreAndroid.parseMetadataJson(BundleUpdateStoreAndroid.readFileContent(metadataFile))
2469
- if (!BundleUpdateStoreAndroid.validateEntryBundlesSha256(bundleDirPath.absolutePath, metadata)) {
2470
- OneKeyLog.error("BundleUpdate", "setCurrentUpdateBundleData: entry bundle SHA256 verification failed")
2469
+ if (!BundleUpdateStoreAndroid.validateAllFilesInDir(context, bundleDirPath.absolutePath, metadata, params.appVersion, params.bundleVersion)) {
2470
+ OneKeyLog.error("BundleUpdate", "setCurrentUpdateBundleData: extracted file verification failed")
2471
2471
  throw BundleUpdateError("INTEGRITY_FAILED", "install")
2472
2472
  }
2473
2473
  if (!BundleUpdateStoreAndroid.validateBundlePairCompatibility(context, bundleDirPath.absolutePath, metadata)) {
@@ -444,9 +444,9 @@ public class BundleUpdateStore: NSObject {
444
444
  failPendingTask(mmkv: mmkv, taskDict: taskDict, reason: "ERR_VERIFY_FAILED:Failed to read metadata.json")
445
445
  return
446
446
  }
447
- if !validateEntryBundlesSha256(bundleDirPath: bundleDirPath, metadata: metadata) {
448
- OneKeyLog.error("BundleUpdate", "processPreLaunchPendingTask: entry bundle SHA256 verification failed for \(folderName)")
449
- failPendingTask(mmkv: mmkv, taskDict: taskDict, reason: "ERR_VERIFY_FAILED:Entry bundle SHA256 verification failed")
447
+ if !validateAllFilesInDir(bundleDirPath, metadata: metadata, appVersion: appVersion, bundleVersion: bundleVersion) {
448
+ OneKeyLog.error("BundleUpdate", "processPreLaunchPendingTask: extracted file verification failed for \(folderName)")
449
+ failPendingTask(mmkv: mmkv, taskDict: taskDict, reason: "ERR_VERIFY_FAILED:Extracted file verification failed")
450
450
  return
451
451
  }
452
452
  if !validateBundlePairCompatibility(bundleDirPath: bundleDirPath, metadata: metadata) {
@@ -2192,8 +2192,8 @@ class ReactNativeBundleUpdate: HybridReactNativeBundleUpdateSpec {
2192
2192
  OneKeyLog.error("BundleUpdate", "installBundle: failed to read metadata.json content for \(folderName)")
2193
2193
  throw BundleUpdateError(.missing, .install)
2194
2194
  }
2195
- if !BundleUpdateStore.validateEntryBundlesSha256(bundleDirPath: bundleDirPath, metadata: metadata) {
2196
- OneKeyLog.error("BundleUpdate", "installBundle: entry bundle SHA256 verification failed for \(folderName)")
2195
+ if !BundleUpdateStore.validateAllFilesInDir(bundleDirPath, metadata: metadata, appVersion: appVersion, bundleVersion: bundleVersion) {
2196
+ OneKeyLog.error("BundleUpdate", "installBundle: extracted file verification failed for \(folderName)")
2197
2197
  throw BundleUpdateError(.integrity, .install)
2198
2198
  }
2199
2199
  if !BundleUpdateStore.validateBundlePairCompatibility(bundleDirPath: bundleDirPath, metadata: metadata) {
@@ -2538,8 +2538,8 @@ class ReactNativeBundleUpdate: HybridReactNativeBundleUpdateSpec {
2538
2538
  OneKeyLog.error("BundleUpdate", "setCurrentUpdateBundleData: failed to read metadata.json content")
2539
2539
  throw BundleUpdateError(.missing, .install)
2540
2540
  }
2541
- if !BundleUpdateStore.validateEntryBundlesSha256(bundleDirPath: bundleDirPath, metadata: metadata) {
2542
- OneKeyLog.error("BundleUpdate", "setCurrentUpdateBundleData: entry bundle SHA256 verification failed")
2541
+ if !BundleUpdateStore.validateAllFilesInDir(bundleDirPath, metadata: metadata, appVersion: params.appVersion, bundleVersion: params.bundleVersion) {
2542
+ OneKeyLog.error("BundleUpdate", "setCurrentUpdateBundleData: extracted file verification failed")
2543
2543
  throw BundleUpdateError(.integrity, .install)
2544
2544
  }
2545
2545
  if !BundleUpdateStore.validateBundlePairCompatibility(bundleDirPath: bundleDirPath, metadata: metadata) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-bundle-update",
3
- "version": "6.7.0-alpha.310",
3
+ "version": "6.7.0-alpha.312",
4
4
  "description": "Native JavaScript bundle download, verification and version management for OneKey",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",