native-update-capacitor 0.0.0-stage → 4.4.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/AI-INTEGRATION-GUIDE.md +578 -0
- package/LICENSE +25 -0
- package/NativeUpdate.podspec +19 -0
- package/README.md +574 -2
- package/android/build.gradle +125 -0
- package/android/consumer-rules.pro +9 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/android/gradle.properties +17 -0
- package/android/manifest-additions.xml +28 -0
- package/android/proguard-rules.pro +26 -0
- package/android/settings.gradle +2 -0
- package/android/src/main/AndroidManifest.xml +13 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/AppReviewPlugin.kt +159 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/AppUpdatePlugin.kt +314 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundNotificationManager.kt +406 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundUpdateManager.kt +48 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundUpdatePlugin.kt +343 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundUpdateWorker.kt +236 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/JsonOptional.kt +26 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt +1249 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/NativeUpdatePlugin.kt +404 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/NotificationActionReceiver.kt +107 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/SecurityManager.kt +240 -0
- package/android/variables.gradle +5 -0
- package/cli/commands/backend-create.js +623 -0
- package/cli/commands/bundle-create.js +145 -0
- package/cli/commands/bundle-sign.js +64 -0
- package/cli/commands/bundle-verify.js +58 -0
- package/cli/commands/flutter-patch.js +107 -0
- package/cli/commands/init.js +146 -0
- package/cli/commands/keys-generate.js +58 -0
- package/cli/commands/monitor.js +89 -0
- package/cli/commands/remote-shared.js +264 -0
- package/cli/commands/remote.js +634 -0
- package/cli/commands/server-start.js +96 -0
- package/cli/index.js +625 -0
- package/cli/package.json +21 -0
- package/dist/esm/app-review/app-review-manager.d.ts +24 -0
- package/dist/esm/app-review/app-review-manager.js +194 -0
- package/dist/esm/app-review/index.d.ts +5 -0
- package/dist/esm/app-review/index.js +5 -0
- package/dist/esm/app-review/platform-review-handler.d.ts +20 -0
- package/dist/esm/app-review/platform-review-handler.js +137 -0
- package/dist/esm/app-review/review-conditions-checker.d.ts +22 -0
- package/dist/esm/app-review/review-conditions-checker.js +154 -0
- package/dist/esm/app-review/review-rate-limiter.d.ts +23 -0
- package/dist/esm/app-review/review-rate-limiter.js +163 -0
- package/dist/esm/app-review/types.d.ts +41 -0
- package/dist/esm/app-review/types.js +1 -0
- package/dist/esm/app-update/app-update-checker.d.ts +58 -0
- package/dist/esm/app-update/app-update-checker.js +227 -0
- package/dist/esm/app-update/app-update-installer.d.ts +20 -0
- package/dist/esm/app-update/app-update-installer.js +134 -0
- package/dist/esm/app-update/app-update-manager.d.ts +28 -0
- package/dist/esm/app-update/app-update-manager.js +198 -0
- package/dist/esm/app-update/app-update-notifier.d.ts +14 -0
- package/dist/esm/app-update/app-update-notifier.js +99 -0
- package/dist/esm/app-update/index.d.ts +6 -0
- package/dist/esm/app-update/index.js +6 -0
- package/dist/esm/app-update/platform-app-update.d.ts +19 -0
- package/dist/esm/app-update/platform-app-update.js +138 -0
- package/dist/esm/app-update/types.d.ts +58 -0
- package/dist/esm/app-update/types.js +11 -0
- package/dist/esm/background-update/background-scheduler.d.ts +63 -0
- package/dist/esm/background-update/background-scheduler.js +332 -0
- package/dist/esm/background-update/index.d.ts +3 -0
- package/dist/esm/background-update/index.js +2 -0
- package/dist/esm/background-update/notification-manager.d.ts +29 -0
- package/dist/esm/background-update/notification-manager.js +88 -0
- package/dist/esm/config/support.d.ts +9 -0
- package/dist/esm/config/support.js +9 -0
- package/dist/esm/core/analytics.d.ts +83 -0
- package/dist/esm/core/analytics.js +151 -0
- package/dist/esm/core/cache-manager.d.ts +72 -0
- package/dist/esm/core/cache-manager.js +274 -0
- package/dist/esm/core/config.d.ts +69 -0
- package/dist/esm/core/config.js +107 -0
- package/dist/esm/core/errors.d.ts +56 -0
- package/dist/esm/core/errors.js +85 -0
- package/dist/esm/core/event-emitter.d.ts +30 -0
- package/dist/esm/core/event-emitter.js +80 -0
- package/dist/esm/core/logger.d.ts +21 -0
- package/dist/esm/core/logger.js +108 -0
- package/dist/esm/core/performance.d.ts +53 -0
- package/dist/esm/core/performance.js +153 -0
- package/dist/esm/core/plugin-manager.d.ts +88 -0
- package/dist/esm/core/plugin-manager.js +224 -0
- package/dist/esm/core/security.d.ts +123 -0
- package/dist/esm/core/security.js +361 -0
- package/dist/esm/core/update-check.d.ts +121 -0
- package/dist/esm/core/update-check.js +127 -0
- package/dist/esm/definitions.d.ts +872 -0
- package/dist/esm/definitions.js +104 -0
- package/dist/esm/index.d.ts +14 -0
- package/dist/esm/index.js +18 -0
- package/dist/esm/live-update/bundle-manager.d.ts +102 -0
- package/dist/esm/live-update/bundle-manager.js +344 -0
- package/dist/esm/live-update/certificate-pinning.d.ts +38 -0
- package/dist/esm/live-update/certificate-pinning.js +77 -0
- package/dist/esm/live-update/delta-processor.d.ts +84 -0
- package/dist/esm/live-update/delta-processor.js +257 -0
- package/dist/esm/live-update/download-manager.d.ts +106 -0
- package/dist/esm/live-update/download-manager.js +412 -0
- package/dist/esm/live-update/rollout-checker.d.ts +86 -0
- package/dist/esm/live-update/rollout-checker.js +304 -0
- package/dist/esm/live-update/update-manager.d.ts +63 -0
- package/dist/esm/live-update/update-manager.js +321 -0
- package/dist/esm/live-update/version-manager.d.ts +93 -0
- package/dist/esm/live-update/version-manager.js +390 -0
- package/dist/esm/plugin.d.ts +3 -0
- package/dist/esm/plugin.js +848 -0
- package/dist/esm/security/crypto.d.ts +88 -0
- package/dist/esm/security/crypto.js +228 -0
- package/dist/esm/security/validator.d.ts +60 -0
- package/dist/esm/security/validator.js +142 -0
- package/dist/esm/types/app-identity.d.ts +36 -0
- package/dist/esm/types/app-identity.js +1 -0
- package/dist/esm/types/rollout.d.ts +91 -0
- package/dist/esm/types/rollout.js +25 -0
- package/dist/esm/web.d.ts +130 -0
- package/dist/esm/web.js +981 -0
- package/dist/plugin.cjs +1 -0
- package/dist/plugin.esm.js +1 -0
- package/dist/plugin.js +2 -0
- package/docs/CHANGELOG.md +1016 -0
- package/docs/KNOWN_LIMITATIONS.md +240 -0
- package/docs/MIGRATION.md +391 -0
- package/docs/protocol/CLIENT-PROTOCOL.md +199 -0
- package/docs/server-requirements.md +211 -0
- package/ios/Plugin/AppReview/AppReviewPlugin.swift +158 -0
- package/ios/Plugin/AppUpdate/AppUpdatePlugin.swift +249 -0
- package/ios/Plugin/BackgroundUpdate/BackgroundNotificationManager.swift +333 -0
- package/ios/Plugin/BackgroundUpdate/BackgroundUpdatePlugin.swift +464 -0
- package/ios/Plugin/Info.plist +43 -0
- package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +1286 -0
- package/ios/Plugin/LiveUpdate/WebViewConfiguration.swift +45 -0
- package/ios/Plugin/NativeUpdatePlugin.m +53 -0
- package/ios/Plugin/NativeUpdatePlugin.swift +315 -0
- package/ios/Plugin/Security/SecurityManager.swift +289 -0
- package/package.json +133 -4
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Security
|
|
3
|
+
import CryptoKit
|
|
4
|
+
|
|
5
|
+
class SecurityManager {
|
|
6
|
+
private var config: [String: Any]?
|
|
7
|
+
private let keychain = KeychainWrapper()
|
|
8
|
+
|
|
9
|
+
func configure(_ config: [String: Any]) throws {
|
|
10
|
+
self.config = config
|
|
11
|
+
let security = securityConfig
|
|
12
|
+
guard security["enforceHttps"] as? Bool != false else {
|
|
13
|
+
throw NSError(domain: "NativeUpdateSecurity", code: 1, userInfo: [
|
|
14
|
+
NSLocalizedDescriptionKey: "HTTPS enforcement cannot be disabled"
|
|
15
|
+
])
|
|
16
|
+
}
|
|
17
|
+
if let pinning = security["certificatePinning"] as? [String: Any],
|
|
18
|
+
pinning["enabled"] as? Bool == true {
|
|
19
|
+
guard let pins = pinning["pins"] as? [[String: Any]], !pins.isEmpty else {
|
|
20
|
+
throw NSError(domain: "NativeUpdateSecurity", code: 2, userInfo: [
|
|
21
|
+
NSLocalizedDescriptionKey: "Certificate pinning requires at least one host pin"
|
|
22
|
+
])
|
|
23
|
+
}
|
|
24
|
+
let pinPattern = try NSRegularExpression(pattern: "^sha256/[A-Za-z0-9+/]{43}=$")
|
|
25
|
+
for pin in pins {
|
|
26
|
+
guard let hostname = pin["hostname"] as? String, !hostname.isEmpty,
|
|
27
|
+
let hashes = pin["sha256"] as? [String], !hashes.isEmpty,
|
|
28
|
+
hashes.allSatisfy({ pinPattern.firstMatch(in: $0, range: NSRange($0.startIndex..., in: $0)) != nil }) else {
|
|
29
|
+
throw NSError(domain: "NativeUpdateSecurity", code: 3, userInfo: [
|
|
30
|
+
NSLocalizedDescriptionKey: "Certificate pins require a hostname and sha256/<base64> hashes"
|
|
31
|
+
])
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
func getSecurityInfo() -> [String: Any] {
|
|
38
|
+
return [
|
|
39
|
+
"enforceHttps": true,
|
|
40
|
+
"certificatePinning": [
|
|
41
|
+
"enabled": (securityConfig["certificatePinning"] as? [String: Any])?["enabled"] as? Bool ?? false,
|
|
42
|
+
"pins": getCertificatePins()
|
|
43
|
+
],
|
|
44
|
+
"validateInputs": securityConfig["validateInputs"] as? Bool ?? true,
|
|
45
|
+
// Hard-coded true since v2 — secure storage is no longer opt-out.
|
|
46
|
+
"secureStorage": true,
|
|
47
|
+
"signatureAlgorithm": "RSA-SHA256"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
func getCertificatePins() -> [String: [String]] {
|
|
52
|
+
guard let pinningConfig = securityConfig["certificatePinning"] as? [String: Any],
|
|
53
|
+
pinningConfig["enabled"] as? Bool == true,
|
|
54
|
+
let pins = pinningConfig["pins"] as? [[String: Any]] else {
|
|
55
|
+
return [:]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var hostPins: [String: [String]] = [:]
|
|
59
|
+
|
|
60
|
+
for pin in pins {
|
|
61
|
+
guard let hostname = pin["hostname"] as? String,
|
|
62
|
+
let sha256Pins = pin["sha256"] as? [String] else {
|
|
63
|
+
continue
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
hostPins[hostname] = sha256Pins
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return hostPins
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
func validateUrl(_ url: String) -> Bool {
|
|
73
|
+
guard let components = URLComponents(string: url),
|
|
74
|
+
components.scheme?.lowercased() == "https",
|
|
75
|
+
let host = components.host?.lowercased(), !host.isEmpty,
|
|
76
|
+
components.user == nil, components.password == nil else { return false }
|
|
77
|
+
let allowedHosts = getAllowedHosts() ?? []
|
|
78
|
+
return allowedHosts.isEmpty || allowedHosts.map { $0.lowercased() }.contains(host)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
func verifySignature(data: Data, signature: String, publicKeyString: String) -> Bool {
|
|
82
|
+
guard let secKey = decodePublicKey(publicKeyString),
|
|
83
|
+
let signatureData = Data(base64Encoded: signature) else { return false }
|
|
84
|
+
|
|
85
|
+
// Backend contract: RSA-SHA256 with PKCS#1 v1.5 padding.
|
|
86
|
+
let algorithm = SecKeyAlgorithm.rsaSignatureMessagePKCS1v15SHA256
|
|
87
|
+
guard SecKeyIsAlgorithmSupported(secKey, .verify, algorithm) else { return false }
|
|
88
|
+
return SecKeyVerifySignature(secKey, algorithm, data as CFData, signatureData as CFData, nil)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Verify a large bundle without materializing the entire ZIP in memory. */
|
|
92
|
+
func verifySignature(fileURL: URL, signature: String, publicKeyString: String) -> Bool {
|
|
93
|
+
guard let secKey = decodePublicKey(publicKeyString),
|
|
94
|
+
let signatureData = Data(base64Encoded: signature),
|
|
95
|
+
let stream = InputStream(url: fileURL) else { return false }
|
|
96
|
+
|
|
97
|
+
stream.open()
|
|
98
|
+
defer { stream.close() }
|
|
99
|
+
var hasher = SHA256()
|
|
100
|
+
let buffer = UnsafeMutablePointer<UInt8>.allocate(capacity: 64 * 1024)
|
|
101
|
+
defer { buffer.deallocate() }
|
|
102
|
+
while stream.hasBytesAvailable {
|
|
103
|
+
let count = stream.read(buffer, maxLength: 64 * 1024)
|
|
104
|
+
if count < 0 { return false }
|
|
105
|
+
if count == 0 { break }
|
|
106
|
+
hasher.update(data: Data(bytes: buffer, count: count))
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
let digest = Data(hasher.finalize())
|
|
110
|
+
let algorithm = SecKeyAlgorithm.rsaSignatureDigestPKCS1v15SHA256
|
|
111
|
+
guard SecKeyIsAlgorithmSupported(secKey, .verify, algorithm) else { return false }
|
|
112
|
+
return SecKeyVerifySignature(secKey, algorithm, digest as CFData, signatureData as CFData, nil)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private func decodePublicKey(_ publicKeyString: String) -> SecKey? {
|
|
116
|
+
let normalized = publicKeyString
|
|
117
|
+
.replacingOccurrences(of: "-----BEGIN PUBLIC KEY-----", with: "")
|
|
118
|
+
.replacingOccurrences(of: "-----END PUBLIC KEY-----", with: "")
|
|
119
|
+
.components(separatedBy: .whitespacesAndNewlines)
|
|
120
|
+
.joined()
|
|
121
|
+
guard let publicKeyData = Data(base64Encoded: normalized) else { return nil }
|
|
122
|
+
let attributes: [String: Any] = [
|
|
123
|
+
kSecAttrKeyType as String: kSecAttrKeyTypeRSA,
|
|
124
|
+
kSecAttrKeyClass as String: kSecAttrKeyClassPublic
|
|
125
|
+
]
|
|
126
|
+
return SecKeyCreateWithData(publicKeyData as CFData, attributes as CFDictionary, nil)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
func calculateChecksum(for data: Data, algorithm: String = "SHA-256") -> String {
|
|
130
|
+
let digest: Data
|
|
131
|
+
|
|
132
|
+
switch algorithm {
|
|
133
|
+
case "SHA-256":
|
|
134
|
+
digest = SHA256.hash(data: data).data
|
|
135
|
+
case "SHA-512":
|
|
136
|
+
digest = SHA512.hash(data: data).data
|
|
137
|
+
default:
|
|
138
|
+
// Fallback to SHA-256
|
|
139
|
+
digest = SHA256.hash(data: data).data
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return digest.map { String(format: "%02x", $0) }.joined()
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/// Writes always land in the Keychain since v2. The old
|
|
146
|
+
/// `secureStorage: false` opt-out was removed because the default
|
|
147
|
+
/// ran in plaintext UserDefaults unless a host app explicitly opted
|
|
148
|
+
/// in — which meant most integrations stored API keys in a trivially
|
|
149
|
+
/// readable location. See matching change in SecurityManager.kt.
|
|
150
|
+
func saveSecureData(key: String, value: String) {
|
|
151
|
+
keychain.set(value, forKey: key)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
func getSecureData(key: String) -> String? {
|
|
155
|
+
return keychain.string(forKey: key)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
func validatePath(_ path: String) -> Bool {
|
|
159
|
+
// Prevent directory traversal attacks
|
|
160
|
+
if path.contains("..") || path.contains("//") {
|
|
161
|
+
return false
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Ensure path is within app's sandbox
|
|
165
|
+
let url = URL(fileURLWithPath: path)
|
|
166
|
+
let standardizedPath = url.standardizedFileURL.path
|
|
167
|
+
|
|
168
|
+
// Check if path is within allowed directories
|
|
169
|
+
let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.path
|
|
170
|
+
let cachesPath = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first!.path
|
|
171
|
+
let tempPath = NSTemporaryDirectory()
|
|
172
|
+
|
|
173
|
+
return isWithin(standardizedPath, root: documentsPath) ||
|
|
174
|
+
isWithin(standardizedPath, root: cachesPath) ||
|
|
175
|
+
isWithin(standardizedPath, root: tempPath)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
func sanitizeInput(_ input: String) -> String {
|
|
179
|
+
// Remove potentially dangerous characters
|
|
180
|
+
let allowedCharacters = CharacterSet.alphanumerics.union(CharacterSet(charactersIn: "._-"))
|
|
181
|
+
return input.components(separatedBy: allowedCharacters.inverted).joined()
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
func isHttpsEnforced() -> Bool {
|
|
185
|
+
return true
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/// Unconditionally true since v2. Kept so `getSecurityInfo()` still
|
|
189
|
+
/// reports the capability to callers.
|
|
190
|
+
func isSecureStorageEnabled() -> Bool {
|
|
191
|
+
return true
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
func isInputValidationEnabled() -> Bool {
|
|
195
|
+
return securityConfig["validateInputs"] as? Bool ?? true
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
func logSecurityEvent(_ event: String, details: String? = nil) {
|
|
199
|
+
guard securityConfig["logSecurityEvents"] as? Bool == true else { return }
|
|
200
|
+
|
|
201
|
+
let message = "Security Event: \(event) \(details ?? "")"
|
|
202
|
+
print("🔒 \(message)")
|
|
203
|
+
|
|
204
|
+
// In production, you might want to send these to a security monitoring service
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
private func getAllowedHosts() -> [String]? {
|
|
208
|
+
var hosts: [String] = []
|
|
209
|
+
|
|
210
|
+
// Add hosts from live update config
|
|
211
|
+
if let allowedHosts = config?["allowedHosts"] as? [String] {
|
|
212
|
+
hosts.append(contentsOf: allowedHosts)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return hosts.isEmpty ? nil : Array(Set(hosts))
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
private var securityConfig: [String: Any] {
|
|
219
|
+
(config?["security"] as? [String: Any]) ?? config ?? [:]
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
private func isWithin(_ path: String, root: String) -> Bool {
|
|
223
|
+
let normalizedRoot = URL(fileURLWithPath: root).standardizedFileURL.path
|
|
224
|
+
return path == normalizedRoot || path.hasPrefix(normalizedRoot + "/")
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// MARK: - Keychain Wrapper
|
|
229
|
+
|
|
230
|
+
private class KeychainWrapper {
|
|
231
|
+
private let serviceName = "com.aoneahsan.nativeupdate"
|
|
232
|
+
|
|
233
|
+
func set(_ value: String, forKey key: String) {
|
|
234
|
+
guard let data = value.data(using: .utf8) else { return }
|
|
235
|
+
|
|
236
|
+
let query: [String: Any] = [
|
|
237
|
+
kSecClass as String: kSecClassGenericPassword,
|
|
238
|
+
kSecAttrService as String: serviceName,
|
|
239
|
+
kSecAttrAccount as String: key,
|
|
240
|
+
kSecValueData as String: data,
|
|
241
|
+
kSecAttrAccessible as String: kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
|
|
242
|
+
]
|
|
243
|
+
|
|
244
|
+
// Delete any existing item
|
|
245
|
+
SecItemDelete(query as CFDictionary)
|
|
246
|
+
|
|
247
|
+
// Add new item
|
|
248
|
+
SecItemAdd(query as CFDictionary, nil)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
func string(forKey key: String) -> String? {
|
|
252
|
+
let query: [String: Any] = [
|
|
253
|
+
kSecClass as String: kSecClassGenericPassword,
|
|
254
|
+
kSecAttrService as String: serviceName,
|
|
255
|
+
kSecAttrAccount as String: key,
|
|
256
|
+
kSecReturnData as String: true,
|
|
257
|
+
kSecMatchLimit as String: kSecMatchLimitOne
|
|
258
|
+
]
|
|
259
|
+
|
|
260
|
+
var dataTypeRef: AnyObject?
|
|
261
|
+
let status = SecItemCopyMatching(query as CFDictionary, &dataTypeRef)
|
|
262
|
+
|
|
263
|
+
guard status == errSecSuccess,
|
|
264
|
+
let data = dataTypeRef as? Data,
|
|
265
|
+
let string = String(data: data, encoding: .utf8) else {
|
|
266
|
+
return nil
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return string
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
func remove(forKey key: String) {
|
|
273
|
+
let query: [String: Any] = [
|
|
274
|
+
kSecClass as String: kSecClassGenericPassword,
|
|
275
|
+
kSecAttrService as String: serviceName,
|
|
276
|
+
kSecAttrAccount as String: key
|
|
277
|
+
]
|
|
278
|
+
|
|
279
|
+
SecItemDelete(query as CFDictionary)
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// MARK: - CryptoKit Extensions
|
|
284
|
+
|
|
285
|
+
extension Digest {
|
|
286
|
+
var data: Data {
|
|
287
|
+
Data(self)
|
|
288
|
+
}
|
|
289
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,135 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "native-update-capacitor",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "4.4.0",
|
|
4
|
+
"packageManager": "yarn@4.18.1",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=24.16.0"
|
|
7
|
+
},
|
|
8
|
+
"description": "The Native Update Capacitor plugin under its framework name. Identical to native-update 4.4.0: signed OTA updates, in-app update and in-app review.",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "dist/plugin.cjs",
|
|
11
|
+
"module": "dist/esm/index.js",
|
|
12
|
+
"types": "dist/esm/index.d.ts",
|
|
13
|
+
"unpkg": "dist/plugin.js",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/esm/index.d.ts",
|
|
17
|
+
"import": "./dist/plugin.esm.js",
|
|
18
|
+
"require": "./dist/plugin.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json",
|
|
21
|
+
"./dist/*": "./dist/*",
|
|
22
|
+
"./cli/*": "./cli/*"
|
|
23
|
+
},
|
|
24
|
+
"bin": "cli/index.js",
|
|
25
|
+
"files": [
|
|
26
|
+
"android/src/main/",
|
|
27
|
+
"android/build.gradle",
|
|
28
|
+
"android/variables.gradle",
|
|
29
|
+
"android/gradle.properties",
|
|
30
|
+
"android/gradle/",
|
|
31
|
+
"android/settings.gradle",
|
|
32
|
+
"android/proguard-rules.pro",
|
|
33
|
+
"android/consumer-rules.pro",
|
|
34
|
+
"android/manifest-additions.xml",
|
|
35
|
+
"dist/",
|
|
36
|
+
"ios/Plugin/",
|
|
37
|
+
"NativeUpdate.podspec",
|
|
38
|
+
"docs/CHANGELOG.md",
|
|
39
|
+
"docs/MIGRATION.md",
|
|
40
|
+
"docs/server-requirements.md",
|
|
41
|
+
"docs/protocol/CLIENT-PROTOCOL.md",
|
|
42
|
+
"docs/KNOWN_LIMITATIONS.md",
|
|
43
|
+
"cli/",
|
|
44
|
+
"AI-INTEGRATION-GUIDE.md",
|
|
45
|
+
"!**/node_modules/**",
|
|
46
|
+
"!**/.yarn/**",
|
|
47
|
+
"!**/yarn.lock",
|
|
48
|
+
"!**/CLAUDE.md",
|
|
49
|
+
"!**/AGENTS.md"
|
|
50
|
+
],
|
|
51
|
+
"author": {
|
|
52
|
+
"name": "Ahsan Mahmood",
|
|
53
|
+
"email": "aoneahsan@gmail.com",
|
|
54
|
+
"url": "https://aoneahsan.com"
|
|
55
|
+
},
|
|
56
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://nativeupdate.aoneahsan.com/contact"
|
|
59
|
+
},
|
|
60
|
+
"homepage": "https://nativeupdate.aoneahsan.com",
|
|
61
|
+
"funding": "https://aoneahsan.com/payment?project-id=native-update&project-identifier=native-update",
|
|
62
|
+
"keywords": [
|
|
63
|
+
"capacitor",
|
|
64
|
+
"plugin",
|
|
65
|
+
"native",
|
|
66
|
+
"app-updates",
|
|
67
|
+
"native-updates",
|
|
68
|
+
"ota",
|
|
69
|
+
"live-updates",
|
|
70
|
+
"hot-reload",
|
|
71
|
+
"app-store",
|
|
72
|
+
"google-play",
|
|
73
|
+
"in-app-updates",
|
|
74
|
+
"app-reviews",
|
|
75
|
+
"ios",
|
|
76
|
+
"android",
|
|
77
|
+
"hybrid"
|
|
78
|
+
],
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"archiver": "^8.0.0",
|
|
81
|
+
"chalk": "^6.0.1",
|
|
82
|
+
"commander": "^15.1.0",
|
|
83
|
+
"express": "^5.3.0",
|
|
84
|
+
"ora": "^10.0.0",
|
|
85
|
+
"prompts": "^2.4.2"
|
|
86
|
+
},
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"@capacitor/app": "^8.1.2",
|
|
89
|
+
"@capacitor/core": "^8.6.2",
|
|
90
|
+
"@capacitor/device": "^8.0.3",
|
|
91
|
+
"@capacitor/filesystem": "^8.1.5",
|
|
92
|
+
"@capacitor/preferences": "^8.0.1",
|
|
93
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
94
|
+
"@rollup/plugin-terser": "^1.0.2",
|
|
95
|
+
"@types/node": "^26.6.6",
|
|
96
|
+
"@typescript-eslint/eslint-plugin": "^8.72.2",
|
|
97
|
+
"@typescript-eslint/parser": "^8.72.2",
|
|
98
|
+
"eslint": "^10.15.0",
|
|
99
|
+
"prettier": "^3.10.1",
|
|
100
|
+
"rimraf": "^6.1.4",
|
|
101
|
+
"rollup": "^4.68.3",
|
|
102
|
+
"typescript": "~6.0.3",
|
|
103
|
+
"vite": "^8.3.8",
|
|
104
|
+
"vitest": "^5.1.0"
|
|
105
|
+
},
|
|
106
|
+
"peerDependencies": {
|
|
107
|
+
"@capacitor/app": ">=8.0.0",
|
|
108
|
+
"@capacitor/core": "^8.0.1",
|
|
109
|
+
"@capacitor/device": ">=8.0.0",
|
|
110
|
+
"@capacitor/filesystem": ">=8.0.0",
|
|
111
|
+
"@capacitor/preferences": ">=8.0.0"
|
|
112
|
+
},
|
|
113
|
+
"capacitor": {
|
|
114
|
+
"ios": {
|
|
115
|
+
"src": "ios"
|
|
116
|
+
},
|
|
117
|
+
"android": {
|
|
118
|
+
"src": "android"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"resolutions": {
|
|
122
|
+
"brace-expansion": "5.0.9",
|
|
123
|
+
"node-gyp": "13.0.1",
|
|
124
|
+
"tar": "7.5.22",
|
|
125
|
+
"undici": "8.10.0"
|
|
126
|
+
},
|
|
127
|
+
"peerDependenciesMeta": {
|
|
128
|
+
"@capacitor/app": {
|
|
129
|
+
"optional": true
|
|
130
|
+
},
|
|
131
|
+
"@capacitor/device": {
|
|
132
|
+
"optional": true
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|