capacitor-auth-manager 2.4.4 → 3.0.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.
Files changed (80) hide show
  1. package/AI-INTEGRATION-GUIDE.md +174 -0
  2. package/CHANGELOG.md +119 -0
  3. package/CapacitorAuthManager.podspec +3 -3
  4. package/README.md +91 -72
  5. package/android/build.gradle +17 -25
  6. package/android/consumer-rules.pro +2 -0
  7. package/android/proguard-rules.pro +5 -30
  8. package/android/src/main/AndroidManifest.xml +4 -9
  9. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/AuthErrorCodes.java +32 -0
  10. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/AuthException.java +34 -0
  11. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/AuthStorage.java +46 -25
  12. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/CapacitorAuthManager.java +54 -38
  13. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/CapacitorAuthManagerPlugin.java +77 -54
  14. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/GoogleAuthProvider.java +171 -41
  15. package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/ProviderFactory.java +5 -0
  16. package/dist/angular.cjs.js +421 -3376
  17. package/dist/core.cjs.js +589 -149
  18. package/dist/esm/angular/auth.guard.d.ts +1 -1
  19. package/dist/esm/angular/auth.module.d.ts +1 -1
  20. package/dist/esm/angular/auth.module.js +1 -1
  21. package/dist/esm/angular/auth.service.d.ts +2 -2
  22. package/dist/esm/angular/auth.service.js +1 -1
  23. package/dist/esm/angular/index.d.ts +4 -4
  24. package/dist/esm/angular/index.js +4 -4
  25. package/dist/esm/capacitor-plugin.d.ts +2 -3
  26. package/dist/esm/capacitor-plugin.js +14 -4
  27. package/dist/esm/core/auth-manager.d.ts +20 -2
  28. package/dist/esm/core/auth-manager.js +68 -12
  29. package/dist/esm/core/index.d.ts +5 -4
  30. package/dist/esm/core/index.js +5 -4
  31. package/dist/esm/core/provider-manifests.d.ts +1 -1
  32. package/dist/esm/core/provider-manifests.js +12 -13
  33. package/dist/esm/core/provider-registry.d.ts +8 -5
  34. package/dist/esm/core/provider-registry.js +41 -10
  35. package/dist/esm/core/types.d.ts +2 -2
  36. package/dist/esm/definitions.d.ts +26 -0
  37. package/dist/esm/index.d.ts +12 -12
  38. package/dist/esm/index.js +7 -7
  39. package/dist/esm/package.json +1 -0
  40. package/dist/esm/providers/base-provider.d.ts +7 -8
  41. package/dist/esm/providers/base-provider.js +7 -8
  42. package/dist/esm/providers/native/google-native-provider.d.ts +13 -2
  43. package/dist/esm/providers/native/google-native-provider.js +50 -6
  44. package/dist/esm/providers/oauth-provider.d.ts +2 -2
  45. package/dist/esm/providers/oauth-provider.js +3 -3
  46. package/dist/esm/providers/provider-factory.d.ts +5 -5
  47. package/dist/esm/providers/provider-factory.js +2 -2
  48. package/dist/esm/providers/web/google-provider.d.ts +74 -18
  49. package/dist/esm/providers/web/google-provider.js +391 -117
  50. package/dist/esm/providers/web/index.d.ts +1 -1
  51. package/dist/esm/providers/web/index.js +1 -1
  52. package/dist/esm/react/hooks.d.ts +2 -2
  53. package/dist/esm/react/hooks.js +2 -2
  54. package/dist/esm/react/index.d.ts +3 -3
  55. package/dist/esm/react/index.js +3 -3
  56. package/dist/esm/react/types.d.ts +1 -1
  57. package/dist/esm/utils/auth-error.d.ts +1 -1
  58. package/dist/esm/utils/auth-error.js +1 -1
  59. package/dist/esm/utils/event-emitter.d.ts +1 -1
  60. package/dist/esm/utils/event-emitter.js +1 -1
  61. package/dist/esm/utils/pending-verification-store.js +1 -1
  62. package/dist/esm/utils/storage.d.ts +2 -2
  63. package/dist/esm/utils/storage.js +31 -7
  64. package/dist/esm/vue/composables.d.ts +2 -2
  65. package/dist/esm/vue/composables.js +1 -1
  66. package/dist/esm/vue/index.d.ts +2 -2
  67. package/dist/esm/vue/index.js +2 -2
  68. package/dist/esm/web.d.ts +1 -1
  69. package/dist/esm/web.js +6 -6
  70. package/dist/plugin.cjs.js +291 -2771
  71. package/dist/plugin.js +585 -147
  72. package/dist/providers-web.cjs.js +1317 -0
  73. package/dist/react.cjs.js +310 -3265
  74. package/dist/vue.cjs.js +266 -3221
  75. package/ios/Plugin/AuthStorage.swift +3 -1
  76. package/ios/Plugin/GoogleAuthProvider.swift +7 -4
  77. package/ios/Plugin/Models.swift +28 -0
  78. package/ios/Plugin/Plugin.swift +64 -40
  79. package/package.json +55 -33
  80. package/scripts/configure.js +71 -325
@@ -138,7 +138,9 @@ class AuthStorage {
138
138
  }
139
139
 
140
140
  func deleteCredential(for provider: AuthProvider) {
141
- remove("credential_\(provider.rawValue)")
141
+ let key = "credential_\(provider.rawValue)"
142
+ UserDefaults.standard.removeObject(forKey: keyPrefix + key)
143
+ deleteFromKeychain(key: keyPrefix + key)
142
144
  }
143
145
 
144
146
  // MARK: - Keychain Helpers
@@ -23,6 +23,7 @@ class GoogleAuthProvider: BaseAuthProvider {
23
23
  private var serverClientId: String?
24
24
  private var hostedDomain: String?
25
25
  private var loginHint: String?
26
+ private var nonce: String?
26
27
  private var offlineAccess: Bool = false
27
28
  private var scopes: [String] = []
28
29
 
@@ -38,12 +39,14 @@ class GoogleAuthProvider: BaseAuthProvider {
38
39
  if let value = config.options["serverClientId"] as? String { self.serverClientId = value }
39
40
  if let value = config.options["hostedDomain"] as? String { self.hostedDomain = value }
40
41
  if let value = config.options["loginHint"] as? String { self.loginHint = value }
42
+ if let value = config.options["nonce"] as? String { self.nonce = value }
41
43
  if let value = config.options["offlineAccess"] as? Bool { self.offlineAccess = value }
42
44
  if let value = config.options["scopes"] as? [String] { self.scopes = value }
43
45
  }
44
46
 
45
47
  func initialize(completion: @escaping (Error?) -> Void) {
46
48
  logger.info("Initializing Google auth provider")
49
+ storage.deleteCredential(for: provider)
47
50
 
48
51
  // A client id must be resolvable from options or the app's Info.plist (`GIDClientID`).
49
52
  guard resolveClientId() != nil else {
@@ -97,7 +100,8 @@ class GoogleAuthProvider: BaseAuthProvider {
97
100
  GIDSignIn.sharedInstance.signIn(
98
101
  withPresenting: presentingVC,
99
102
  hint: self.loginHint,
100
- additionalScopes: additionalScopes
103
+ additionalScopes: additionalScopes,
104
+ nonce: self.nonce
101
105
  ) { [weak self] result, error in
102
106
  guard let self = self else { return }
103
107
 
@@ -124,8 +128,7 @@ class GoogleAuthProvider: BaseAuthProvider {
124
128
  // present when a serverClientID is configured.
125
129
  let credential = self.makeCredential(from: gidUser, serverAuthCode: result.serverAuthCode)
126
130
 
127
- // Persist credential for later restore (serverAuthCode is single-use and not persisted).
128
- self.storage.saveCredential(credential, for: self.provider)
131
+ // GoogleSignIn owns token persistence in its SDK Keychain.
129
132
 
130
133
  let authResult = AuthResult(
131
134
  user: authUser,
@@ -282,7 +285,7 @@ class GoogleAuthProvider: BaseAuthProvider {
282
285
 
283
286
  // serverAuthCode is only returned by the interactive sign-in, not on refresh.
284
287
  let credential = self.makeCredential(from: refreshedUser, serverAuthCode: nil)
285
- self.storage.saveCredential(credential, for: self.provider)
288
+ // Keep refreshed credentials in the SDK, not UserDefaults.
286
289
 
287
290
  let authResult = AuthResult(
288
291
  user: authUser,
@@ -64,6 +64,18 @@ enum AuthErrorCode: String {
64
64
  case redirectCancelledByUser = "auth/redirect-cancelled-by-user"
65
65
  case missingRedirectUrl = "auth/missing-redirect-url"
66
66
  case invalidState = "auth/invalid-state"
67
+ // Added so the plugin can name the failure it is actually reporting; the raw values mirror
68
+ // AuthErrorCode in src/definitions.ts exactly, which is what makes them usable from JS.
69
+ case signInFailed = "auth/sign-in-failed"
70
+ case signOutFailed = "auth/sign-out-failed"
71
+ case providerNotInitialized = "auth/provider-not-initialized"
72
+ case providerNotEnabled = "auth/provider-not-enabled"
73
+ case providerInitFailed = "auth/provider-init-failed"
74
+ case credentialsRequired = "auth/credentials-required"
75
+ case emailRequired = "auth/email-required"
76
+ case phoneRequired = "auth/phone-required"
77
+ case noAuthSession = "auth/no-auth-session"
78
+ case tokenRefreshFailed = "auth/token-refresh-failed"
67
79
  }
68
80
 
69
81
  // MARK: - Models
@@ -375,6 +387,22 @@ struct RevokeAccessOptions {
375
387
  // MARK: - Errors
376
388
 
377
389
  enum AuthManagerError: LocalizedError {
390
+ /// The `AuthErrorCode` this failure should surface as on the JavaScript side.
391
+ var authErrorCode: AuthErrorCode {
392
+ switch self {
393
+ case .notInitialized:
394
+ return .providerNotInitialized
395
+ case .invalidProvider:
396
+ return .unsupportedProvider
397
+ case .providerNotConfigured, .providerNotImplemented:
398
+ return .providerNotEnabled
399
+ case .missingConfiguration, .invalidConfiguration, .noProviderSpecified:
400
+ return .missingConfiguration
401
+ case .operationNotSupported, .operationNotSupportedOnPlatform:
402
+ return .operationNotAllowed
403
+ }
404
+ }
405
+
378
406
  case notInitialized
379
407
  case invalidProvider
380
408
  case providerNotConfigured(AuthProvider)
@@ -1,6 +1,30 @@
1
1
  import Foundation
2
2
  import Capacitor
3
3
 
4
+ extension CAPPluginCall {
5
+ /// Reject carrying a real `AuthErrorCode`.
6
+ ///
7
+ /// `BaseAuthProvider.createAuthError` already builds the code into `NSError.userInfo["code"]`
8
+ /// and `AuthManagerError` now maps itself to one, but every rejection used to pass only
9
+ /// `localizedDescription`. JS then fell back to substring-matching the message, so anything that
10
+ /// did not literally contain "cancelled"/"network"/"timeout" arrived as `auth/internal-error`.
11
+ func rejectAuth(_ error: Error, fallback: AuthErrorCode = .internalError) {
12
+ let code: String
13
+ if let managerError = error as? AuthManagerError {
14
+ code = managerError.authErrorCode.rawValue
15
+ } else if let carried = (error as NSError).userInfo["code"] as? String {
16
+ code = carried
17
+ } else {
18
+ code = fallback.rawValue
19
+ }
20
+ self.reject(error.localizedDescription, code, error)
21
+ }
22
+
23
+ func rejectAuth(_ message: String, _ code: AuthErrorCode) {
24
+ self.reject(message, code.rawValue)
25
+ }
26
+ }
27
+
4
28
  @objc(CapacitorAuthManagerPlugin)
5
29
  public class CapacitorAuthManagerPlugin: CAPPlugin {
6
30
  private let implementation = CapacitorAuthManager()
@@ -22,13 +46,13 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
22
46
 
23
47
  implementation.initialize(options: options) { [weak self] error in
24
48
  if let error = error {
25
- call.reject(error.localizedDescription)
49
+ call.rejectAuth(error)
26
50
  } else {
27
51
  call.resolve()
28
52
  }
29
53
  }
30
54
  } catch {
31
- call.reject(error.localizedDescription)
55
+ call.rejectAuth(error)
32
56
  }
33
57
  }
34
58
 
@@ -47,15 +71,15 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
47
71
 
48
72
  implementation.signIn(options: options) { [weak self] result, error in
49
73
  if let error = error {
50
- call.reject(error.localizedDescription)
74
+ call.rejectAuth(error)
51
75
  } else if let result = result {
52
76
  call.resolve(result.toJSObject())
53
77
  } else {
54
- call.reject("Unknown error occurred")
78
+ call.rejectAuth("Unknown error occurred", .internalError)
55
79
  }
56
80
  }
57
81
  } catch {
58
- call.reject(error.localizedDescription)
82
+ call.rejectAuth(error)
59
83
  }
60
84
  }
61
85
 
@@ -69,7 +93,7 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
69
93
 
70
94
  implementation.signOut(options: options) { [weak self] error in
71
95
  if let error = error {
72
- call.reject(error.localizedDescription)
96
+ call.rejectAuth(error)
73
97
  } else {
74
98
  call.resolve()
75
99
  }
@@ -79,7 +103,7 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
79
103
  @objc func getCurrentUser(_ call: CAPPluginCall) {
80
104
  implementation.getCurrentUser { [weak self] user, error in
81
105
  if let error = error {
82
- call.reject(error.localizedDescription)
106
+ call.rejectAuth(error)
83
107
  } else if let user = user {
84
108
  call.resolve(user.toJSObject())
85
109
  } else {
@@ -96,11 +120,11 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
96
120
 
97
121
  implementation.refreshToken(options: options) { [weak self] result, error in
98
122
  if let error = error {
99
- call.reject(error.localizedDescription)
123
+ call.rejectAuth(error)
100
124
  } else if let result = result {
101
125
  call.resolve(result.toJSObject())
102
126
  } else {
103
- call.reject("Unknown error occurred")
127
+ call.rejectAuth("Unknown error occurred", .internalError)
104
128
  }
105
129
  }
106
130
  }
@@ -125,17 +149,17 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
125
149
  @objc func isSupported(_ call: CAPPluginCall) {
126
150
  guard let providerString = call.getString("provider"),
127
151
  let provider = AuthProvider(rawValue: providerString) else {
128
- call.reject("Invalid provider")
152
+ call.rejectAuth("Invalid provider", .unsupportedProvider)
129
153
  return
130
154
  }
131
155
 
132
156
  implementation.isSupported(provider: provider) { [weak self] result, error in
133
157
  if let error = error {
134
- call.reject(error.localizedDescription)
158
+ call.rejectAuth(error)
135
159
  } else if let result = result {
136
160
  call.resolve(result.toJSObject())
137
161
  } else {
138
- call.reject("Unknown error occurred")
162
+ call.rejectAuth("Unknown error occurred", .internalError)
139
163
  }
140
164
  }
141
165
  }
@@ -152,13 +176,13 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
152
176
 
153
177
  implementation.configure(config: config) { [weak self] error in
154
178
  if let error = error {
155
- call.reject(error.localizedDescription)
179
+ call.rejectAuth(error)
156
180
  } else {
157
181
  call.resolve()
158
182
  }
159
183
  }
160
184
  } catch {
161
- call.reject(error.localizedDescription)
185
+ call.rejectAuth(error)
162
186
  }
163
187
  }
164
188
 
@@ -177,28 +201,28 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
177
201
 
178
202
  implementation.linkAccount(options: options) { [weak self] result, error in
179
203
  if let error = error {
180
- call.reject(error.localizedDescription)
204
+ call.rejectAuth(error)
181
205
  } else if let result = result {
182
206
  call.resolve(result.toJSObject())
183
207
  } else {
184
- call.reject("Unknown error occurred")
208
+ call.rejectAuth("Unknown error occurred", .internalError)
185
209
  }
186
210
  }
187
211
  } catch {
188
- call.reject(error.localizedDescription)
212
+ call.rejectAuth(error)
189
213
  }
190
214
  }
191
215
 
192
216
  @objc func unlinkAccount(_ call: CAPPluginCall) {
193
217
  guard let providerString = call.getString("provider"),
194
218
  let provider = AuthProvider(rawValue: providerString) else {
195
- call.reject("Invalid provider")
219
+ call.rejectAuth("Invalid provider", .unsupportedProvider)
196
220
  return
197
221
  }
198
222
 
199
223
  implementation.unlinkAccount(provider: provider) { [weak self] error in
200
224
  if let error = error {
201
- call.reject(error.localizedDescription)
225
+ call.rejectAuth(error)
202
226
  } else {
203
227
  call.resolve()
204
228
  }
@@ -207,7 +231,7 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
207
231
 
208
232
  @objc func sendPasswordResetEmail(_ call: CAPPluginCall) {
209
233
  guard let email = call.getString("email") else {
210
- call.reject("Email is required")
234
+ call.rejectAuth("Email is required", .emailRequired)
211
235
  return
212
236
  }
213
237
 
@@ -218,7 +242,7 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
218
242
 
219
243
  implementation.sendPasswordResetEmail(options: options) { [weak self] error in
220
244
  if let error = error {
221
- call.reject(error.localizedDescription)
245
+ call.rejectAuth(error)
222
246
  } else {
223
247
  call.resolve()
224
248
  }
@@ -232,7 +256,7 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
232
256
 
233
257
  implementation.sendEmailVerification(options: options) { [weak self] error in
234
258
  if let error = error {
235
- call.reject(error.localizedDescription)
259
+ call.rejectAuth(error)
236
260
  } else {
237
261
  call.resolve()
238
262
  }
@@ -241,7 +265,7 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
241
265
 
242
266
  @objc func sendSmsCode(_ call: CAPPluginCall) {
243
267
  guard let phoneNumber = call.getString("phoneNumber") else {
244
- call.reject("Phone number is required")
268
+ call.rejectAuth("Phone number is required", .phoneRequired)
245
269
  return
246
270
  }
247
271
 
@@ -253,7 +277,7 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
253
277
 
254
278
  implementation.sendSmsCode(options: options) { [weak self] error in
255
279
  if let error = error {
256
- call.reject(error.localizedDescription)
280
+ call.rejectAuth(error)
257
281
  } else {
258
282
  call.resolve()
259
283
  }
@@ -263,7 +287,7 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
263
287
  @objc func verifySmsCode(_ call: CAPPluginCall) {
264
288
  guard let phoneNumber = call.getString("phoneNumber"),
265
289
  let code = call.getString("code") else {
266
- call.reject("Phone number and code are required")
290
+ call.rejectAuth("Phone number and code are required", .credentialsRequired)
267
291
  return
268
292
  }
269
293
 
@@ -275,18 +299,18 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
275
299
 
276
300
  implementation.verifySmsCode(options: options) { [weak self] result, error in
277
301
  if let error = error {
278
- call.reject(error.localizedDescription)
302
+ call.rejectAuth(error)
279
303
  } else if let result = result {
280
304
  call.resolve(result.toJSObject())
281
305
  } else {
282
- call.reject("Unknown error occurred")
306
+ call.rejectAuth("Unknown error occurred", .internalError)
283
307
  }
284
308
  }
285
309
  }
286
310
 
287
311
  @objc func sendEmailCode(_ call: CAPPluginCall) {
288
312
  guard let email = call.getString("email") else {
289
- call.reject("Email is required")
313
+ call.rejectAuth("Email is required", .emailRequired)
290
314
  return
291
315
  }
292
316
 
@@ -298,7 +322,7 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
298
322
 
299
323
  implementation.sendEmailCode(options: options) { [weak self] error in
300
324
  if let error = error {
301
- call.reject(error.localizedDescription)
325
+ call.rejectAuth(error)
302
326
  } else {
303
327
  call.resolve()
304
328
  }
@@ -308,7 +332,7 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
308
332
  @objc func verifyEmailCode(_ call: CAPPluginCall) {
309
333
  guard let email = call.getString("email"),
310
334
  let code = call.getString("code") else {
311
- call.reject("Email and code are required")
335
+ call.rejectAuth("Email and code are required", .credentialsRequired)
312
336
  return
313
337
  }
314
338
 
@@ -320,11 +344,11 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
320
344
 
321
345
  implementation.verifyEmailCode(options: options) { [weak self] result, error in
322
346
  if let error = error {
323
- call.reject(error.localizedDescription)
347
+ call.rejectAuth(error)
324
348
  } else if let result = result {
325
349
  call.resolve(result.toJSObject())
326
350
  } else {
327
- call.reject("Unknown error occurred")
351
+ call.rejectAuth("Unknown error occurred", .internalError)
328
352
  }
329
353
  }
330
354
  }
@@ -339,11 +363,11 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
339
363
 
340
364
  implementation.updateProfile(options: options) { [weak self] user, error in
341
365
  if let error = error {
342
- call.reject(error.localizedDescription)
366
+ call.rejectAuth(error)
343
367
  } else if let user = user {
344
368
  call.resolve(user.toJSObject())
345
369
  } else {
346
- call.reject("Unknown error occurred")
370
+ call.rejectAuth("Unknown error occurred", .internalError)
347
371
  }
348
372
  }
349
373
  }
@@ -357,7 +381,7 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
357
381
 
358
382
  implementation.deleteAccount(options: options) { [weak self] error in
359
383
  if let error = error {
360
- call.reject(error.localizedDescription)
384
+ call.rejectAuth(error)
361
385
  } else {
362
386
  call.resolve()
363
387
  }
@@ -372,11 +396,11 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
372
396
 
373
397
  implementation.getIdToken(options: options) { [weak self] token, error in
374
398
  if let error = error {
375
- call.reject(error.localizedDescription)
399
+ call.rejectAuth(error)
376
400
  } else if let token = token {
377
401
  call.resolve(["token": token])
378
402
  } else {
379
- call.reject("Failed to get ID token")
403
+ call.rejectAuth("Failed to get ID token", .noAuthSession)
380
404
  }
381
405
  }
382
406
  }
@@ -385,13 +409,13 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
385
409
  guard let providerString = call.getString("provider"),
386
410
  let provider = AuthProvider(rawValue: providerString),
387
411
  let parameters = call.getObject("parameters") else {
388
- call.reject("Provider and parameters are required")
412
+ call.rejectAuth("Provider and parameters are required", .missingConfiguration)
389
413
  return
390
414
  }
391
415
 
392
416
  implementation.setCustomParameters(provider: provider, parameters: parameters) { [weak self] error in
393
417
  if let error = error {
394
- call.reject(error.localizedDescription)
418
+ call.rejectAuth(error)
395
419
  } else {
396
420
  call.resolve()
397
421
  }
@@ -406,7 +430,7 @@ public class CapacitorAuthManagerPlugin: CAPPlugin {
406
430
 
407
431
  implementation.revokeAccess(options: options) { [weak self] error in
408
432
  if let error = error {
409
- call.reject(error.localizedDescription)
433
+ call.rejectAuth(error)
410
434
  } else {
411
435
  call.resolve()
412
436
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "capacitor-auth-manager",
3
- "version": "2.4.4",
4
- "description": "Capacitor + web authentication. Firebase-agnostic native & web Google sign-in (idToken/accessToken) for React, Vue, Angular and vanilla JS — a drop-in alternative to @codetrix-studio/capacitor-google-auth. More providers shipping one at a time.",
3
+ "version": "3.0.0",
4
+ "description": "Capacitor + web authentication. Firebase-agnostic native & web Google sign-in (idToken/accessToken) for React, Vue, Angular and vanilla JS \u2014 a drop-in alternative to @codetrix-studio/capacitor-google-auth. More providers shipping one at a time.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/esm/index.d.ts",
@@ -35,24 +35,26 @@
35
35
  "./providers/web": {
36
36
  "types": "./dist/esm/providers/web/index.d.ts",
37
37
  "import": "./dist/esm/providers/web/index.js",
38
- "require": "./dist/plugin.cjs.js"
38
+ "require": "./dist/providers-web.cjs.js"
39
39
  },
40
40
  "./package.json": "./package.json"
41
41
  },
42
42
  "sideEffects": false,
43
43
  "files": [
44
- "android/src/main/",
44
+ "android/src/main/**",
45
45
  "android/build.gradle",
46
46
  "android/gradle.properties",
47
47
  "android/settings.gradle",
48
48
  "android/proguard-rules.pro",
49
- "dist/",
50
- "ios/Plugin/",
49
+ "dist/**",
50
+ "ios/Plugin/**",
51
51
  "scripts/configure.js",
52
52
  "CapacitorAuthManager.podspec",
53
53
  "README.md",
54
54
  "CHANGELOG.md",
55
- "LICENSE"
55
+ "LICENSE",
56
+ "AI-INTEGRATION-GUIDE.md",
57
+ "android/consumer-rules.pro"
56
58
  ],
57
59
  "author": {
58
60
  "email": "aoneahsan@gmail.com",
@@ -81,20 +83,25 @@
81
83
  "angular"
82
84
  ],
83
85
  "scripts": {
84
- "build": "npm run clean && npm run tsc && rollup -c rollup.config.mjs",
86
+ "build": "yarn clean && yarn tsc && node scripts/mark-esm.js && rollup -c rollup.config.mjs",
85
87
  "clean": "rimraf ./dist",
86
88
  "tsc": "tsc -p tsconfig.build.json",
87
89
  "typecheck": "tsc -p tsconfig.build.json --noEmit",
88
90
  "watch": "tsc --watch",
89
- "lint": "eslint .",
91
+ "lint": "eslint . --max-warnings 0",
90
92
  "prettier": "prettier --write .",
91
- "prepack": "npm run build",
92
- "prepublishOnly": "npm run build && npm run lint",
93
+ "prepack": "yarn build",
94
+ "prepublishOnly": "yarn typecheck && yarn lint && yarn build && yarn test && yarn smoke:tarball",
93
95
  "swiftlint": "cd ios && swiftlint lint --fix --format --path Plugin --verbose",
94
- "configure": "node scripts/configure.js"
96
+ "configure": "node scripts/configure.js",
97
+ "smoke:tarball": "node --test test/tarball-smoke.test.js",
98
+ "test": "node --test test/google.test.js test/manager.test.js",
99
+ "sync:apps-config": "trapeze run apps-config.yaml",
100
+ "typecheck:clean": "tsc -b tsconfig.build.json --force",
101
+ "smoke:native": "node scripts/native-smoke.js"
95
102
  },
96
103
  "engines": {
97
- "node": ">=18.0.0"
104
+ "node": ">=24.0.0"
98
105
  },
99
106
  "bin": {
100
107
  "capacitor-auth-configure": "./scripts/configure.js"
@@ -103,38 +110,48 @@
103
110
  "tslib": "^2.8.1"
104
111
  },
105
112
  "devDependencies": {
106
- "@angular/common": "^22.0.0",
107
- "@angular/core": "^22.0.0",
108
- "@angular/router": "^22.0.0",
109
- "@capacitor/android": "^8.4.0",
110
- "@capacitor/cli": "^8.4.0",
111
- "@capacitor/core": "^8.4.0",
112
- "@capacitor/ios": "^8.4.0",
113
+ "@angular/common": "^22.2.2",
114
+ "@angular/core": "^22.2.2",
115
+ "@angular/platform-browser": "^22.2.2",
116
+ "@angular/router": "^22.2.2",
117
+ "@capacitor/android": "^8.5.3",
118
+ "@capacitor/cli": "^8.5.3",
119
+ "@capacitor/core": "^8.5.3",
120
+ "@capacitor/ios": "^8.5.3",
121
+ "@capacitor/preferences": "^8.0.1",
113
122
  "@rollup/plugin-json": "^6.1.0",
114
123
  "@rollup/plugin-node-resolve": "^16.0.3",
115
- "@types/node": "^25.9.1",
116
- "@types/react": "^19.2.17",
117
- "eslint": "^10.4.1",
118
- "prettier": "^3.8.3",
124
+ "@trapezedev/configure": "^7.1.10",
125
+ "@types/node": "^26.6.4",
126
+ "@types/react": "^19.3.0",
127
+ "eslint": "^10.12.0",
128
+ "prettier": "^3.9.9",
129
+ "react": "^19.3.0",
119
130
  "rimraf": "^6.1.3",
120
- "rollup": "^4.61.1",
131
+ "rollup": "^4.64.3",
121
132
  "rxjs": "^7.8.2",
122
- "typescript": "^6.0.3",
123
- "typescript-eslint": "^8.60.1",
124
- "vue": "^3.5.35"
133
+ "typescript": "~6.0.3",
134
+ "typescript-eslint": "^8.71.1",
135
+ "vue": "^3.5.43"
125
136
  },
126
137
  "peerDependencies": {
127
- "@angular/core": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
138
+ "@angular/common": "^22.0.0",
139
+ "@angular/core": "^22.0.0",
140
+ "@angular/router": "^22.0.0",
128
141
  "@capacitor/core": "^7.4.2 || ^8.0.0",
129
142
  "@capacitor/preferences": "^6.0.0 || ^7.0.0 || ^8.0.0",
130
143
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
144
+ "rxjs": "^7.0.0",
131
145
  "vue": "^3.0.0"
132
146
  },
133
147
  "peerDependenciesMeta": {
148
+ "@angular/common": {
149
+ "optional": true
150
+ },
134
151
  "@angular/core": {
135
152
  "optional": true
136
153
  },
137
- "@capacitor/core": {
154
+ "@angular/router": {
138
155
  "optional": true
139
156
  },
140
157
  "@capacitor/preferences": {
@@ -143,13 +160,13 @@
143
160
  "react": {
144
161
  "optional": true
145
162
  },
163
+ "rxjs": {
164
+ "optional": true
165
+ },
146
166
  "vue": {
147
167
  "optional": true
148
168
  }
149
169
  },
150
- "optionalDependencies": {
151
- "capacitor-biometric-authentication": "^2.3.1"
152
- },
153
170
  "capacitor": {
154
171
  "ios": {
155
172
  "src": "ios"
@@ -157,5 +174,10 @@
157
174
  "android": {
158
175
  "src": "android"
159
176
  }
177
+ },
178
+ "packageManager": "yarn@4.17.1",
179
+ "resolutions": {
180
+ "plist/@xmldom/xmldom": "^0.9.12",
181
+ "xcode/uuid": "^11.1.1"
160
182
  }
161
183
  }