capacitor-auth-manager 0.0.1 → 0.0.2
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/CapacitorAuthManager.podspec +36 -0
- package/Readme.md +542 -20
- package/android/build.gradle +79 -0
- package/android/gradle.properties +25 -0
- package/android/proguard-rules.pro +38 -0
- package/android/settings.gradle +2 -0
- package/android/src/main/AndroidManifest.xml +11 -0
- package/android/src/main/java/com/zaions/cap_auth_manager/AuthLogger.java +117 -0
- package/android/src/main/java/com/zaions/cap_auth_manager/AuthStorage.java +124 -0
- package/android/src/main/java/com/zaions/cap_auth_manager/BaseAuthProvider.java +16 -0
- package/android/src/main/java/com/zaions/cap_auth_manager/CapacitorAuthManager.java +385 -0
- package/android/src/main/java/com/zaions/cap_auth_manager/CapacitorAuthManagerPlugin.java +469 -0
- package/dist/esm/definitions.d.ts +521 -0
- package/dist/esm/definitions.js +103 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +6 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/providers/base-provider.d.ts +43 -0
- package/dist/esm/providers/base-provider.js +112 -0
- package/dist/esm/providers/base-provider.js.map +1 -0
- package/dist/esm/providers/oauth-provider.d.ts +30 -0
- package/dist/esm/providers/oauth-provider.js +255 -0
- package/dist/esm/providers/oauth-provider.js.map +1 -0
- package/dist/esm/providers/provider-factory.d.ts +7 -0
- package/dist/esm/providers/provider-factory.js +76 -0
- package/dist/esm/providers/provider-factory.js.map +1 -0
- package/dist/esm/providers/web/apple-provider.d.ts +33 -0
- package/dist/esm/providers/web/apple-provider.js +270 -0
- package/dist/esm/providers/web/apple-provider.js.map +1 -0
- package/dist/esm/providers/web/google-provider.d.ts +27 -0
- package/dist/esm/providers/web/google-provider.js +258 -0
- package/dist/esm/providers/web/google-provider.js.map +1 -0
- package/dist/esm/utils/auth-error.d.ts +16 -0
- package/dist/esm/utils/auth-error.js +53 -0
- package/dist/esm/utils/auth-error.js.map +1 -0
- package/dist/esm/utils/event-emitter.d.ts +9 -0
- package/dist/esm/utils/event-emitter.js +28 -0
- package/dist/esm/utils/event-emitter.js.map +1 -0
- package/dist/esm/utils/logger.d.ts +19 -0
- package/dist/esm/utils/logger.js +48 -0
- package/dist/esm/utils/logger.js.map +1 -0
- package/dist/esm/utils/storage.d.ts +16 -0
- package/dist/esm/utils/storage.js +86 -0
- package/dist/esm/utils/storage.js.map +1 -0
- package/dist/esm/web.d.ts +43 -0
- package/dist/esm/web.js +374 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +1650 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +1652 -3
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/AuthLogger.swift +71 -0
- package/ios/Plugin/AuthStorage.swift +139 -0
- package/ios/Plugin/BaseAuthProvider.swift +33 -0
- package/ios/Plugin/CapacitorAuthManager.swift +406 -0
- package/ios/Plugin/Models.swift +376 -0
- package/ios/Plugin/Plugin.m +27 -0
- package/ios/Plugin/Plugin.swift +413 -0
- package/package.json +6 -2
- package/scripts/configure.js +295 -0
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
package com.zaions.cap_auth_manager;
|
|
2
|
+
|
|
3
|
+
import com.getcapacitor.JSObject;
|
|
4
|
+
import com.getcapacitor.Plugin;
|
|
5
|
+
import com.getcapacitor.PluginCall;
|
|
6
|
+
import com.getcapacitor.PluginMethod;
|
|
7
|
+
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
8
|
+
|
|
9
|
+
@CapacitorPlugin(name = "CapacitorAuthManager")
|
|
10
|
+
public class CapacitorAuthManagerPlugin extends Plugin {
|
|
11
|
+
|
|
12
|
+
private CapacitorAuthManager implementation;
|
|
13
|
+
|
|
14
|
+
@Override
|
|
15
|
+
public void load() {
|
|
16
|
+
implementation = new CapacitorAuthManager(getContext(), getActivity());
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@PluginMethod
|
|
20
|
+
public void initialize(PluginCall call) {
|
|
21
|
+
try {
|
|
22
|
+
JSObject options = call.getObject("options");
|
|
23
|
+
if (options == null) {
|
|
24
|
+
call.reject("Options are required");
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
implementation.initialize(options, result -> {
|
|
29
|
+
if (result.isSuccess()) {
|
|
30
|
+
call.resolve();
|
|
31
|
+
} else {
|
|
32
|
+
call.reject(result.getError().getMessage());
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
} catch (Exception e) {
|
|
36
|
+
call.reject("Failed to initialize: " + e.getMessage());
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@PluginMethod
|
|
41
|
+
public void signIn(PluginCall call) {
|
|
42
|
+
try {
|
|
43
|
+
String provider = call.getString("provider");
|
|
44
|
+
JSObject credentials = call.getObject("credentials");
|
|
45
|
+
JSObject options = call.getObject("options");
|
|
46
|
+
|
|
47
|
+
if (provider == null) {
|
|
48
|
+
call.reject("Provider is required");
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
implementation.signIn(provider, credentials, options, result -> {
|
|
53
|
+
if (result.isSuccess()) {
|
|
54
|
+
call.resolve(result.getData());
|
|
55
|
+
} else {
|
|
56
|
+
call.reject(result.getError().getMessage());
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
} catch (Exception e) {
|
|
60
|
+
call.reject("Sign in failed: " + e.getMessage());
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@PluginMethod
|
|
65
|
+
public void signOut(PluginCall call) {
|
|
66
|
+
try {
|
|
67
|
+
JSObject options = call.getObject("options");
|
|
68
|
+
|
|
69
|
+
implementation.signOut(options, result -> {
|
|
70
|
+
if (result.isSuccess()) {
|
|
71
|
+
call.resolve();
|
|
72
|
+
} else {
|
|
73
|
+
call.reject(result.getError().getMessage());
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
} catch (Exception e) {
|
|
77
|
+
call.reject("Sign out failed: " + e.getMessage());
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@PluginMethod
|
|
82
|
+
public void getCurrentUser(PluginCall call) {
|
|
83
|
+
try {
|
|
84
|
+
implementation.getCurrentUser(result -> {
|
|
85
|
+
if (result.isSuccess()) {
|
|
86
|
+
JSObject user = result.getData();
|
|
87
|
+
if (user != null) {
|
|
88
|
+
call.resolve(user);
|
|
89
|
+
} else {
|
|
90
|
+
call.resolve(new JSObject());
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
call.reject(result.getError().getMessage());
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
} catch (Exception e) {
|
|
97
|
+
call.reject("Failed to get current user: " + e.getMessage());
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@PluginMethod
|
|
102
|
+
public void refreshToken(PluginCall call) {
|
|
103
|
+
try {
|
|
104
|
+
JSObject options = call.getObject("options");
|
|
105
|
+
|
|
106
|
+
implementation.refreshToken(options, result -> {
|
|
107
|
+
if (result.isSuccess()) {
|
|
108
|
+
call.resolve(result.getData());
|
|
109
|
+
} else {
|
|
110
|
+
call.reject(result.getError().getMessage());
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
} catch (Exception e) {
|
|
114
|
+
call.reject("Token refresh failed: " + e.getMessage());
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@PluginMethod
|
|
119
|
+
public void addAuthStateListener(PluginCall call) {
|
|
120
|
+
try {
|
|
121
|
+
String callbackId = implementation.addAuthStateListener(user -> {
|
|
122
|
+
JSObject ret = new JSObject();
|
|
123
|
+
if (user != null) {
|
|
124
|
+
ret.put("user", user);
|
|
125
|
+
} else {
|
|
126
|
+
ret.put("user", JSObject.NULL);
|
|
127
|
+
}
|
|
128
|
+
notifyListeners("authStateChange", ret);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
JSObject ret = new JSObject();
|
|
132
|
+
ret.put("callbackId", callbackId);
|
|
133
|
+
call.resolve(ret);
|
|
134
|
+
} catch (Exception e) {
|
|
135
|
+
call.reject("Failed to add listener: " + e.getMessage());
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@PluginMethod
|
|
140
|
+
public void removeAllListeners(PluginCall call) {
|
|
141
|
+
try {
|
|
142
|
+
implementation.removeAllListeners();
|
|
143
|
+
call.resolve();
|
|
144
|
+
} catch (Exception e) {
|
|
145
|
+
call.reject("Failed to remove listeners: " + e.getMessage());
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@PluginMethod
|
|
150
|
+
public void isSupported(PluginCall call) {
|
|
151
|
+
try {
|
|
152
|
+
String provider = call.getString("provider");
|
|
153
|
+
if (provider == null) {
|
|
154
|
+
call.reject("Provider is required");
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
implementation.isSupported(provider, result -> {
|
|
159
|
+
if (result.isSuccess()) {
|
|
160
|
+
call.resolve(result.getData());
|
|
161
|
+
} else {
|
|
162
|
+
call.reject(result.getError().getMessage());
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
} catch (Exception e) {
|
|
166
|
+
call.reject("Failed to check support: " + e.getMessage());
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@PluginMethod
|
|
171
|
+
public void configure(PluginCall call) {
|
|
172
|
+
try {
|
|
173
|
+
String provider = call.getString("provider");
|
|
174
|
+
JSObject options = call.getObject("options");
|
|
175
|
+
|
|
176
|
+
if (provider == null || options == null) {
|
|
177
|
+
call.reject("Provider and options are required");
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
implementation.configure(provider, options, result -> {
|
|
182
|
+
if (result.isSuccess()) {
|
|
183
|
+
call.resolve();
|
|
184
|
+
} else {
|
|
185
|
+
call.reject(result.getError().getMessage());
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
} catch (Exception e) {
|
|
189
|
+
call.reject("Configuration failed: " + e.getMessage());
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@PluginMethod
|
|
194
|
+
public void linkAccount(PluginCall call) {
|
|
195
|
+
try {
|
|
196
|
+
String provider = call.getString("provider");
|
|
197
|
+
JSObject credentials = call.getObject("credentials");
|
|
198
|
+
JSObject options = call.getObject("options");
|
|
199
|
+
|
|
200
|
+
if (provider == null) {
|
|
201
|
+
call.reject("Provider is required");
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
implementation.linkAccount(provider, credentials, options, result -> {
|
|
206
|
+
if (result.isSuccess()) {
|
|
207
|
+
call.resolve(result.getData());
|
|
208
|
+
} else {
|
|
209
|
+
call.reject(result.getError().getMessage());
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
} catch (Exception e) {
|
|
213
|
+
call.reject("Account linking failed: " + e.getMessage());
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
@PluginMethod
|
|
218
|
+
public void unlinkAccount(PluginCall call) {
|
|
219
|
+
try {
|
|
220
|
+
String provider = call.getString("provider");
|
|
221
|
+
if (provider == null) {
|
|
222
|
+
call.reject("Provider is required");
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
implementation.unlinkAccount(provider, result -> {
|
|
227
|
+
if (result.isSuccess()) {
|
|
228
|
+
call.resolve();
|
|
229
|
+
} else {
|
|
230
|
+
call.reject(result.getError().getMessage());
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
} catch (Exception e) {
|
|
234
|
+
call.reject("Account unlinking failed: " + e.getMessage());
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@PluginMethod
|
|
239
|
+
public void sendPasswordResetEmail(PluginCall call) {
|
|
240
|
+
try {
|
|
241
|
+
String email = call.getString("email");
|
|
242
|
+
JSObject actionCodeSettings = call.getObject("actionCodeSettings");
|
|
243
|
+
|
|
244
|
+
if (email == null) {
|
|
245
|
+
call.reject("Email is required");
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
implementation.sendPasswordResetEmail(email, actionCodeSettings, result -> {
|
|
250
|
+
if (result.isSuccess()) {
|
|
251
|
+
call.resolve();
|
|
252
|
+
} else {
|
|
253
|
+
call.reject(result.getError().getMessage());
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
} catch (Exception e) {
|
|
257
|
+
call.reject("Failed to send password reset email: " + e.getMessage());
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
@PluginMethod
|
|
262
|
+
public void sendEmailVerification(PluginCall call) {
|
|
263
|
+
try {
|
|
264
|
+
JSObject options = call.getObject("options");
|
|
265
|
+
|
|
266
|
+
implementation.sendEmailVerification(options, result -> {
|
|
267
|
+
if (result.isSuccess()) {
|
|
268
|
+
call.resolve();
|
|
269
|
+
} else {
|
|
270
|
+
call.reject(result.getError().getMessage());
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
} catch (Exception e) {
|
|
274
|
+
call.reject("Failed to send email verification: " + e.getMessage());
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
@PluginMethod
|
|
279
|
+
public void sendSmsCode(PluginCall call) {
|
|
280
|
+
try {
|
|
281
|
+
String phoneNumber = call.getString("phoneNumber");
|
|
282
|
+
String recaptchaToken = call.getString("recaptchaToken");
|
|
283
|
+
String testCode = call.getString("testCode");
|
|
284
|
+
|
|
285
|
+
if (phoneNumber == null) {
|
|
286
|
+
call.reject("Phone number is required");
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
implementation.sendSmsCode(phoneNumber, recaptchaToken, testCode, result -> {
|
|
291
|
+
if (result.isSuccess()) {
|
|
292
|
+
call.resolve();
|
|
293
|
+
} else {
|
|
294
|
+
call.reject(result.getError().getMessage());
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
} catch (Exception e) {
|
|
298
|
+
call.reject("Failed to send SMS code: " + e.getMessage());
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
@PluginMethod
|
|
303
|
+
public void verifySmsCode(PluginCall call) {
|
|
304
|
+
try {
|
|
305
|
+
String phoneNumber = call.getString("phoneNumber");
|
|
306
|
+
String code = call.getString("code");
|
|
307
|
+
String verificationId = call.getString("verificationId");
|
|
308
|
+
|
|
309
|
+
if (phoneNumber == null || code == null) {
|
|
310
|
+
call.reject("Phone number and code are required");
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
implementation.verifySmsCode(phoneNumber, code, verificationId, result -> {
|
|
315
|
+
if (result.isSuccess()) {
|
|
316
|
+
call.resolve(result.getData());
|
|
317
|
+
} else {
|
|
318
|
+
call.reject(result.getError().getMessage());
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
} catch (Exception e) {
|
|
322
|
+
call.reject("SMS verification failed: " + e.getMessage());
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
@PluginMethod
|
|
327
|
+
public void sendEmailCode(PluginCall call) {
|
|
328
|
+
try {
|
|
329
|
+
String email = call.getString("email");
|
|
330
|
+
String recaptchaToken = call.getString("recaptchaToken");
|
|
331
|
+
String testCode = call.getString("testCode");
|
|
332
|
+
|
|
333
|
+
if (email == null) {
|
|
334
|
+
call.reject("Email is required");
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
implementation.sendEmailCode(email, recaptchaToken, testCode, result -> {
|
|
339
|
+
if (result.isSuccess()) {
|
|
340
|
+
call.resolve();
|
|
341
|
+
} else {
|
|
342
|
+
call.reject(result.getError().getMessage());
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
} catch (Exception e) {
|
|
346
|
+
call.reject("Failed to send email code: " + e.getMessage());
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
@PluginMethod
|
|
351
|
+
public void verifyEmailCode(PluginCall call) {
|
|
352
|
+
try {
|
|
353
|
+
String email = call.getString("email");
|
|
354
|
+
String code = call.getString("code");
|
|
355
|
+
String verificationId = call.getString("verificationId");
|
|
356
|
+
|
|
357
|
+
if (email == null || code == null) {
|
|
358
|
+
call.reject("Email and code are required");
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
implementation.verifyEmailCode(email, code, verificationId, result -> {
|
|
363
|
+
if (result.isSuccess()) {
|
|
364
|
+
call.resolve(result.getData());
|
|
365
|
+
} else {
|
|
366
|
+
call.reject(result.getError().getMessage());
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
} catch (Exception e) {
|
|
370
|
+
call.reject("Email verification failed: " + e.getMessage());
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
@PluginMethod
|
|
375
|
+
public void updateProfile(PluginCall call) {
|
|
376
|
+
try {
|
|
377
|
+
JSObject options = call.getObject("options");
|
|
378
|
+
if (options == null) {
|
|
379
|
+
options = new JSObject();
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
implementation.updateProfile(options, result -> {
|
|
383
|
+
if (result.isSuccess()) {
|
|
384
|
+
call.resolve(result.getData());
|
|
385
|
+
} else {
|
|
386
|
+
call.reject(result.getError().getMessage());
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
} catch (Exception e) {
|
|
390
|
+
call.reject("Profile update failed: " + e.getMessage());
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
@PluginMethod
|
|
395
|
+
public void deleteAccount(PluginCall call) {
|
|
396
|
+
try {
|
|
397
|
+
JSObject options = call.getObject("options");
|
|
398
|
+
|
|
399
|
+
implementation.deleteAccount(options, result -> {
|
|
400
|
+
if (result.isSuccess()) {
|
|
401
|
+
call.resolve();
|
|
402
|
+
} else {
|
|
403
|
+
call.reject(result.getError().getMessage());
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
} catch (Exception e) {
|
|
407
|
+
call.reject("Account deletion failed: " + e.getMessage());
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
@PluginMethod
|
|
412
|
+
public void getIdToken(PluginCall call) {
|
|
413
|
+
try {
|
|
414
|
+
JSObject options = call.getObject("options");
|
|
415
|
+
|
|
416
|
+
implementation.getIdToken(options, result -> {
|
|
417
|
+
if (result.isSuccess()) {
|
|
418
|
+
JSObject ret = new JSObject();
|
|
419
|
+
ret.put("token", result.getData().getString("token"));
|
|
420
|
+
call.resolve(ret);
|
|
421
|
+
} else {
|
|
422
|
+
call.reject(result.getError().getMessage());
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
} catch (Exception e) {
|
|
426
|
+
call.reject("Failed to get ID token: " + e.getMessage());
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
@PluginMethod
|
|
431
|
+
public void setCustomParameters(PluginCall call) {
|
|
432
|
+
try {
|
|
433
|
+
String provider = call.getString("provider");
|
|
434
|
+
JSObject parameters = call.getObject("parameters");
|
|
435
|
+
|
|
436
|
+
if (provider == null || parameters == null) {
|
|
437
|
+
call.reject("Provider and parameters are required");
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
implementation.setCustomParameters(provider, parameters, result -> {
|
|
442
|
+
if (result.isSuccess()) {
|
|
443
|
+
call.resolve();
|
|
444
|
+
} else {
|
|
445
|
+
call.reject(result.getError().getMessage());
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
} catch (Exception e) {
|
|
449
|
+
call.reject("Failed to set custom parameters: " + e.getMessage());
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
@PluginMethod
|
|
454
|
+
public void revokeAccess(PluginCall call) {
|
|
455
|
+
try {
|
|
456
|
+
JSObject options = call.getObject("options");
|
|
457
|
+
|
|
458
|
+
implementation.revokeAccess(options, result -> {
|
|
459
|
+
if (result.isSuccess()) {
|
|
460
|
+
call.resolve();
|
|
461
|
+
} else {
|
|
462
|
+
call.reject(result.getError().getMessage());
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
} catch (Exception e) {
|
|
466
|
+
call.reject("Access revocation failed: " + e.getMessage());
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|