@regulaforensics/idv 3.2.26-beta → 3.2.59-beta
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/README.md +2 -8
- package/RNIDV.podspec +2 -2
- package/android/build.gradle +1 -10
- package/android/cordova.gradle +1 -1
- package/examples/capacitor/android/build.gradle +1 -1
- package/examples/capacitor/package-lock.json +3350 -0
- package/examples/capacitor/package.json +4 -4
- package/examples/capacitor/src/main.html +8 -29
- package/examples/capacitor/src/main.tsx +115 -1
- package/examples/ionic/README.md +2 -2
- package/examples/ionic/config.xml +1 -0
- package/examples/ionic/package-lock.json +14261 -0
- package/examples/ionic/package.json +7 -7
- package/examples/ionic/src/main.html +8 -29
- package/examples/ionic/src/main.tsx +115 -1
- package/examples/react_native/README.md +2 -2
- package/examples/react_native/package-lock.json +8996 -0
- package/examples/react_native/package.json +4 -4
- package/examples/react_native/scripts/setup.sh +3 -0
- package/examples/react_native/src/main.html +8 -29
- package/examples/react_native/src/main.tsx +115 -1
- package/ios/CVDIDV.swift +6 -50
- package/ios/RNIDV.swift +4 -52
- package/package.json +1 -1
- package/plugin.xml +5 -4
- package/test/json.tsx +40 -0
- package/test/package-lock.json +1 -1
- package/test/test.tsx +12 -2
- package/www/capacitor/config/api_key_connection_config.js +32 -0
- package/www/capacitor/config/credentials_connection_config.js +32 -0
- package/www/capacitor/config/prepare_workflow_config.js +20 -0
- package/www/capacitor/config/start_workflow_config.js +24 -0
- package/www/capacitor/config/token_connection_config.js +20 -0
- package/www/capacitor/index.js +105 -1
- package/www/capacitor/internal/bridge.js +19 -8
- package/www/capacitor/model/workflow.js +28 -0
- package/www/capacitor/model/workflow_result.js +21 -0
- package/www/capacitor/model/workflow_step.js +19 -0
- package/www/cordova.js +455 -10
- package/www/react-native/config/api_key_connection_config.js +32 -0
- package/www/react-native/config/credentials_connection_config.js +32 -0
- package/www/react-native/config/prepare_workflow_config.js +20 -0
- package/www/react-native/config/start_workflow_config.js +24 -0
- package/www/react-native/config/token_connection_config.js +20 -0
- package/www/react-native/index.js +105 -1
- package/www/react-native/internal/bridge.js +19 -8
- package/www/react-native/model/workflow.js +28 -0
- package/www/react-native/model/workflow_result.js +21 -0
- package/www/react-native/model/workflow_step.js +19 -0
- package/www/types/config/api_key_connection_config.d.ts +6 -0
- package/www/types/config/credentials_connection_config.d.ts +6 -0
- package/www/types/config/prepare_workflow_config.d.ts +3 -0
- package/www/types/config/start_workflow_config.d.ts +4 -0
- package/www/types/config/token_connection_config.d.ts +3 -0
- package/www/types/index.d.ts +50 -0
- package/www/types/model/workflow.d.ts +9 -0
- package/www/types/model/workflow_result.d.ts +8 -0
- package/www/types/model/workflow_step.d.ts +6 -0
- package/ios/FlutterIDVPlugin.swift +0 -72
|
@@ -1,6 +1,110 @@
|
|
|
1
|
-
import { exec } from './internal/bridge'
|
|
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'
|
|
2
19
|
|
|
3
20
|
export class IDV {
|
|
4
21
|
static get instance() { return IDV._instance }
|
|
5
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)
|
|
6
110
|
}
|
|
@@ -7,13 +7,24 @@ export async function exec(name, params) {
|
|
|
7
7
|
return RNIDV.exec(name, params)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
function
|
|
10
|
+
function setEvent(id, completion, transform) {
|
|
11
11
|
eventManager.removeAllListeners(id)
|
|
12
|
-
if (
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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)
|
|
19
30
|
}
|
|
@@ -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
|
+
}
|
package/www/types/index.d.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
import { TokenConnectionConfig } from './config/token_connection_config'
|
|
2
|
+
import { CredentialsConnectionConfig } from './config/credentials_connection_config'
|
|
3
|
+
import { ApiKeyConnectionConfig } from './config/api_key_connection_config'
|
|
4
|
+
import { PrepareWorkflowConfig } from './config/prepare_workflow_config'
|
|
5
|
+
import { StartWorkflowConfig } from './config/start_workflow_config'
|
|
6
|
+
import { Workflow } from './model/workflow'
|
|
7
|
+
import { WorkflowResult } from './model/workflow_result'
|
|
8
|
+
import { WorkflowStep } from './model/workflow_step'
|
|
1
9
|
|
|
10
|
+
export { TokenConnectionConfig }
|
|
11
|
+
export { CredentialsConnectionConfig }
|
|
12
|
+
export { ApiKeyConnectionConfig }
|
|
13
|
+
export { PrepareWorkflowConfig }
|
|
14
|
+
export { StartWorkflowConfig }
|
|
15
|
+
export { Workflow }
|
|
16
|
+
export { WorkflowResult }
|
|
17
|
+
export { WorkflowStep }
|
|
2
18
|
|
|
3
19
|
/**
|
|
4
20
|
* Entry point of the Regula IDV.
|
|
@@ -9,4 +25,38 @@ export class IDV {
|
|
|
9
25
|
*/
|
|
10
26
|
static get instance(): IDV
|
|
11
27
|
private constructor()
|
|
28
|
+
|
|
29
|
+
setListener(options?: IDVListenerOptions): void
|
|
30
|
+
|
|
31
|
+
set sessionRestoreMode(value: SessionRestoreMode)
|
|
32
|
+
|
|
33
|
+
getCurrentSessionId(): Promise<string | null>
|
|
34
|
+
|
|
35
|
+
initialize(): Promise<[boolean, string | null]>
|
|
36
|
+
|
|
37
|
+
deinitialize(): Promise<[boolean, string | null]>
|
|
38
|
+
|
|
39
|
+
configureWithToken(config: TokenConnectionConfig): Promise<[string[] | null, string | null]>
|
|
40
|
+
|
|
41
|
+
configureWithCredentials(config: CredentialsConnectionConfig): Promise<[boolean, string | null]>
|
|
42
|
+
|
|
43
|
+
configureWithApiKey(config: ApiKeyConnectionConfig): Promise<[boolean, string | null]>
|
|
44
|
+
|
|
45
|
+
prepareWorkflow(config: PrepareWorkflowConfig): Promise<[Workflow | null, string | null]>
|
|
46
|
+
|
|
47
|
+
startWorkflow(config?: StartWorkflowConfig): Promise<[WorkflowResult | null, string | null]>
|
|
48
|
+
|
|
49
|
+
getWorkflows(): Promise<[Workflow[] | null, string | null]>
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export enum SessionRestoreMode {
|
|
53
|
+
ENABLED = 0,
|
|
54
|
+
DISABLED = 1,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface IDVListenerOptions {
|
|
58
|
+
didStartSession?: () => void
|
|
59
|
+
didEndSession?: () => void
|
|
60
|
+
didStartRestoreSession?: () => void
|
|
61
|
+
didContinueRemoteSession?: () => void
|
|
12
62
|
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import Flutter
|
|
2
|
-
import UIKit
|
|
3
|
-
|
|
4
|
-
let channelID = "flutter_idv"
|
|
5
|
-
var eventSinks: [String: FlutterEventSink] = [:]
|
|
6
|
-
|
|
7
|
-
private var args: [Any?] = []
|
|
8
|
-
|
|
9
|
-
func sendEvent(_ event: String, _ data: Any? = nil) {
|
|
10
|
-
DispatchQueue.main.async {
|
|
11
|
-
if let sink = eventSinks[event] {
|
|
12
|
-
sink(data.toSendable())
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
func args<T>(_ index: Int) -> T {
|
|
18
|
-
return args[index] as! T
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
func argsNullable<T>(_ index: Int) -> T? {
|
|
22
|
-
if (args[index] is NSNull) { return nil }
|
|
23
|
-
return args[index] as! T?
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public class FlutterIDVPlugin: NSObject, FlutterPlugin {
|
|
27
|
-
public static func register(with registrar: FlutterPluginRegistrar) {
|
|
28
|
-
func setupEventChannel(_ eventId: String) {
|
|
29
|
-
let channel = FlutterEventChannel(name: "\(channelID)/event/\(eventId)", binaryMessenger: registrar.messenger())
|
|
30
|
-
channel.setStreamHandler(GenericStreamHandler(eventId))
|
|
31
|
-
}
|
|
32
|
-
setupEventChannel(didStartSessionEvent);
|
|
33
|
-
setupEventChannel(didEndSessionEvent);
|
|
34
|
-
setupEventChannel(didStartRestoreSessionEvent);
|
|
35
|
-
setupEventChannel(didContinueRemoteSessionEvent);
|
|
36
|
-
|
|
37
|
-
let channel = FlutterMethodChannel(name: "\(channelID)/method", binaryMessenger: registrar.messenger())
|
|
38
|
-
registrar.addMethodCallDelegate(FlutterIDVPlugin(), channel: channel)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
|
42
|
-
args = call.arguments as! [Any?]
|
|
43
|
-
methodCall(call.method, { data in result(data.toSendable()) })
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
class GenericStreamHandler: NSObject, FlutterStreamHandler {
|
|
48
|
-
private let eventId: String
|
|
49
|
-
|
|
50
|
-
public init(_ eventId: String) {
|
|
51
|
-
self.eventId = eventId
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public func onListen(withArguments arguments: Any?, eventSink: @escaping FlutterEventSink) -> FlutterError? {
|
|
55
|
-
eventSinks[eventId] = eventSink
|
|
56
|
-
return nil
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public func onCancel(withArguments arguments: Any?) -> FlutterError? {
|
|
60
|
-
eventSinks[eventId] = nil
|
|
61
|
-
return nil
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
let rootViewController: () -> UIViewController? = {
|
|
66
|
-
for window in UIApplication.shared.windows {
|
|
67
|
-
if window.isKeyWindow {
|
|
68
|
-
return window.rootViewController
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return nil
|
|
72
|
-
}
|