@hot-updater/react-native 0.22.2 → 0.23.0
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/src/main/java/com/hotupdater/BundleFileStorageService.kt +17 -12
- package/android/src/main/java/com/hotupdater/HotUpdater.kt +1 -1
- package/android/src/main/java/com/hotupdater/HotUpdaterFactory.kt +1 -0
- package/android/src/main/java/com/hotupdater/HotUpdaterImpl.kt +1 -1
- package/android/src/main/java/com/hotupdater/SignatureVerifier.kt +346 -0
- package/ios/HotUpdater/Internal/BundleFileStorageService.swift +26 -18
- package/ios/HotUpdater/Internal/SignatureVerifier.swift +339 -0
- package/lib/commonjs/checkForUpdate.js +1 -1
- package/lib/commonjs/checkForUpdate.js.map +1 -1
- package/lib/commonjs/index.js +16 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeHotUpdater.js.map +1 -1
- package/lib/commonjs/types.js +45 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/checkForUpdate.js +1 -1
- package/lib/module/checkForUpdate.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeHotUpdater.js.map +1 -1
- package/lib/module/types.js +40 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts +7 -2
- package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts.map +1 -1
- package/lib/typescript/commonjs/types.d.ts +34 -0
- package/lib/typescript/commonjs/types.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +1 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/specs/NativeHotUpdater.d.ts +7 -2
- package/lib/typescript/module/specs/NativeHotUpdater.d.ts.map +1 -1
- package/lib/typescript/module/types.d.ts +34 -0
- package/lib/typescript/module/types.d.ts.map +1 -0
- package/package.json +6 -6
- package/src/checkForUpdate.ts +1 -1
- package/src/index.ts +5 -0
- package/src/specs/NativeHotUpdater.ts +7 -2
- package/src/types.ts +63 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAgBpE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,MAAM,GACf,4BAA4B,CAS9B"}
|
|
@@ -3,6 +3,7 @@ import { updateBundle } from "./native";
|
|
|
3
3
|
import { wrap } from "./wrap";
|
|
4
4
|
export type { HotUpdaterEvent } from "./native";
|
|
5
5
|
export * from "./store";
|
|
6
|
+
export { extractSignatureFailure, isSignatureVerificationError, type SignatureVerificationFailure, } from "./types";
|
|
6
7
|
export type { HotUpdaterOptions } from "./wrap";
|
|
7
8
|
export declare const HotUpdater: {
|
|
8
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAQL,YAAY,EACb,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,cAAc,SAAS,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAQhD,eAAO,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;;IAEH;;;;;;;;;;OAUG;;CAEJ,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -3,8 +3,13 @@ export interface UpdateBundleParams {
|
|
|
3
3
|
bundleId: string;
|
|
4
4
|
fileUrl: string | null;
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* File hash for integrity/signature verification.
|
|
7
|
+
*
|
|
8
|
+
* Format depends on signing configuration:
|
|
9
|
+
* - Signed: `sig:<base64_signature>` - Native will verify signature (and implicitly hash)
|
|
10
|
+
* - Unsigned: `<hex_hash>` - Native will verify SHA256 hash only
|
|
11
|
+
*
|
|
12
|
+
* Native determines verification mode by checking for "sig:" prefix.
|
|
8
13
|
*/
|
|
9
14
|
fileHash: string | null;
|
|
10
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeHotUpdater.d.ts","sourceRoot":"","sources":["../../../../src/specs/NativeHotUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB
|
|
1
|
+
{"version":3,"file":"NativeHotUpdater.d.ts","sourceRoot":"","sources":["../../../../src/specs/NativeHotUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;;;;;;OAQG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,IAAK,SAAQ,WAAW;IAEvC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAG3D,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM;QAC3B,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,OAAO,EAAE,MAAM,CAAC;QAChB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;KACjC,CAAC;CACH;;AAED,wBAAoE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Information about a signature verification failure.
|
|
3
|
+
* This is a security-critical event that indicates the bundle
|
|
4
|
+
* may have been tampered with or the public key is misconfigured.
|
|
5
|
+
*/
|
|
6
|
+
export interface SignatureVerificationFailure {
|
|
7
|
+
/**
|
|
8
|
+
* The bundle ID that failed verification.
|
|
9
|
+
*/
|
|
10
|
+
bundleId: string;
|
|
11
|
+
/**
|
|
12
|
+
* Human-readable error message from the native layer.
|
|
13
|
+
*/
|
|
14
|
+
message: string;
|
|
15
|
+
/**
|
|
16
|
+
* The underlying error object.
|
|
17
|
+
*/
|
|
18
|
+
error: Error;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Checks if an error is a signature verification failure.
|
|
22
|
+
* Matches error messages from both iOS and Android native implementations.
|
|
23
|
+
*
|
|
24
|
+
* **IMPORTANT**: This function relies on specific error message patterns from native code.
|
|
25
|
+
* If you change the error messages in the native implementations, update these patterns:
|
|
26
|
+
* - iOS: `ios/HotUpdater/Internal/SignatureVerifier.swift` (SignatureVerificationError)
|
|
27
|
+
* - Android: `android/src/main/java/com/hotupdater/SignatureVerifier.kt` (SignatureVerificationException)
|
|
28
|
+
*/
|
|
29
|
+
export declare function isSignatureVerificationError(error: unknown): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Extracts signature verification failure details from an error.
|
|
32
|
+
*/
|
|
33
|
+
export declare function extractSignatureFailure(error: unknown, bundleId: string): SignatureVerificationFailure;
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAgBpE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,MAAM,GACf,4BAA4B,CAS9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "React Native OTA solution for self-hosted",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -119,14 +119,14 @@
|
|
|
119
119
|
"react-native": "0.79.1",
|
|
120
120
|
"react-native-builder-bob": "^0.40.10",
|
|
121
121
|
"typescript": "^5.8.3",
|
|
122
|
-
"hot-updater": "0.
|
|
122
|
+
"hot-updater": "0.23.0"
|
|
123
123
|
},
|
|
124
124
|
"dependencies": {
|
|
125
125
|
"use-sync-external-store": "1.5.0",
|
|
126
|
-
"@hot-updater/
|
|
127
|
-
"@hot-updater/
|
|
128
|
-
"@hot-updater/
|
|
129
|
-
"@hot-updater/
|
|
126
|
+
"@hot-updater/cli-tools": "0.23.0",
|
|
127
|
+
"@hot-updater/plugin-core": "0.23.0",
|
|
128
|
+
"@hot-updater/js": "0.23.0",
|
|
129
|
+
"@hot-updater/core": "0.23.0"
|
|
130
130
|
},
|
|
131
131
|
"scripts": {
|
|
132
132
|
"build": "bob build && tsc -p plugin/tsconfig.build.json",
|
package/src/checkForUpdate.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -15,6 +15,11 @@ import { wrap } from "./wrap";
|
|
|
15
15
|
|
|
16
16
|
export type { HotUpdaterEvent } from "./native";
|
|
17
17
|
export * from "./store";
|
|
18
|
+
export {
|
|
19
|
+
extractSignatureFailure,
|
|
20
|
+
isSignatureVerificationError,
|
|
21
|
+
type SignatureVerificationFailure,
|
|
22
|
+
} from "./types";
|
|
18
23
|
export type { HotUpdaterOptions } from "./wrap";
|
|
19
24
|
|
|
20
25
|
addListener("onProgress", ({ progress }) => {
|
|
@@ -5,8 +5,13 @@ export interface UpdateBundleParams {
|
|
|
5
5
|
bundleId: string;
|
|
6
6
|
fileUrl: string | null;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* File hash for integrity/signature verification.
|
|
9
|
+
*
|
|
10
|
+
* Format depends on signing configuration:
|
|
11
|
+
* - Signed: `sig:<base64_signature>` - Native will verify signature (and implicitly hash)
|
|
12
|
+
* - Unsigned: `<hex_hash>` - Native will verify SHA256 hash only
|
|
13
|
+
*
|
|
14
|
+
* Native determines verification mode by checking for "sig:" prefix.
|
|
10
15
|
*/
|
|
11
16
|
fileHash: string | null;
|
|
12
17
|
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Information about a signature verification failure.
|
|
3
|
+
* This is a security-critical event that indicates the bundle
|
|
4
|
+
* may have been tampered with or the public key is misconfigured.
|
|
5
|
+
*/
|
|
6
|
+
export interface SignatureVerificationFailure {
|
|
7
|
+
/**
|
|
8
|
+
* The bundle ID that failed verification.
|
|
9
|
+
*/
|
|
10
|
+
bundleId: string;
|
|
11
|
+
/**
|
|
12
|
+
* Human-readable error message from the native layer.
|
|
13
|
+
*/
|
|
14
|
+
message: string;
|
|
15
|
+
/**
|
|
16
|
+
* The underlying error object.
|
|
17
|
+
*/
|
|
18
|
+
error: Error;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Checks if an error is a signature verification failure.
|
|
23
|
+
* Matches error messages from both iOS and Android native implementations.
|
|
24
|
+
*
|
|
25
|
+
* **IMPORTANT**: This function relies on specific error message patterns from native code.
|
|
26
|
+
* If you change the error messages in the native implementations, update these patterns:
|
|
27
|
+
* - iOS: `ios/HotUpdater/Internal/SignatureVerifier.swift` (SignatureVerificationError)
|
|
28
|
+
* - Android: `android/src/main/java/com/hotupdater/SignatureVerifier.kt` (SignatureVerificationException)
|
|
29
|
+
*/
|
|
30
|
+
export function isSignatureVerificationError(error: unknown): boolean {
|
|
31
|
+
if (!(error instanceof Error)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const message = error.message.toLowerCase();
|
|
36
|
+
|
|
37
|
+
// Match iOS SignatureVerificationError messages
|
|
38
|
+
// Match Android SignatureVerificationException messages
|
|
39
|
+
return (
|
|
40
|
+
message.includes("signature verification") ||
|
|
41
|
+
message.includes("public key not configured") ||
|
|
42
|
+
message.includes("public key format is invalid") ||
|
|
43
|
+
message.includes("signature format is invalid") ||
|
|
44
|
+
message.includes("bundle may be corrupted or tampered")
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Extracts signature verification failure details from an error.
|
|
50
|
+
*/
|
|
51
|
+
export function extractSignatureFailure(
|
|
52
|
+
error: unknown,
|
|
53
|
+
bundleId: string,
|
|
54
|
+
): SignatureVerificationFailure {
|
|
55
|
+
const normalizedError =
|
|
56
|
+
error instanceof Error ? error : new Error(String(error));
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
bundleId,
|
|
60
|
+
message: normalizedError.message,
|
|
61
|
+
error: normalizedError,
|
|
62
|
+
};
|
|
63
|
+
}
|