uqudosdk-react-native 2.2.1

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.
@@ -0,0 +1,587 @@
1
+ // noinspection JSUnresolvedVariable
2
+
3
+ import {NativeModules} from 'react-native';
4
+
5
+ export class UqudoIdSDK {
6
+ init() {
7
+ NativeModules.UqudoId.init();
8
+ }
9
+
10
+ setLocale(locale) {
11
+ NativeModules.UqudoId.setLocale(locale);
12
+ }
13
+
14
+ async enroll(enrollmentConfiguration) {
15
+ console.log(JSON.stringify(enrollmentConfiguration));
16
+ var result = await NativeModules.UqudoId.enroll(JSON.stringify(enrollmentConfiguration));
17
+ return result;
18
+ }
19
+
20
+ async recover(accountRecoveryConfiguration) {
21
+ console.log(JSON.stringify(accountRecoveryConfiguration));
22
+ var result = await NativeModules.UqudoId.recover(JSON.stringify(accountRecoveryConfiguration));
23
+ return result;
24
+ }
25
+
26
+ async faceSession(faceSessionConfiguration) {
27
+ console.log(JSON.stringify(faceSessionConfiguration));
28
+ var result = await NativeModules.UqudoId.faceSession(JSON.stringify(faceSessionConfiguration));
29
+ return result;
30
+ }
31
+ }
32
+
33
+ export const DocumentType = Object.freeze(
34
+ {
35
+ BHR_ID: 'BHR_ID',
36
+ GENERIC_ID: 'GENERIC_ID',
37
+ KWT_ID: 'KWT_ID',
38
+ OMN_ID: 'OMN_ID',
39
+ PAK_ID: 'PAK_ID',
40
+ PASSPORT: 'PASSPORT',
41
+ SAU_ID: 'SAU_ID',
42
+ UAE_ID: 'UAE_ID',
43
+ UAE_DL: 'UAE_DL',
44
+ UAE_VISA: 'UAE_VISA',
45
+ UAE_VL: 'UAE_VL',
46
+ QAT_ID: 'QAT_ID',
47
+ NLD_DL: 'NLD_DL',
48
+ DEU_ID: 'DEU_ID',
49
+ SDN_ID: 'SDN_ID',
50
+ SDN_DL: 'SDN_DL',
51
+ SDN_VL: 'SDN_VL',
52
+ GHA_ID: 'GHA_ID',
53
+ NGA_DL: 'NGA_DL',
54
+ NGA_VOTER_ID: 'NGA_VOTER_ID',
55
+ NGA_NIN: 'NGA_NIN',
56
+ GBR_DL: 'GBR_DL',
57
+ SAU_DL: 'SAU_DL',
58
+ ZAF_ID: 'ZAF_ID',
59
+ ZAF_DL: 'ZAF_DL',
60
+ EGY_ID: 'EGY_ID',
61
+ RWA_ID: 'RWA_ID',
62
+ KEN_ID: 'KEN_ID',
63
+ GHA_DL: 'GHA_DL',
64
+ GHA_VOTER_ID: 'GHA_VOTER_ID',
65
+ GHA_SSNIT: 'GHA_SSNIT',
66
+ UGA_ID: 'UGA_ID',
67
+ IND_ID: 'IND_ID',
68
+ OMN_ID_NATIONAL: 'OMN_ID_NATIONAL',
69
+ OMN_ID_RESIDENT: 'OMN_ID_RESIDENT',
70
+ SEN_ID: 'SEN_ID',
71
+ UGA_VOTER_ID: 'UGA_VOTER_ID'
72
+ }
73
+ );
74
+
75
+ export const BackgroundCheckType = Object.freeze(
76
+ {
77
+ RDC: 'RDC',
78
+ DOW_JONES: 'DOW_JONES'
79
+ }
80
+ );
81
+
82
+ export const AppearanceMode = Object.freeze(
83
+ {
84
+ SYSTEM: 'SYSTEM',
85
+ LIGHT: 'LIGHT',
86
+ DARK: 'DARK'
87
+ }
88
+ );
89
+
90
+ export class Enrollment {
91
+ constructor(documentList, authorizationToken, nonce,
92
+ isRootedDeviceAllowed, isSecuredWindowsDisabled, facialRecognitionSpecification,
93
+ backgroundCheckConfiguration, lookupConfiguration, sessionId, userIdentifier, isReturnDataForIncompleteSession, appearanceMode) {
94
+ this.documentList = documentList;
95
+ this.authorizationToken = authorizationToken;
96
+ this.nonce = nonce;
97
+ this.isRootedDeviceAllowed = isRootedDeviceAllowed;
98
+ this.isSecuredWindowsDisabled = isSecuredWindowsDisabled;
99
+ this.facialRecognitionSpecification = facialRecognitionSpecification;
100
+ this.backgroundCheckConfiguration = backgroundCheckConfiguration;
101
+ this.lookupConfiguration = lookupConfiguration;
102
+ this.sessionId = sessionId;
103
+ this.userIdentifier = userIdentifier;
104
+ this.isReturnDataForIncompleteSession = isReturnDataForIncompleteSession;
105
+ this.appearanceMode = appearanceMode;
106
+ }
107
+ }
108
+
109
+ export class EnrollmentBuilder {
110
+ setToken(token) {
111
+ this.authorizationToken = token;
112
+ return this;
113
+ }
114
+
115
+ setNonce(nonce) {
116
+ this.nonce = nonce;
117
+ return this;
118
+ }
119
+
120
+ setSessionId(sessionId) {
121
+ this.sessionId = sessionId;
122
+ return this;
123
+ }
124
+
125
+ setUserIdentifier(userIdentifier) {
126
+ this.userIdentifier = userIdentifier;
127
+ return this;
128
+ }
129
+
130
+ setAppearanceMode(appearanceMode) {
131
+ this.appearanceMode = appearanceMode;
132
+ return this;
133
+ }
134
+
135
+ enableRootedDeviceUsage() {
136
+ this.isRootedDeviceAllowed = true;
137
+ return this;
138
+ }
139
+
140
+ disableSecureWindow() {
141
+ this.isSecuredWindowsDisabled = true;
142
+ return this;
143
+ }
144
+
145
+ enableFacialRecognition() {
146
+ if (arguments.length === 0) {
147
+ this.facialRecognitionSpecification = new FacialRecognitionConfigurationBuilder().build();
148
+ } else {
149
+ this.facialRecognitionSpecification = arguments[0];
150
+ }
151
+ return this;
152
+ }
153
+
154
+ enableBackgroundCheck() {
155
+ if (arguments.length === 0) {
156
+ this.backgroundCheckConfiguration = new BackgroundCheckConfigurationBuilder().build();
157
+ } else {
158
+ this.backgroundCheckConfiguration = arguments[0];
159
+ }
160
+ return this;
161
+ }
162
+
163
+ returnDataForIncompleteSession() {
164
+ this.isReturnDataForIncompleteSession = true;
165
+ return this;
166
+ }
167
+
168
+ enableLookup() {
169
+ if (arguments.length === 0) {
170
+ this.lookupConfiguration = new LookupConfiguration([]);
171
+ } else {
172
+ this.lookupConfiguration = new LookupConfiguration(arguments[0]);
173
+ }
174
+ return this;
175
+ }
176
+
177
+ add(document) {
178
+ if (this.documentList == null) {
179
+ this.documentList = new Array();
180
+ }
181
+ this.documentList.push(document);
182
+ return this;
183
+ }
184
+
185
+ build() {
186
+ return new Enrollment(this.documentList, this.authorizationToken, this.nonce,
187
+ this.isRootedDeviceAllowed, this.isSecuredWindowsDisabled, this.facialRecognitionSpecification,
188
+ this.backgroundCheckConfiguration, this.lookupConfiguration, this.sessionId, this.userIdentifier, this.isReturnDataForIncompleteSession,
189
+ this.appearanceMode);
190
+ }
191
+ }
192
+
193
+ export class FacialRecognitionConfigurationBuilder {
194
+ constructor() {
195
+ this.enrollFace = false;
196
+
197
+ return {
198
+ enrollFace: function () {
199
+ this.enrollFace = true;
200
+ return this;
201
+ },
202
+
203
+ setScanMinimumMatchLevel: function (scanMinimumMatchLevel) {
204
+ this.scanMinimumMatchLevel = scanMinimumMatchLevel;
205
+ return this;
206
+ },
207
+
208
+ setReadMinimumMatchLevel: function (readMinimumMatchLevel) {
209
+ this.readMinimumMatchLevel = readMinimumMatchLevel;
210
+ return this;
211
+ },
212
+
213
+ setMaxAttempts: function (maxAttempts) {
214
+ this.maxAttempts = maxAttempts;
215
+ return this;
216
+ },
217
+
218
+ build: function () {
219
+ return new FacialRecognitionConfiguration(this.enrollFace, this.scanMinimumMatchLevel, this.readMinimumMatchLevel, this.maxAttempts);
220
+ }
221
+ };
222
+ }
223
+ }
224
+
225
+
226
+ export class FacialRecognitionConfiguration {
227
+ constructor(enrollFace, scanMinimumMatchLevel, readMinimumMatchLevel, maxAttempts) {
228
+ this.enrollFace = enrollFace;
229
+ this.scanMinimumMatchLevel = scanMinimumMatchLevel;
230
+ this.readMinimumMatchLevel = readMinimumMatchLevel;
231
+ this.maxAttempts = maxAttempts;
232
+ }
233
+ }
234
+
235
+
236
+ export class BackgroundCheckConfigurationBuilder {
237
+ constructor() {
238
+ this.disableConsent = false;
239
+ this.backgroundCheckType = BackgroundCheckType.RDC;
240
+ this.monitoringEnabled = false;
241
+ this.skipView = false;
242
+
243
+ return {
244
+ disableConsent: function () {
245
+ this.disableConsent = true;
246
+ return this;
247
+ },
248
+
249
+ enableMonitoring: function () {
250
+ this.monitoringEnabled = true;
251
+ return this;
252
+ },
253
+
254
+ setBackgroundCheckType: function (backgroundCheckType) {
255
+ this.backgroundCheckType = backgroundCheckType;
256
+ return this;
257
+ },
258
+
259
+ skipView: function () {
260
+ this.skipView = true;
261
+ return this;
262
+ },
263
+
264
+ build: function () {
265
+ return new BackgroundCheckConfiguration(this.disableConsent, this.backgroundCheckType, this.monitoringEnabled, this.skipView);
266
+ }
267
+ };
268
+ }
269
+ }
270
+
271
+ export class LookupConfiguration {
272
+ constructor(documents) {
273
+ this.documentList = documents;
274
+ }
275
+ }
276
+
277
+ export class BackgroundCheckConfiguration {
278
+ constructor(disableConsent, backgroundCheckType, monitoringEnabled, skipView) {
279
+ this.disableConsent = disableConsent;
280
+ this.backgroundCheckType = backgroundCheckType;
281
+ this.monitoringEnabled = monitoringEnabled;
282
+ this.skipView = skipView;
283
+ }
284
+ }
285
+
286
+ export class DocumentBuilder {
287
+ constructor() {
288
+ return {
289
+ setDocumentType: function (documentType) {
290
+ this.documentType = documentType;
291
+ return this;
292
+ },
293
+
294
+ disableHelpPage: function () {
295
+ this.isHelpPageDisabled = true;
296
+ return this;
297
+ },
298
+
299
+ disableExpiryValidation: function () {
300
+ this.isExpiredDocumentAllowed = true;
301
+ return this;
302
+ },
303
+
304
+ enableReading: function () {
305
+ if (arguments.length === 0) {
306
+ this.readingConfiguration = new ReadingConfigurationBuilder().build();
307
+ } else {
308
+ this.readingConfiguration = arguments[0];
309
+ }
310
+ return this;
311
+ },
312
+
313
+ disableUserDataReview: function () {
314
+ this.isUserDataReviewDisabled = true;
315
+ return this;
316
+ },
317
+
318
+ setFaceScanMinimumMatchLevel: function (faceScanMinimumMatchLevel) {
319
+ this.faceScanMinimumMatchLevel = faceScanMinimumMatchLevel;
320
+ return this;
321
+ },
322
+
323
+ setFaceReadMinimumMatchLevel: function (faceReadMinimumMatchLevel) {
324
+ this.faceReadMinimumMatchLevel = faceReadMinimumMatchLevel;
325
+ return this;
326
+ },
327
+
328
+ enableScanReview: function (isFrontSideReviewEnabled, isBackSideReviewEnabled) {
329
+ this.isBackSideReviewEnabled = isBackSideReviewEnabled;
330
+ this.isFrontSideReviewEnabled = isFrontSideReviewEnabled;
331
+ return this;
332
+ },
333
+
334
+ enableUpload: function () {
335
+ this.isUploadEnabled = true;
336
+ return this;
337
+ },
338
+
339
+ /**
340
+ * @deprecated Ignored and enabled by default. Will be removed in a future release
341
+ */
342
+ enablePhotoQualityDetection: function () {
343
+ this.isPhotoQualityDetectionEnabled = true;
344
+ return this;
345
+ },
346
+
347
+ enableAgeVerification: function (minAge) {
348
+ this.minimumAge = minAge;
349
+ return this;
350
+ },
351
+
352
+ build: function () {
353
+ return new Document(this.documentType,
354
+ this.readingConfiguration,
355
+ this.isHelpPageDisabled,
356
+ this.faceScanMinimumMatchLevel,
357
+ this.faceReadMinimumMatchLevel,
358
+ this.isExpiredDocumentAllowed,
359
+ this.isUserDataReviewDisabled,
360
+ this.isFrontSideReviewEnabled,
361
+ this.isBackSideReviewEnabled,
362
+ this.isUploadEnabled,
363
+ this.isPhotoQualityDetectionEnabled,
364
+ this.minimumAge);
365
+ }
366
+ };
367
+ }
368
+ }
369
+
370
+ export class ReadingConfigurationBuilder {
371
+ constructor() {
372
+ this.forceReadingValue = false;
373
+ this.forceReadingIfSupportedValue = false;
374
+ this.timeoutInSeconds = -1;
375
+ return {
376
+ forceReading: function (value) {
377
+ this.forceReadingValue = value;
378
+ return this;
379
+ },
380
+
381
+ forceReadingIfSupported: function (value) {
382
+ this.forceReadingIfSupportedValue = value;
383
+ return this;
384
+ },
385
+
386
+ forceReadingTimeout: function (value) {
387
+ this.timeoutInSecondsValue = value;
388
+ return this;
389
+ },
390
+
391
+ build: function () {
392
+ return new ReadingConfiguration(this.forceReadingValue, this.forceReadingIfSupportedValue, this.timeoutInSecondsValue);
393
+ }
394
+ };
395
+ }
396
+ }
397
+
398
+ export class ReadingConfiguration {
399
+ constructor(forceReading, forceReadingIfSupported, timeoutInSeconds) {
400
+ this.forceReading = forceReading;
401
+ this.forceReadingIfSupported = forceReadingIfSupported;
402
+ this.timeoutInSeconds = timeoutInSeconds;
403
+ }
404
+ }
405
+
406
+ export class Document {
407
+ constructor(documentType, readingConfiguration, isHelpPageDisabled,
408
+ faceScanMinimumMatchLevel, faceReadMinimumMatchLevel, isExpiredDocumentValidateDisabled,
409
+ isUserDataReviewDisabled, isFrontSideReviewEnabled, isBackSideReviewEnabled,
410
+ isUploadEnabled, isPhotoQualityDetectionEnabled,minimumAge) {
411
+ this.documentType = documentType;
412
+ this.readingConfiguration = readingConfiguration;
413
+ this.isHelpPageDisabled = isHelpPageDisabled;
414
+ this.faceScanMinimumMatchLevel = faceScanMinimumMatchLevel;
415
+ this.faceReadMinimumMatchLevel = faceReadMinimumMatchLevel;
416
+ this.isExpiredDocumentValidateDisabled = isExpiredDocumentValidateDisabled;
417
+ this.isUserDataReviewDisabled = isUserDataReviewDisabled;
418
+ this.isFrontSideReviewEnabled = isFrontSideReviewEnabled;
419
+ this.isBackSideReviewEnabled = isBackSideReviewEnabled;
420
+ this.isUploadEnabled = isUploadEnabled;
421
+ this.isPhotoQualityDetectionEnabled = isPhotoQualityDetectionEnabled;
422
+ this.minimumAge = minimumAge;
423
+ }
424
+ }
425
+
426
+ export class AccountRecoveryBuilder {
427
+ constructor() {
428
+ return {
429
+ /**
430
+ * Pass the token received from Uqudo to authenticate the SDK
431
+ */
432
+ setToken: function (token) {
433
+ this.authorizationToken = token;
434
+ return this;
435
+ },
436
+
437
+ /**
438
+ * Pass the enrollment identifier for the account to be recovered
439
+ */
440
+ setEnrollmentIdentifier: function (identifier) {
441
+ this.enrollmentIdentifier = identifier;
442
+ return this;
443
+ },
444
+
445
+ /**
446
+ * You can pass your custom nonce to provide security to the enrollment process
447
+ */
448
+ setNonce: function (nonce) {
449
+ this.nonce = nonce;
450
+ return this;
451
+ },
452
+
453
+ /**
454
+ * Whether you want the sdk to run on the rooted devices or not. By default it is false
455
+ */
456
+ enableRootedDeviceUsage: function () {
457
+ this.isRootedDeviceAllowed = true;
458
+ return this;
459
+ },
460
+
461
+ /**
462
+ * To allow user to capture/record screenshot or video of the screen on the device app is installed.
463
+ * Default is screenshot and video recording of the screen is not allowed
464
+ */
465
+ disableSecureWindow: function () {
466
+ this.isSecuredWindowsDisabled = true;
467
+ return this;
468
+ },
469
+
470
+ /**
471
+ * Set this to use the value passed for facialRecognition for Account Recovery
472
+ */
473
+ setMinimumMatchLevel: function (value) {
474
+ this.minimumMatchLevel = value;
475
+ return this;
476
+ },
477
+
478
+ setMaxAttempts: function (maxAttempts) {
479
+ this.maxAttempts = maxAttempts;
480
+ return this;
481
+ },
482
+
483
+ returnDataForIncompleteSession: function () {
484
+ this.isReturnDataForIncompleteSession = true;
485
+ return this;
486
+ },
487
+
488
+ setAppearanceMode: function (appearanceMode) {
489
+ this.appearanceMode = appearanceMode;
490
+ return this;
491
+ },
492
+
493
+ /**
494
+ * @returns Intent with the configuration and the token needed to authorize the activity to
495
+ * recover the account
496
+ */
497
+ build: function () {
498
+ return new AccountRecoveryConfiguration(this.authorizationToken, this.enrollmentIdentifier, this.nonce, this.isRootedDeviceAllowed, this.isSecuredWindowsDisabled, this.minimumMatchLevel, this.maxAttempts, this.isReturnDataForIncompleteSession, this.appearanceMode);
499
+ }
500
+ }
501
+ }
502
+ }
503
+
504
+ export class AccountRecoveryConfiguration {
505
+ constructor(token, enrollmentIdentifier, nonce, isRootedDeviceAllowed, isSecuredWindowsDisabled, minimumMatchLevel,maxAttempts,isReturnDataForIncompleteSession,appearanceMode) {
506
+ this.token = token;
507
+ this.enrollmentIdentifier = enrollmentIdentifier;
508
+ this.nonce = nonce;
509
+ this.isRootedDeviceAllowed = isRootedDeviceAllowed;
510
+ this.isSecuredWindowsDisabled = isSecuredWindowsDisabled;
511
+ this.minimumMatchLevel = minimumMatchLevel;
512
+ this.maxAttempts = maxAttempts;
513
+ this.isReturnDataForIncompleteSession = isReturnDataForIncompleteSession;
514
+ this.appearanceMode = appearanceMode;
515
+ }
516
+ }
517
+
518
+ export class FaceSessionBuilder {
519
+ constructor() {
520
+ return {
521
+ setToken: function (token) {
522
+ this.authorizationToken = token;
523
+ return this;
524
+ },
525
+
526
+ setSessionId: function (sessionId) {
527
+ this.sessionId = sessionId;
528
+ return this;
529
+ },
530
+
531
+ setNonce: function (nonce) {
532
+ this.nonce = nonce;
533
+ return this;
534
+ },
535
+
536
+ enableRootedDeviceUsage: function () {
537
+ this.isRootedDeviceAllowed = true;
538
+ return this;
539
+ },
540
+
541
+ disableSecureWindow: function () {
542
+ this.isSecuredWindowsDisabled = true;
543
+ return this;
544
+ },
545
+
546
+ setMinimumMatchLevel: function (value) {
547
+ this.minimumMatchLevel = value;
548
+ return this;
549
+ },
550
+
551
+ setMaxAttempts: function (maxAttempts) {
552
+ this.maxAttempts = maxAttempts;
553
+ return this;
554
+ },
555
+
556
+ returnDataForIncompleteSession: function () {
557
+ this.isReturnDataForIncompleteSession = true;
558
+ return this;
559
+ },
560
+
561
+ setAppearanceMode: function (appearanceMode) {
562
+ this.appearanceMode = appearanceMode;
563
+ return this;
564
+ },
565
+
566
+
567
+ build: function () {
568
+ return new FaceSessionConfiguration(this.authorizationToken, this.sessionId, this.nonce, this.isRootedDeviceAllowed, this.isSecuredWindowsDisabled, this.minimumMatchLevel, this.maxAttempts, this.isReturnDataForIncompleteSession, this.appearanceMode);
569
+ }
570
+ }
571
+ }
572
+ }
573
+
574
+ export class FaceSessionConfiguration {
575
+ constructor(token, sessionId, nonce, isRootedDeviceAllowed, isSecuredWindowsDisabled, minimumMatchLevel,maxAttempts,isReturnDataForIncompleteSession,appearanceMode) {
576
+ this.token = token;
577
+ this.sessionId = sessionId;
578
+ this.nonce = nonce;
579
+ this.isRootedDeviceAllowed = isRootedDeviceAllowed;
580
+ this.isSecuredWindowsDisabled = isSecuredWindowsDisabled;
581
+ this.minimumMatchLevel = minimumMatchLevel;
582
+ this.maxAttempts = maxAttempts;
583
+ this.isReturnDataForIncompleteSession = isReturnDataForIncompleteSession;
584
+ this.appearanceMode = appearanceMode;
585
+
586
+ }
587
+ }
@@ -0,0 +1,17 @@
1
+ require "json"
2
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
3
+ Pod::Spec.new do |s|
4
+ s.name = package["name"]
5
+ s.version = package["version"]
6
+ s.description = package["description"]
7
+ s.summary = package["description"]
8
+ s.license = "MIT"
9
+ s.homepage = 'https://uqu.do'
10
+ s.platforms = { :ios => "9.0" }
11
+ s.source_files = "ios/*.{h,c,m,swift}"
12
+ s.author = { 'uqudo' => 'hello@uqu.do' }
13
+ s.source = { :http => 'https://uqudo.com' }
14
+ s.header_dir = 'UqudoSDK'
15
+ s.dependency 'React'
16
+ s.dependency 'UqudoSDK', '2.2.1'
17
+ end