@hot-updater/react-native
Version:
React Native OTA solution for self-hosted
57 lines (50 loc) • 1.98 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.extractSignatureFailure = extractSignatureFailure;
exports.isSignatureVerificationError = isSignatureVerificationError;
/**
* Parameters passed to resolver.checkUpdate method
*/
/**
* Parameters passed to resolver.notifyAppReady method
*/
/**
* Resolver interface for custom network operations
*/
/**
* Information about a signature verification failure.
* This is a security-critical event that indicates the bundle
* may have been tampered with or the public key is misconfigured.
*/
/**
* Checks if an error is a signature verification failure.
* Matches error messages from both iOS and Android native implementations.
*
* **IMPORTANT**: This function relies on specific error message patterns from native code.
* If you change the error messages in the native implementations, update these patterns:
* - iOS: `ios/HotUpdater/Internal/SignatureVerifier.swift` (SignatureVerificationError)
* - Android: `android/src/main/java/com/hotupdater/SignatureVerifier.kt` (SignatureVerificationException)
*/
function isSignatureVerificationError(error) {
if (!(error instanceof Error)) {
return false;
}
const message = error.message.toLowerCase();
// Match iOS SignatureVerificationError messages
// Match Android SignatureVerificationException messages
return message.includes("signature verification") || message.includes("public key not configured") || message.includes("public key format is invalid") || message.includes("signature format is invalid") || message.includes("bundle may be corrupted or tampered");
}
/**
* Extracts signature verification failure details from an error.
*/
function extractSignatureFailure(error, bundleId) {
const normalizedError = error instanceof Error ? error : new Error(String(error));
return {
bundleId,
message: normalizedError.message,
error: normalizedError
};
}
//# sourceMappingURL=types.js.map