@regulaforensics/idv 3.2.1-nightly

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 (140) hide show
  1. package/README.md +30 -0
  2. package/RNIDV.podspec +21 -0
  3. package/android/CVDIDV.kt +48 -0
  4. package/android/build.gradle +32 -0
  5. package/android/cordova.gradle +20 -0
  6. package/android/src/main/java/com/regula/plugin/idv/JSONConstructor.kt +135 -0
  7. package/android/src/main/java/com/regula/plugin/idv/Main.kt +124 -0
  8. package/android/src/main/java/com/regula/plugin/idv/RNIDVModule.kt +71 -0
  9. package/android/src/main/java/com/regula/plugin/idv/Utils.kt +60 -0
  10. package/examples/capacitor/README.md +15 -0
  11. package/examples/capacitor/android/app/build.gradle +50 -0
  12. package/examples/capacitor/android/app/capacitor.build.gradle +22 -0
  13. package/examples/capacitor/android/app/proguard-rules.pro +21 -0
  14. package/examples/capacitor/android/app/src/main/AndroidManifest.xml +26 -0
  15. package/examples/capacitor/android/app/src/main/assets/Regula/.gitkeep +0 -0
  16. package/examples/capacitor/android/app/src/main/java/com/regula/example/idv/capacitor/MainActivity.java +5 -0
  17. package/examples/capacitor/android/app/src/main/res/drawable/ic_launcher.png +0 -0
  18. package/examples/capacitor/android/app/src/main/res/drawable/ic_launcher_foreground.png +0 -0
  19. package/examples/capacitor/android/app/src/main/res/drawable/ic_launcher_round.png +0 -0
  20. package/examples/capacitor/android/app/src/main/res/drawable/launcher.xml +4 -0
  21. package/examples/capacitor/android/app/src/main/res/drawable/launcher_round.xml +4 -0
  22. package/examples/capacitor/android/app/src/main/res/drawable/splash.png +0 -0
  23. package/examples/capacitor/android/app/src/main/res/layout/activity_main.xml +12 -0
  24. package/examples/capacitor/android/app/src/main/res/values/styles.xml +22 -0
  25. package/examples/capacitor/android/build.gradle +30 -0
  26. package/examples/capacitor/android/capacitor.settings.gradle +15 -0
  27. package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  28. package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  29. package/examples/capacitor/android/gradle.properties +22 -0
  30. package/examples/capacitor/android/gradlew +252 -0
  31. package/examples/capacitor/android/gradlew.bat +94 -0
  32. package/examples/capacitor/android/settings.gradle +5 -0
  33. package/examples/capacitor/android/variables.gradle +16 -0
  34. package/examples/capacitor/index.html +5 -0
  35. package/examples/capacitor/index.tsx +16 -0
  36. package/examples/capacitor/ionic.config.json +7 -0
  37. package/examples/capacitor/ios/App/App/App.entitlements +10 -0
  38. package/examples/capacitor/ios/App/App/AppDelegate.swift +49 -0
  39. package/examples/capacitor/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png +0 -0
  40. package/examples/capacitor/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
  41. package/examples/capacitor/ios/App/App/Assets.xcassets/Contents.json +6 -0
  42. package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json +23 -0
  43. package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
  44. package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
  45. package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
  46. package/examples/capacitor/ios/App/App/Base.lproj/LaunchScreen.storyboard +32 -0
  47. package/examples/capacitor/ios/App/App/Base.lproj/Main.storyboard +19 -0
  48. package/examples/capacitor/ios/App/App/Info.plist +65 -0
  49. package/examples/capacitor/ios/App/App.xcodeproj/project.pbxproj +418 -0
  50. package/examples/capacitor/ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  51. package/examples/capacitor/ios/App/App.xcworkspace/contents.xcworkspacedata +10 -0
  52. package/examples/capacitor/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  53. package/examples/capacitor/ios/App/Podfile +26 -0
  54. package/examples/capacitor/package-lock.json +3350 -0
  55. package/examples/capacitor/package.json +27 -0
  56. package/examples/capacitor/public/assets/.gitkeep +0 -0
  57. package/examples/capacitor/scripts/android.sh +9 -0
  58. package/examples/capacitor/scripts/ios.sh +8 -0
  59. package/examples/capacitor/scripts/setup.sh +14 -0
  60. package/examples/capacitor/src/main.css +148 -0
  61. package/examples/capacitor/src/main.html +17 -0
  62. package/examples/capacitor/src/main.tsx +124 -0
  63. package/examples/capacitor/tsconfig.json +5 -0
  64. package/examples/capacitor/vite.config.ts +17 -0
  65. package/examples/ionic/README.md +15 -0
  66. package/examples/ionic/angular.json +39 -0
  67. package/examples/ionic/assets/.gitkeep +0 -0
  68. package/examples/ionic/config.xml +60 -0
  69. package/examples/ionic/images/icon.png +0 -0
  70. package/examples/ionic/index.html +19 -0
  71. package/examples/ionic/index.tsx +32 -0
  72. package/examples/ionic/ionic.config.json +7 -0
  73. package/examples/ionic/package-lock.json +14261 -0
  74. package/examples/ionic/package.json +46 -0
  75. package/examples/ionic/scripts/android.sh +8 -0
  76. package/examples/ionic/scripts/ios.sh +8 -0
  77. package/examples/ionic/scripts/setup.sh +8 -0
  78. package/examples/ionic/src/main.css +148 -0
  79. package/examples/ionic/src/main.html +17 -0
  80. package/examples/ionic/src/main.tsx +124 -0
  81. package/examples/ionic/tsconfig.json +14 -0
  82. package/examples/react_native/README.md +15 -0
  83. package/examples/react_native/app.config.ts +46 -0
  84. package/examples/react_native/assets/.gitkeep +0 -0
  85. package/examples/react_native/images/icon.png +0 -0
  86. package/examples/react_native/index.html +12 -0
  87. package/examples/react_native/index.tsx +63 -0
  88. package/examples/react_native/metro.config.js +7 -0
  89. package/examples/react_native/package-lock.json +8996 -0
  90. package/examples/react_native/package.json +29 -0
  91. package/examples/react_native/scripts/android.sh +13 -0
  92. package/examples/react_native/scripts/ios.sh +12 -0
  93. package/examples/react_native/scripts/setup.sh +12 -0
  94. package/examples/react_native/src/main.css +148 -0
  95. package/examples/react_native/src/main.html +17 -0
  96. package/examples/react_native/src/main.tsx +124 -0
  97. package/ios/CVDIDV.swift +51 -0
  98. package/ios/JSONConstructor.swift +132 -0
  99. package/ios/Main.swift +91 -0
  100. package/ios/RNIDV.m +11 -0
  101. package/ios/RNIDV.swift +47 -0
  102. package/ios/Utils.swift +52 -0
  103. package/package.json +38 -0
  104. package/plugin.xml +46 -0
  105. package/test/json.tsx +40 -0
  106. package/test/package-lock.json +584 -0
  107. package/test/package.json +9 -0
  108. package/test/test.tsx +13 -0
  109. package/test/utils.tsx +38 -0
  110. package/www/capacitor/config/api_key_connection_config.js +32 -0
  111. package/www/capacitor/config/credentials_connection_config.js +32 -0
  112. package/www/capacitor/config/prepare_workflow_config.js +20 -0
  113. package/www/capacitor/config/start_workflow_config.js +24 -0
  114. package/www/capacitor/config/token_connection_config.js +20 -0
  115. package/www/capacitor/index.js +110 -0
  116. package/www/capacitor/internal/bridge.js +30 -0
  117. package/www/capacitor/internal/cordova.js +17 -0
  118. package/www/capacitor/model/workflow.js +28 -0
  119. package/www/capacitor/model/workflow_result.js +21 -0
  120. package/www/capacitor/model/workflow_step.js +19 -0
  121. package/www/cordova.js +595 -0
  122. package/www/react-native/config/api_key_connection_config.js +32 -0
  123. package/www/react-native/config/credentials_connection_config.js +32 -0
  124. package/www/react-native/config/prepare_workflow_config.js +20 -0
  125. package/www/react-native/config/start_workflow_config.js +24 -0
  126. package/www/react-native/config/token_connection_config.js +20 -0
  127. package/www/react-native/index.js +110 -0
  128. package/www/react-native/internal/bridge.js +30 -0
  129. package/www/react-native/model/workflow.js +28 -0
  130. package/www/react-native/model/workflow_result.js +21 -0
  131. package/www/react-native/model/workflow_step.js +19 -0
  132. package/www/types/config/api_key_connection_config.d.ts +6 -0
  133. package/www/types/config/credentials_connection_config.d.ts +6 -0
  134. package/www/types/config/prepare_workflow_config.d.ts +3 -0
  135. package/www/types/config/start_workflow_config.d.ts +4 -0
  136. package/www/types/config/token_connection_config.d.ts +3 -0
  137. package/www/types/index.d.ts +62 -0
  138. package/www/types/model/workflow.d.ts +9 -0
  139. package/www/types/model/workflow_result.d.ts +8 -0
  140. package/www/types/model/workflow_step.d.ts +6 -0
@@ -0,0 +1,32 @@
1
+ export class CredentialsConnectionConfig {
2
+ baseUrl
3
+ userName
4
+ password
5
+ httpTimeoutMs
6
+
7
+ constructor(params) {
8
+ this.baseUrl = params?.baseUrl
9
+ this.userName = params?.userName
10
+ this.password = params?.password
11
+ this.httpTimeoutMs = params?.httpTimeoutMs
12
+ }
13
+
14
+ static fromJson(jsonObject) {
15
+ if (jsonObject == null) return null
16
+ const result = new CredentialsConnectionConfig()
17
+ result.baseUrl = jsonObject["baseUrl"]
18
+ result.userName = jsonObject["userName"]
19
+ result.password = jsonObject["password"]
20
+ result.httpTimeoutMs = jsonObject["httpTimeoutMs"]
21
+ return result
22
+ }
23
+
24
+ toJson() {
25
+ return {
26
+ "baseUrl": this.baseUrl,
27
+ "userName": this.userName,
28
+ "password": this.password,
29
+ "httpTimeoutMs": this.httpTimeoutMs,
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,20 @@
1
+ export class PrepareWorkflowConfig {
2
+ workflowId
3
+
4
+ constructor(params) {
5
+ this.workflowId = params?.workflowId
6
+ }
7
+
8
+ static fromJson(jsonObject) {
9
+ if (jsonObject == null) return null
10
+ const result = new PrepareWorkflowConfig()
11
+ result.workflowId = jsonObject["workflowId"]
12
+ return result
13
+ }
14
+
15
+ toJson() {
16
+ return {
17
+ "workflowId": this.workflowId,
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,24 @@
1
+ export class StartWorkflowConfig {
2
+ locale
3
+ metadata
4
+
5
+ constructor(params) {
6
+ this.locale = params?.locale
7
+ this.metadata = params?.metadata
8
+ }
9
+
10
+ static fromJson(jsonObject) {
11
+ if (jsonObject == null) return null
12
+ const result = new StartWorkflowConfig()
13
+ result.locale = jsonObject["locale"]
14
+ result.metadata = jsonObject["metadata"]
15
+ return result
16
+ }
17
+
18
+ toJson() {
19
+ return {
20
+ "locale": this.locale,
21
+ "metadata": this.metadata,
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,20 @@
1
+ export class TokenConnectionConfig {
2
+ url
3
+
4
+ constructor(params) {
5
+ this.url = params?.url
6
+ }
7
+
8
+ static fromJson(jsonObject) {
9
+ if (jsonObject == null) return null
10
+ const result = new TokenConnectionConfig()
11
+ result.url = jsonObject["url"]
12
+ return result
13
+ }
14
+
15
+ toJson() {
16
+ return {
17
+ "url": this.url,
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,110 @@
1
+ import { exec, setDidStartSessionCompletion, setDidEndSessionCompletion, setDidStartRestoreSessionCompletion, setDidContinueRemoteSessionCompletion } from './internal/bridge'
2
+
3
+ import { TokenConnectionConfig } from './config/token_connection_config'
4
+ import { CredentialsConnectionConfig } from './config/credentials_connection_config'
5
+ import { ApiKeyConnectionConfig } from './config/api_key_connection_config'
6
+ import { PrepareWorkflowConfig } from './config/prepare_workflow_config'
7
+ import { StartWorkflowConfig } from './config/start_workflow_config'
8
+ import { Workflow } from './model/workflow'
9
+ import { WorkflowResult } from './model/workflow_result'
10
+
11
+ export { TokenConnectionConfig }
12
+ export { CredentialsConnectionConfig }
13
+ export { ApiKeyConnectionConfig }
14
+ export { PrepareWorkflowConfig }
15
+ export { StartWorkflowConfig }
16
+ export { Workflow }
17
+ export { WorkflowResult }
18
+ export { WorkflowStep } from './model/workflow_step'
19
+
20
+ export class IDV {
21
+ static get instance() { return IDV._instance }
22
+ static _instance = new IDV()
23
+
24
+ setListener(options) {
25
+ const value = options ?? {}
26
+ setDidStartSessionCompletion(value.didStartSession)
27
+ setDidEndSessionCompletion(value.didEndSession)
28
+ setDidStartRestoreSessionCompletion(value.didStartRestoreSession)
29
+ setDidContinueRemoteSessionCompletion(value.didContinueRemoteSession)
30
+ }
31
+
32
+ set sessionRestoreMode(val) {
33
+ exec('setSessionRestoreMode', [val])
34
+ }
35
+
36
+ async getCurrentSessionId() {
37
+ return await exec('getCurrentSessionId', [])
38
+ }
39
+
40
+ async initialize() {
41
+ const response = await exec('initialize', [])
42
+ return completionFromResponse(response)
43
+ }
44
+
45
+ async deinitialize() {
46
+ const response = await exec('deinitialize', [])
47
+ return completionFromResponse(response)
48
+ }
49
+
50
+ async configureWithToken(config) {
51
+ config = ensureInstance(config, TokenConnectionConfig)
52
+ const response = await exec('configureWithToken', [config?.toJson()])
53
+ return completionFromResponse(response, success => success?.map(item => String(item)))
54
+ }
55
+
56
+ async configureWithCredentials(config) {
57
+ config = ensureInstance(config, CredentialsConnectionConfig)
58
+ const response = await exec('configureWithCredentials', [config?.toJson()])
59
+ return completionFromResponse(response)
60
+ }
61
+
62
+ async configureWithApiKey(config) {
63
+ config = ensureInstance(config, ApiKeyConnectionConfig)
64
+ const response = await exec('configureWithApiKey', [config?.toJson()])
65
+ return completionFromResponse(response)
66
+ }
67
+
68
+ async prepareWorkflow(config) {
69
+ config = ensureInstance(config, PrepareWorkflowConfig)
70
+ const response = await exec('prepareWorkflow', [config?.toJson()])
71
+ return completionFromResponse(response, json => Workflow.fromJson(json))
72
+ }
73
+
74
+ async startWorkflow(config) {
75
+ config = ensureInstance(config, StartWorkflowConfig)
76
+ const response = await exec('startWorkflow', [config?.toJson()])
77
+ return completionFromResponse(response, json => WorkflowResult.fromJson(json))
78
+ }
79
+
80
+ async getWorkflows() {
81
+ const response = await exec('getWorkflows', [])
82
+ return completionFromResponse(response, json => {
83
+ const result = []
84
+ if (json != null) for (const item of json) {
85
+ const workflow = Workflow.fromJson(item)
86
+ if (workflow != null) result.push(workflow)
87
+ }
88
+ return result
89
+ })
90
+ }
91
+ }
92
+
93
+ export const SessionRestoreMode = {
94
+ ENABLED: 0,
95
+ DISABLED: 1,
96
+ }
97
+
98
+ function completionFromResponse(response, transform) {
99
+ const jsonObject = JSON.parse(response)
100
+ let success = jsonObject['success']
101
+ const error = jsonObject['error']
102
+ if (transform != null && success != null) success = transform(success)
103
+ return [success, error]
104
+ }
105
+
106
+ function ensureInstance(value, ctor) {
107
+ if (value == null) return null
108
+ if (value instanceof ctor) return value
109
+ return new ctor(value)
110
+ }
@@ -0,0 +1,30 @@
1
+ import { NativeModules, NativeEventEmitter } from './cordova'
2
+
3
+ const { RNIDV } = NativeModules
4
+ var eventManager = new NativeEventEmitter(RNIDV)
5
+
6
+ export async function exec(name, params) {
7
+ return RNIDV.exec(name, params)
8
+ }
9
+
10
+ function setEvent(id, completion, transform) {
11
+ eventManager.removeAllListeners(id)
12
+ if (transform === undefined) transform = func => func
13
+ if (completion !== undefined) eventManager.addListener(id, transform(completion))
14
+ }
15
+
16
+ export function setDidStartSessionCompletion(completion) {
17
+ setEvent('didStartSessionEvent', completion)
18
+ }
19
+
20
+ export function setDidEndSessionCompletion(completion) {
21
+ setEvent('didEndSessionEvent', completion)
22
+ }
23
+
24
+ export function setDidStartRestoreSessionCompletion(completion) {
25
+ setEvent('didStartRestoreSessionEvent', completion)
26
+ }
27
+
28
+ export function setDidContinueRemoteSessionCompletion(completion) {
29
+ setEvent('didContinueRemoteSessionEvent', completion)
30
+ }
@@ -0,0 +1,17 @@
1
+ var _exec = (completion, params) => cordova.exec(completion, null, "IDV", "exec", params)
2
+
3
+ export const NativeModules = {
4
+ RNIDV: {
5
+ exec: async (name, params) => new Promise((resolve, _) => _exec(data => resolve(data), [name, ...params]))
6
+ }
7
+ }
8
+
9
+ export class NativeEventEmitter {
10
+ addListener(id, completion) {
11
+ _exec(completion, ["setEvent", id])
12
+ }
13
+
14
+ removeAllListeners(id) {
15
+ _exec(null, ["setEvent", id])
16
+ }
17
+ }
@@ -0,0 +1,28 @@
1
+ export class Workflow {
2
+ id
3
+ name
4
+ description
5
+ version
6
+ defaultLocale
7
+
8
+ static fromJson(jsonObject) {
9
+ if (jsonObject == null) return null
10
+ const result = new Workflow()
11
+ result.id = jsonObject["id"]
12
+ result.name = jsonObject["name"]
13
+ result.description = jsonObject["description"]
14
+ result.version = jsonObject["version"]
15
+ result.defaultLocale = jsonObject["defaultLocale"]
16
+ return result
17
+ }
18
+
19
+ toJson() {
20
+ return {
21
+ "id": this.id,
22
+ "name": this.name,
23
+ "description": this.description,
24
+ "version": this.version,
25
+ "defaultLocale": this.defaultLocale,
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,21 @@
1
+ import { WorkflowStep } from './workflow_step'
2
+
3
+ export class WorkflowResult {
4
+ sessionId
5
+ finalStep
6
+
7
+ static fromJson(jsonObject) {
8
+ if (jsonObject == null) return null
9
+ const result = new WorkflowResult()
10
+ result.sessionId = jsonObject["sessionId"]
11
+ result.finalStep = WorkflowStep.fromJson(jsonObject["finalStep"])
12
+ return result
13
+ }
14
+
15
+ toJson() {
16
+ return {
17
+ "sessionId": this.sessionId,
18
+ "finalStep": this.finalStep?.toJson(),
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,19 @@
1
+ export class WorkflowStep {
2
+ id
3
+ name
4
+
5
+ static fromJson(jsonObject) {
6
+ if (jsonObject == null) return null
7
+ const result = new WorkflowStep()
8
+ result.id = jsonObject["id"]
9
+ result.name = jsonObject["name"]
10
+ return result
11
+ }
12
+
13
+ toJson() {
14
+ return {
15
+ "id": this.id,
16
+ "name": this.name,
17
+ }
18
+ }
19
+ }