@sekyro/react-native 0.1.0-rc.4 → 0.1.0-rc.40
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/CHANGELOG.md +233 -0
- package/README.md +24 -6
- package/android/src/main/java/ai/sekyro/reactnative/ConfigMapper.kt +30 -10
- package/android/src/main/java/ai/sekyro/reactnative/SekyroReactNativeModule.kt +11 -6
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +78 -13
- package/dist/index.d.ts +78 -13
- package/dist/index.js +1 -1
- package/ios/RCTSekyroReactNative.mm +15 -0
- package/ios/SekyroRNBridge.swift +103 -16
- package/package.json +3 -3
- package/sbom.cdx.json +4 -4
- package/src/specs/NativeSekyroReactNative.ts +13 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,238 @@
|
|
|
1
1
|
# @sekyro/react-native
|
|
2
2
|
|
|
3
|
+
## 0.1.0-rc.40
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 819638d: Document camera (iOS and Android): a reflection over a field the read needs (the card's printed number, its photo, its names or its MRZ band) no longer lets the camera take the photo by itself. The camera says "Tilt the card a little to move the reflection.", also from the start of the hold when the light is on, and the shutter stays available; the SDK never turns the light on. A retake for the new reason `document_glare` shows its own line.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-rc.39
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 79b6d05: The re-check intro now reads "You were verified here before", which is also true for a person verified at Human level. It no longer says the person verified their identity.
|
|
14
|
+
|
|
15
|
+
## 0.1.0-rc.38
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 19e6f46: Document camera (iOS and Android): a card too dark to read is no longer photographed automatically. The camera says "Too dark. Move to better light or turn on the light." (without a light, or with it already on: "Too dark. Move to better light."), and the shutter stays available. A retake for the new reason `document_too_dark` shows its own line with the same advice.
|
|
20
|
+
- 1ce68b0: Pins the native SDKs 0.1.0-rc.32: the document camera finds a pale card on a light surface and says when the edges are hard to see, Back is always in place and goes to the previous screen of the person's own path, the method choice is a page with the current option marked and the document, registry, eID and chip screens offer "Change method" with plain method names, the camera sends a capture trace for Sekyro staff, and the country list, document type list, intro and result show the accepted nationality. No API change in this package.
|
|
21
|
+
|
|
22
|
+
## 0.1.0-rc.37
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- 9b3c45c: Back (KI-535, with the next native SDKs): the header's Back is always in place, goes to the previous screen of the person's own path (the step's own sub-screen, else the still-open method choice, shown as a page) and is disabled where there is nowhere to go back to. Android's system back follows the same rule.
|
|
27
|
+
- 72254fd: Method choice (KI-522, with the next native SDKs): the document type list shows documents only, and the identity screens offer one « Change method » link that re-opens the whole method choice. Options are named from the server's data (« National Number (NNI) », « Houwiyeti », in Arabic « تطبيق هويتي »), else « National number » or « National eID ». The Arabic chip option reads « قراءة شريحة وثيقتي » and the Arabic lead « اختر طريقة للمتابعة ».
|
|
28
|
+
|
|
29
|
+
## 0.1.0-rc.36
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- ea299b2: With the next native SDK release (no change of its own until the package pins it): when the session accepts one nationality, or up to five, the native document screens show "Accepted nationality: Mauritania" before the scan, and a `nationality_not_allowed` result adds the same line.
|
|
34
|
+
|
|
35
|
+
## 0.1.0-rc.35
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- 0a8b870: Pins the native SDKs 0.1.0-rc.31: a first photo of a document whose face the phone cannot prove is no longer filed as the front and waits for the server's answer, each slot under the frame shows the photo the server holds for that face, a "could not read" notice goes once a new photo is taken, confirm details shows the document's Arabic name on an Arabic screen, and the result screen says when the other side of the document never came. No API change in this package.
|
|
40
|
+
|
|
41
|
+
## 0.1.0-rc.34
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- 3be1cff: Pins the native SDKs 0.1.0-rc.30: the document scan says at once when a document has expired and the verification refuses expired documents, the serial printed on the back of the Mauritanian ID card is no longer read as a national number, a photo without an MRZ taken before the card was turned is not sent as the back, the captured-sides tray shows each photo taken and marks "Received" only for a side the server already held, the Android scan no longer waits on a camera that does not answer, and a liveness retake no longer repeats the light tip. The wait for the device attestation on liveness and chip reads is bounded at 30 seconds and a refused submission is sent again without new filming, and the liveness colour flash is requested when the camera opens. No API change in this package.
|
|
46
|
+
- 9bcc9c1: The string catalog carries the result line for a document step whose attempts ran out on one side of the document ("We did not receive the other side of your document before your attempts ran out"), shown by the native result screen in place of the line about unclear captures.
|
|
47
|
+
|
|
48
|
+
## 0.1.0-rc.33
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- 16b55ad: Pins the native SDKs 0.1.0-rc.28: the document type list shows a method that serves only some countries (a population registry, a national eID) as a row on those countries' lists, the Japanese My Number card is captured from its front only, a card restarts after `document_type_mismatch`, TD1 R/T residence-permit codes are read on device, chip reads carry an app attestation, and on low-end phones the on-device MRZ and barcode checks have time budgets, with their timings in the capture report. No API change in this package.
|
|
53
|
+
|
|
54
|
+
## 0.1.0-rc.32
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- b33075d: Pins the native SDKs 0.1.0-rc.27. The header says "Contact verification" for a level-1 flow, and the document intro names the picked document and fits a phone screen. No API change in this package.
|
|
59
|
+
|
|
60
|
+
## 0.1.0-rc.31
|
|
61
|
+
|
|
62
|
+
### Patch Changes
|
|
63
|
+
|
|
64
|
+
- 14d85aa: Pins the native SDKs 0.1.0-rc.26. No live-capture nonce is requested before consent is recorded. On Android a voice prompt that arrives while the device voice is still starting up plays once it is ready, and on Android and iOS a prompt counts as spoken only once it starts to sound. On the document camera, problems and capture hints show in a warning band under the card, and a wrong document says what the camera saw and what to show instead. No API change in this package.
|
|
65
|
+
|
|
66
|
+
## 0.1.0-rc.30
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- 6aac0bb: With the next native SDK release (no change of its own until the package pins it): on Android, a voice prompt that arrives while the device voice is still starting up plays once it is ready instead of being lost, most often the instruction summary when the liveness screen opens on a slower phone. On Android and iOS a prompt counts as spoken only once it starts to sound, so a prompt that could not play is not held back later.
|
|
71
|
+
|
|
72
|
+
## 0.1.0-rc.29
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- 8ca9be1: Pins the native SDKs 0.1.0-rc.25. The MRZ is read on every phone with the SDK's own MRZ recognizer, and a short benchmark picks the device tier (low, mid or high). Printed text is read with the PP-OCRv5 recognizers; the second script a document prints downloads on demand on mid and high tier phones. Capture follows the server's document facts after the pick, with the built-in catalog as the fallback. The Form is shown in the person's language before consent. No API change in this package.
|
|
77
|
+
|
|
78
|
+
## 0.1.0-rc.28
|
|
79
|
+
|
|
80
|
+
### Patch Changes
|
|
81
|
+
|
|
82
|
+
- 642a375: Pins the native SDKs 0.1.0-rc.24. Capture problem reports are sent once per kind of failure, and a report refused with 429 is never resent. On Android the camera question is asked by itself only once per camera opening, so a rotation no longer asks again. On iOS a restricted camera no longer points to Settings. A device with a wrong clock is told to set its date and time to automatic. No API change in this package.
|
|
83
|
+
|
|
84
|
+
## 0.1.0-rc.27
|
|
85
|
+
|
|
86
|
+
### Patch Changes
|
|
87
|
+
|
|
88
|
+
- 1d2f52b: Pins the native SDKs 0.1.0-rc.23. Voice guidance plays one voice at a time on Android and iOS, so a clip and the device voice never overlap. A prompt is never repeated back to back, and a hint that flickers is not spoken. A clip that fails to load or play is spoken by the device voice, and the voice switch applies at once on iOS. Also: the neutral `identity_not_verified` result and the security check error copy. No API change.
|
|
89
|
+
|
|
90
|
+
## 0.1.0-rc.26
|
|
91
|
+
|
|
92
|
+
### Patch Changes
|
|
93
|
+
|
|
94
|
+
- 18265a3: With the next native SDK release (no change of its own until the package pins it): a session that ends on the neutral `identity_not_verified` code (`reason: 'rejected'`, suspected fraud or an automatic block) shows "We couldn't verify your identity. Contact {org} for help." on the native result screen, and the finished result carries that code. The session's real outcome is on your server.
|
|
95
|
+
|
|
96
|
+
## 0.1.0-rc.25
|
|
97
|
+
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- 3601d49: Pins the native SDKs 0.1.0-rc.22: the Form step (planned: no flow can contain it yet), drawn by the native drop-in on Android and iOS, with each refused answer shown under its question. `SekyroStep` gains `form` (the event never carries the answers).
|
|
101
|
+
|
|
102
|
+
## 0.1.0-rc.24
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- c4fae81: Document capture, with the next native SDK release (no change of its own until the package pins it): a document without an MRZ (a driving licence) has its front and back labelled from its barcode when the document catalog says which face carries it.
|
|
107
|
+
- d1d4698: Document step, with the next native SDK release (no change of its own until the package pins it): capture follows the document catalog for the picked country (sides, frame shape, whether the document has an MRZ) when the session asks for it, and the new step reason `document_type_not_supported` reopens the picker without the type chosen.
|
|
108
|
+
- 8988193: With the next native SDK release (no change of its own until the package pins it): the dashboard's "System" font keeps the Sekyro faces on Android (Geist titles, as on iOS and the web), the dashboard's "Inter" font now shows Inter on iOS instead of the system font, and the Android NFC chip screen title uses the flow's title style.
|
|
109
|
+
- e5a0021: Pins the native SDKs 0.1.0-rc.21: "Look at the colours" for the whole colour flash of the self capture (new string, every language), the document pick sent with every side, the new document step reasons `document_type_not_supported` and `document_sides_mismatch` (and the final `document_photo_mismatch`), and the document catalog driving capture for the picked country. No change of its own.
|
|
110
|
+
|
|
111
|
+
## 0.1.0-rc.23
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- 3e254cf: Pins the native SDKs 0.1.0-rc.20: `sandbox` on the finished result and the "This was a simulation" notice on the result screen, the display kept awake while the liveness camera is up, the result screen's "Continue" button and copy for a person who is still in your app, a verified title that says what the session proved, and the verified mark drawn in again. No change of its own.
|
|
116
|
+
|
|
117
|
+
## 0.1.0-rc.22
|
|
118
|
+
|
|
119
|
+
### Minor Changes
|
|
120
|
+
|
|
121
|
+
- 14faf9e: The finished result says when a Sandbox session ran on simulated test data. `sandbox` is `{ simulated: true, reason }`, where `reason` is `no_testers` (your organization has no active Sandbox tester), `tester_gate_not_used` (nobody ran the tester check at the start of the session) or `tester_gate_missed` (the tester check ran and recognized nobody). No real check ran on such a session, so its outcome says nothing about the person. The field is absent in Live and on a Sandbox session an enrolled tester ran. The new types `SekyroSandboxSimulation` and `SekyroSandboxSimulatedReason` are exported. The result screen shows the same notice. The field arrives with the next native SDK release: until the package pins it, `sandbox` is always absent.
|
|
122
|
+
|
|
123
|
+
### Patch Changes
|
|
124
|
+
|
|
125
|
+
- 5379d91: A level 1 result that is not exactly one phone code or one email code (for example both confirmed, or a contact your organization supplied) is now titled "Your details are confirmed" instead of "You're verified". Level 2 and a result with no level keep "You're verified". The same on Android, iOS and Flutter. All six languages. New string key you can override through `strings`: `session.result.verified.titleContact`.
|
|
126
|
+
|
|
127
|
+
## 0.1.0-rc.21
|
|
128
|
+
|
|
129
|
+
### Patch Changes
|
|
130
|
+
|
|
131
|
+
- d3a7ac4: Pins the native SDKs 0.1.0-rc.19: proof of address and driver's license steps, Levels v2 result docs, and the email code screen says when a code cannot be sent because of the organization's account (another method when the flow has one, no "Try again"). No change of its own.
|
|
132
|
+
|
|
133
|
+
## 0.1.0-rc.20
|
|
134
|
+
|
|
135
|
+
### Minor Changes
|
|
136
|
+
|
|
137
|
+
- fbd39ca: Levels v2: a finished result's `level` is `1` Contact, `2` Human, `3` Identity, `0` when nothing was proven, and `assurance` adds the level 1 values `device_only`, `contact_email`, `contact_phone` and `unbound_identity`. The bridge passes the native values through unchanged; no code change. A check for a real person is `level >= 2` and for identity `level >= 3`; to require a particular proof, compare `assurance` with a list on your server.
|
|
138
|
+
|
|
139
|
+
## 0.1.0-rc.19
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- 5675b33: Pins the native SDKs 0.1.0-rc.18: the tester gate. On a simulated Sandbox session of an organization with enrolled testers, the drop-in offers "Run real checks as a tester"; a recognised tester runs real checks, anyone else continues with test data. The French "Test session" badge reads "Mode test". No change of its own.
|
|
144
|
+
|
|
145
|
+
## 0.1.0-rc.18
|
|
146
|
+
|
|
147
|
+
### Patch Changes
|
|
148
|
+
|
|
149
|
+
- cdc04be: Pins the native SDKs 0.1.0-rc.17: a face match retry records a new liveness video, and the retake intro says so ("We couldn't confirm it's you. Record the video again in good light, without glasses", in six languages). No change of its own.
|
|
150
|
+
|
|
151
|
+
## 0.1.0-rc.17
|
|
152
|
+
|
|
153
|
+
### Patch Changes
|
|
154
|
+
|
|
155
|
+
- 9b289f6: Pins the native SDKs 0.1.0-rc.16, the release that matches the session outcome model on production: a review that times out or whose reviewers disagree ends on the "We could not confirm your identity this time" screen, and an inference outage on "Verification was not available". No change of its own.
|
|
156
|
+
|
|
157
|
+
## 0.1.0-rc.16
|
|
158
|
+
|
|
159
|
+
### Minor Changes
|
|
160
|
+
|
|
161
|
+
- 6128176: Breaking: the finished result's `displayStatus` is `verified`, `review_pending` or `not_verified` (was `approved`, `review_pending`, `rejected`, `expired`). On `not_verified` the result carries `reason` (`rejected`, `inconclusive`, `unavailable`, `abandoned`, `not_opened`, `policy`, `cancelled` or `superseded`) and `reasonCode` when there is one. A session that expired is `not_verified` with its reason; a superseded session is `not_verified` with `reason: 'superseded'`. A display status this version does not know reads as `not_verified`, never `review_pending`.
|
|
162
|
+
|
|
163
|
+
### Patch Changes
|
|
164
|
+
|
|
165
|
+
- 66f490f: Pins the native SDKs 0.1.0-rc.15: the session outcome model on the native screens (verified, under review or not verified, with the reason), screen ramp v2 (the full-screen liveness colour flash), the clip frame count on each liveness video, a face match that asks for another try records a new liveness video, and retake screens that teach the fix for their own reason.
|
|
166
|
+
|
|
167
|
+
## 0.1.0-rc.15
|
|
168
|
+
|
|
169
|
+
### Patch Changes
|
|
170
|
+
|
|
171
|
+
- 06a272a: Pins the native SDKs 0.1.0-rc.14: in a Sandbox simulation the code screens show the code to enter and the capture screens offer "Skip with test data"; the document country list starts with the person's own country; back from the portrait camera returns to its instructions; the ID photo check accepts one eye that is always less open and a relaxed narrow mouth.
|
|
172
|
+
|
|
173
|
+
## 0.1.0-rc.14
|
|
174
|
+
|
|
175
|
+
### Patch Changes
|
|
176
|
+
|
|
177
|
+
- a012c1b: Pins the native SDKs 0.1.0-rc.13: the new flow design, change the number or address on the code screen, the terms in a sheet that is easy to close, and automatic retries when the API is busy.
|
|
178
|
+
- dfd36ff: A finished result carries `level` (0 to 3, the new `SekyroLevel` type) and `assurance` (how the level was proved) once the session is decided, when the native SDK reports them (native 0.1.0-rc.13 on). Absent before that, on an expired session and with an older native SDK. The glue reads them from the native SDK's own wire form, so it builds against the current native pin too.
|
|
179
|
+
|
|
180
|
+
## 0.1.0-rc.13
|
|
181
|
+
|
|
182
|
+
### Patch Changes
|
|
183
|
+
|
|
184
|
+
- 64ca525: `es`, `pt` and `de` now translate every screen, the identity screens (document, ID number, registry, chip, eID, summary) and the shared errors and reasons included; before, they covered the Human copy and showed English elsewhere. The copy still loads on demand, only for those locales. React Native: without a `locale`, the flow follows a device language of `es`, `pt` or `de` too.
|
|
185
|
+
- a574210: Pins the native SDKs 0.1.0-rc.12 (Android `ai.sekyro:sekyro-bom`, iOS `sekyro-ios-dist`): capture mode `choice` (the person picks who films on the first camera step, and the pick holds for the session), a session stopped with `starter_credit_claimed` or `underage_estimated` ends on its own line, the document step after an unsettled selfie age check says why it asks for an ID document, and every native screen reads in `es`, `pt` and `de`. Without a `locale`, iOS now uses the device language when it is one of the six end-user locales, else `fr`, as Android does.
|
|
186
|
+
- 65d665c: iOS: when the React instance is torn down while a flow is open (a reload, an over-the-air update, the React host destroyed), the flow closes and `startSekyro` resolves `{ status: 'failed', code: 'flow_interrupted' }`, as on Android; before, the promise never settled and the next `startSekyro` was refused with `flow_in_progress`. The same result comes back if your app dismisses the flow screen itself. The promise settles exactly once: a result the person already reached wins over a teardown that follows it. Android now also closes the open flow on teardown.
|
|
187
|
+
|
|
188
|
+
## 0.1.0-rc.12
|
|
189
|
+
|
|
190
|
+
### Patch Changes
|
|
191
|
+
|
|
192
|
+
- ff8fb41: Pins the native SDKs 0.1.0-rc.11 (Android `ai.sekyro:sekyro-bom`, iOS `sekyro-ios-dist`): the finished result and the reference on the result screen carry the public session id (`ses_…`), the form `POST /sessions` and the webhooks use. Every API route accepts both forms, so a stored bare id keeps working.
|
|
193
|
+
|
|
194
|
+
## 0.1.0-rc.11
|
|
195
|
+
|
|
196
|
+
### Patch Changes
|
|
197
|
+
|
|
198
|
+
- 6f9b59c: Pins the native SDKs 0.1.0-rc.10 (Android `ai.sekyro:sekyro-bom`, iOS `sekyro-ios-dist`): the phone step offers the countries your flow accepts and follows the server's rules for each one (length, grouping, national prefix), the Mauritanian default is gone, and the new retryable reasons `otp_number_invalid` and `otp_number_not_mobile` have their own message.
|
|
199
|
+
|
|
200
|
+
## 0.1.0-rc.10
|
|
201
|
+
|
|
202
|
+
### Patch Changes
|
|
203
|
+
|
|
204
|
+
- 0a5440e: Pins the native SDKs 0.1.0-rc.9 (Android `ai.sekyro:sekyro-bom`, iOS `sekyro-ios-dist`): status colours are standard on every partner page (the theme's `danger`, `success` and `warning` are ignored), and on Android the theme's `border` and `fontFamily` now reach the flow.
|
|
205
|
+
|
|
206
|
+
## 0.1.0-rc.9
|
|
207
|
+
|
|
208
|
+
### Patch Changes
|
|
209
|
+
|
|
210
|
+
- 244e4e1: Status colours are standard. `theme.colors.danger`, `success` and `warning` are deprecated and ignored (one warning in development builds); they are no longer passed to the native SDKs and will be removed in 1.0.
|
|
211
|
+
|
|
212
|
+
## 0.1.0-rc.8
|
|
213
|
+
|
|
214
|
+
### Patch Changes
|
|
215
|
+
|
|
216
|
+
- a23b2fb: Pins the native SDKs 0.1.0-rc.8 (Android `ai.sekyro:sekyro-bom`, iOS `sekyro-ios-dist`): verification copy without long dashes in every language, and the new `insufficient_balance` reason (a prepaid organization's balance cannot pay for a step, such as a phone code) says the method is not available right now and offers another way when the flow has one.
|
|
217
|
+
|
|
218
|
+
## 0.1.0-rc.7
|
|
219
|
+
|
|
220
|
+
### Patch Changes
|
|
221
|
+
|
|
222
|
+
- 745ca13: Pins the native SDKs 0.1.0-rc.7 (Android `ai.sekyro:sekyro-bom`, iOS `sekyro-ios-dist`). Person data: the native SDKs read the hosted view's new ID number field names with the former ones as fallback, send `x-sekyro-sdk`, post the typed number as `idNumber`, and show the same screen for either name of a renamed reason.
|
|
223
|
+
|
|
224
|
+
## 0.1.0-rc.6
|
|
225
|
+
|
|
226
|
+
### Patch Changes
|
|
227
|
+
|
|
228
|
+
- ce9875f: Pins the native SDKs 0.1.0-rc.6 (Android `ai.sekyro:sekyro-bom`, iOS `sekyro-ios-dist`). Adds the Age check (selfie) processing step on Android and iOS and renders any future server step as processing. Deploy this version before turning on the age check for your organization.
|
|
229
|
+
|
|
230
|
+
## 0.1.0-rc.5
|
|
231
|
+
|
|
232
|
+
### Patch Changes
|
|
233
|
+
|
|
234
|
+
- 0ef2f1a: Pins the native SDKs 0.1.0-rc.5 (Android `ai.sekyro:sekyro-bom`, iOS `sekyro-ios-dist`). Android: the document step lists only the countries the session accepts and skips the country step when there is only one, as on the web and iOS.
|
|
235
|
+
|
|
3
236
|
## 0.1.0-rc.4
|
|
4
237
|
|
|
5
238
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# @sekyro/react-native
|
|
2
2
|
|
|
3
3
|
Sekyro AI eKYC for React Native: a thin TurboModule over the binary Sekyro Android and iOS SDKs.
|
|
4
|
-
The native drop-in runs the whole flow (
|
|
4
|
+
The native drop-in runs the whole flow (contact, identity, document, NFC chip, liveness) full screen and
|
|
5
5
|
returns a display-only result. Read the decision on your server (webhooks or `sessions.get`).
|
|
6
6
|
|
|
7
|
-
Requirements: React Native 0.76 or later with the New Architecture, Android minSdk 24, iOS 15.
|
|
7
|
+
Requirements: React Native 0.76 or later with the New Architecture, Android minSdk 24, iOS 15.1.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm install @sekyro/react-native
|
|
12
|
+
npm install @sekyro/react-native@next
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
### iOS (Podfile)
|
|
@@ -58,17 +58,35 @@ const result = await startSekyro({
|
|
|
58
58
|
theme: { colors: { brand: '#0F68B1' }, radius: 12 },
|
|
59
59
|
onEvent: (e) => console.log(e.type), // step telemetry, no personal data
|
|
60
60
|
});
|
|
61
|
-
// { status: 'finished', sessionId, displayStatus } | { status: 'cancelled' } | { status: 'failed', code }
|
|
61
|
+
// { status: 'finished', sessionId, displayStatus, reason?, reasonCode?, sandbox? } | { status: 'cancelled' } | { status: 'failed', code }
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
`displayStatus` is what the person was shown: `verified`, `review_pending` or `not_verified`. On `not_verified`,
|
|
65
|
+
`reason` says why (`rejected`, `inconclusive`, `unavailable`, `abandoned`, `not_opened`, `policy`, `cancelled` or
|
|
66
|
+
`superseded`) and `reasonCode` gives the code behind it when there is one. Read the decision itself server-side
|
|
67
|
+
(webhooks or `sessions.get`).
|
|
68
|
+
|
|
69
|
+
`sandbox` is present when a Sandbox session ran on simulated test data, so no real check ran:
|
|
70
|
+
`{ simulated: true, reason }`, where `reason` is `no_testers` (your organization has no active Sandbox tester),
|
|
71
|
+
`tester_gate_not_used` (nobody ran the tester check at the start of the session) or `tester_gate_missed` (the tester
|
|
72
|
+
check ran and recognized nobody). It is absent in Live and on a Sandbox session an enrolled tester ran. The result
|
|
73
|
+
screen shows the same notice.
|
|
74
|
+
|
|
64
75
|
Or declaratively: `<SekyroFlow clientToken={token} onResult={setResult} />` (renders nothing).
|
|
65
76
|
|
|
66
77
|
Never log the `clientToken`; it is a one-time bearer credential.
|
|
67
78
|
|
|
79
|
+
**Languages.** `locale` takes `ar`, `fr`, `en`, `es`, `pt` or `de`; only `ar` is right to left. All six translate every screen,
|
|
80
|
+
the identity screens (document, chip, ID number, registry) included. Without a locale, the SDK uses the device
|
|
81
|
+
language when it is one of the six, else `fr`.
|
|
82
|
+
|
|
68
83
|
While a flow runs, the wrapper owns the native SDK's process-wide event listener
|
|
69
84
|
(`Sekyro.setEventListener` on Android, the drop-in's `onEvent` on iOS) and clears it when the
|
|
70
|
-
flow ends, so a listener your app set natively is replaced for that time.
|
|
71
|
-
|
|
85
|
+
flow ends, so a listener your app set natively is replaced for that time. When the React
|
|
86
|
+
instance is torn down while a flow is open (a reload, the React host destroyed), the SDK closes
|
|
87
|
+
the flow and the promise resolves `{ status: 'failed', code: 'flow_interrupted' }` on Android and
|
|
88
|
+
iOS; on iOS the same happens if your app dismisses the flow screen itself. The promise settles
|
|
89
|
+
once. Unmounting `<SekyroFlow>` does not close an open flow: its result still reaches `onResult`.
|
|
72
90
|
|
|
73
91
|
Full guide: [React Native guide](https://docs.sekyro.ai/en/mobile/react-native).
|
|
74
92
|
|
|
@@ -4,7 +4,7 @@ import ai.sekyro.SekyroConfig
|
|
|
4
4
|
import ai.sekyro.SekyroLocale
|
|
5
5
|
import ai.sekyro.SekyroResult
|
|
6
6
|
import ai.sekyro.SekyroTheme
|
|
7
|
-
import ai.sekyro.
|
|
7
|
+
import ai.sekyro.SekyroWire
|
|
8
8
|
import com.facebook.react.bridge.Arguments
|
|
9
9
|
import com.facebook.react.bridge.ReadableMap
|
|
10
10
|
import com.facebook.react.bridge.ReadableType
|
|
@@ -39,8 +39,8 @@ internal object ConfigMapper {
|
|
|
39
39
|
"light" -> SekyroTheme.DarkMode.LIGHT; "dark" -> SekyroTheme.DarkMode.DARK; else -> SekyroTheme.DarkMode.SYSTEM
|
|
40
40
|
},
|
|
41
41
|
bg = color(colors, "bg"), surface = color(colors, "surface"), fg = color(colors, "fg"),
|
|
42
|
-
fgMuted = color(colors, "fgMuted"),
|
|
43
|
-
|
|
42
|
+
fgMuted = color(colors, "fgMuted"),
|
|
43
|
+
// danger / success / warning are not read: status colours are standard (deprecated no-ops, removed in 1.0).
|
|
44
44
|
border = color(colors, "border"), fontFamily = fontFamily,
|
|
45
45
|
)
|
|
46
46
|
val strings = if (m.hasKey("strings") && !m.isNull("strings")) {
|
|
@@ -59,19 +59,39 @@ internal object ConfigMapper {
|
|
|
59
59
|
)
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
|
|
62
|
+
/**
|
|
63
|
+
* [into] and [newMap] (the nested `sandbox` map) are injectable so JVM tests can use a JavaOnlyMap
|
|
64
|
+
* (Arguments.createMap() needs the RN native libs).
|
|
65
|
+
*/
|
|
66
|
+
fun toWire(
|
|
67
|
+
r: SekyroResult,
|
|
68
|
+
into: WritableMap = Arguments.createMap(),
|
|
69
|
+
newMap: () -> WritableMap = { Arguments.createMap() },
|
|
70
|
+
): WritableMap = into.apply {
|
|
64
71
|
when (r) {
|
|
65
72
|
is SekyroResult.Finished -> {
|
|
66
73
|
putString("status", "finished"); putString("sessionId", r.sessionId)
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
// Everything else from the native SDK's own wire form (SekyroWire.result), so the JS side reads the same
|
|
75
|
+
// strings as Flutter: displayStatus verified | review_pending | not_verified, reason and reasonCode on
|
|
76
|
+
// not_verified, level (1 Contact, 2 Human, 3 Identity, 0 nothing proven) and assurance once decided. Each
|
|
77
|
+
// key only when known: JS reads absent as "none". `sandbox` ({ simulated: true, reason }) is there when a
|
|
78
|
+
// Sandbox session ran on simulated test data; a native SDK that does not report it sends no such key.
|
|
79
|
+
val wire = SekyroWire.result(r)
|
|
80
|
+
(wire["displayStatus"] as? String)?.let { putString("displayStatus", it) }
|
|
81
|
+
(wire["level"] as? Int)?.takeIf { it in 0..3 }?.let { putInt("level", it) }
|
|
82
|
+
for (key in listOf("assurance", "reason", "reasonCode")) {
|
|
83
|
+
(wire[key] as? String)?.takeIf { it.isNotEmpty() }?.let { putString(key, it) }
|
|
84
|
+
}
|
|
85
|
+
sandboxReason(wire)?.let { reason ->
|
|
86
|
+
putMap("sandbox", newMap().apply { putBoolean("simulated", true); putString("reason", reason) })
|
|
87
|
+
}
|
|
72
88
|
}
|
|
73
89
|
SekyroResult.Cancelled -> putString("status", "cancelled")
|
|
74
90
|
is SekyroResult.Failed -> { putString("status", "failed"); putString("code", r.code) }
|
|
75
91
|
}
|
|
76
92
|
}
|
|
93
|
+
|
|
94
|
+
/** The reason of the native wire's `sandbox` entry, or null when the entry is absent or names none. */
|
|
95
|
+
internal fun sandboxReason(wire: Map<String, Any?>): String? =
|
|
96
|
+
((wire["sandbox"] as? Map<*, *>)?.get("reason") as? String)?.takeIf { it.isNotEmpty() }
|
|
77
97
|
}
|
|
@@ -16,6 +16,7 @@ import com.facebook.react.bridge.UiThreadUtil
|
|
|
16
16
|
import com.facebook.react.bridge.WritableMap
|
|
17
17
|
import java.util.concurrent.atomic.AtomicBoolean
|
|
18
18
|
import java.util.concurrent.atomic.AtomicInteger
|
|
19
|
+
import java.util.concurrent.atomic.AtomicReference
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* `SekyroReactNative` TurboModule: presents the native drop-in (SekyroActivity) and forwards its step events.
|
|
@@ -31,7 +32,8 @@ import java.util.concurrent.atomic.AtomicInteger
|
|
|
31
32
|
class SekyroReactNativeModule(context: ReactApplicationContext) : NativeSekyroReactNativeSpec(context) {
|
|
32
33
|
private val running = AtomicBoolean(false)
|
|
33
34
|
private val seq = AtomicInteger(0)
|
|
34
|
-
|
|
35
|
+
/** The running flow's promise; taken atomically, so a result and a teardown racing on two threads settle it once. */
|
|
36
|
+
private val pending = AtomicReference<Promise?>(null)
|
|
35
37
|
|
|
36
38
|
private val activityListener = object : BaseActivityEventListener() {
|
|
37
39
|
override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
|
|
@@ -58,12 +60,12 @@ class SekyroReactNativeModule(context: ReactApplicationContext) : NativeSekyroRe
|
|
|
58
60
|
UiThreadUtil.runOnUiThread {
|
|
59
61
|
try {
|
|
60
62
|
if (activity.isFinishing || activity.isDestroyed) throw IllegalStateException("activity is finishing")
|
|
61
|
-
pending
|
|
63
|
+
pending.set(promise)
|
|
62
64
|
Sekyro.setEventListener { event -> emitOnEvent(toWire(event)) }
|
|
63
65
|
activity.startActivityForResult(SekyroContract().createIntent(activity, parsed), REQUEST_CODE)
|
|
64
66
|
} catch (_: Exception) {
|
|
65
67
|
// e.g. the activity is finishing, or the drop-in activity cannot be resolved.
|
|
66
|
-
pending
|
|
68
|
+
pending.set(null)
|
|
67
69
|
Sekyro.setEventListener(null)
|
|
68
70
|
running.set(false)
|
|
69
71
|
promise.reject("no_activity", "the foreground activity cannot launch the flow")
|
|
@@ -73,8 +75,7 @@ class SekyroReactNativeModule(context: ReactApplicationContext) : NativeSekyroRe
|
|
|
73
75
|
|
|
74
76
|
/** Settle the running flow once (a duplicate or late result is ignored). */
|
|
75
77
|
private fun settle(result: SekyroResult) {
|
|
76
|
-
val p = pending ?: return
|
|
77
|
-
pending = null
|
|
78
|
+
val p = pending.getAndSet(null) ?: return
|
|
78
79
|
Sekyro.setEventListener(null)
|
|
79
80
|
running.set(false)
|
|
80
81
|
p.resolve(ConfigMapper.toWire(result))
|
|
@@ -93,7 +94,11 @@ class SekyroReactNativeModule(context: ReactApplicationContext) : NativeSekyroRe
|
|
|
93
94
|
|
|
94
95
|
override fun invalidate() {
|
|
95
96
|
reactApplicationContext.removeActivityEventListener(activityListener)
|
|
96
|
-
// The React instance is going away with a flow still open:
|
|
97
|
+
// The React instance is going away with a flow still open: close the drop-in (its result has nowhere to go
|
|
98
|
+
// now, as on iOS) and settle the promise rather than leak it.
|
|
99
|
+
if (pending.get() != null) {
|
|
100
|
+
reactApplicationContext.currentActivity?.let { host -> UiThreadUtil.runOnUiThread { host.finishActivity(REQUEST_CODE) } }
|
|
101
|
+
}
|
|
97
102
|
settle(SekyroResult.Failed("flow_interrupted"))
|
|
98
103
|
Sekyro.setEventListener(null)
|
|
99
104
|
super.invalidate()
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var C=(e,o)=>{for(var t in o)p(e,t,{get:o[t],enumerable:!0})},O=(e,o,t,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of x(o))!h.call(e,r)&&r!==t&&p(e,r,{get:()=>o[r],enumerable:!(s=b(o,r))||s.enumerable});return e};var T=e=>O(p({},"__esModule",{value:!0}),e);var z={};C(z,{SDK_VERSION:()=>w,SekyroError:()=>l,SekyroFlow:()=>N,nativeVersion:()=>R,startSekyro:()=>y});module.exports=T(z);var k=require("react-native"),c=k.TurboModuleRegistry.get("SekyroReactNative");var l=class extends Error{code;constructor(o,t=o){super(t),this.name="SekyroError",this.code=o}};var D=500,I=new Set(["ar","fr","en","es","pt","de"]),F=["brand","brandFg","bg","surface","fg","fgMuted","border"],V=["danger","success","warning"],g=!1,L=new Set(["clientToken","apiOrigin","locale","theme","strings","onEvent"]),M=/^#[0-9a-fA-F]{6}$/,A=/^http:\/\/(localhost|127\.0\.0\.1|10\.0\.2\.2)(:\d+)?$/,a=e=>{throw new l("invalid_config",`invalid config: ${e}`)};function m(e){(typeof e!="object"||e===null)&&a("config");for(let s of Object.keys(e))L.has(s)||a(`unknown key "${s.slice(0,32)}"`);(typeof e.clientToken!="string"||e.clientToken.length===0)&&a("clientToken");let o={clientToken:e.clientToken};e.apiOrigin!==void 0&&(typeof e.apiOrigin=="string"&&(/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(e.apiOrigin)||__DEV__&&A.test(e.apiOrigin))||a("apiOrigin"),o.apiOrigin=e.apiOrigin),e.locale!==void 0&&(I.has(e.locale)||a("locale"),o.locale=e.locale);let t=e.theme;if(t){if(t.colors){let s={};for(let[r,i]of Object.entries(t.colors))if(i!==void 0){if(V.includes(r)){__DEV__&&!g&&(g=!0,console.warn("[sekyro] theme.colors.danger/success/warning are ignored: status colours are standard (removed in 1.0)"));continue}(!F.includes(r)||typeof i!="string"||!M.test(i))&&a(`theme.colors.${r.slice(0,32)}`),s[r]=i}o.colors=s}t.radius!==void 0&&((typeof t.radius!="number"||!Number.isFinite(t.radius)||t.radius<0||t.radius>32)&&a("theme.radius"),o.radius=t.radius),t.fontFamily!==void 0&&((typeof t.fontFamily!="string"||!/^[\w .-]{1,64}$/.test(t.fontFamily))&&a("theme.fontFamily"),o.fontFamily=t.fontFamily),t.darkMode!==void 0&&(["system","light","dark"].includes(t.darkMode)||a("theme.darkMode"),o.darkMode=t.darkMode)}if(e.strings){e.locale||a("strings need locale");let s=e.strings[e.locale]??{},r={},i=Object.entries(s).filter(([,n])=>n!==void 0);i.length>D&&a("strings (too many overrides)");for(let[n,f]of i)/^[a-zA-Z0-9_.]{1,96}$/.test(n)||a("strings key"),(typeof f!="string"||f.length>2e3)&&a(`strings.${n}`),r[n]=f;o.strings=r}return o}var $=new Set(["method","phone_otp","email_otp","registry","document","nfc","liveness","processing","result","update_required","eid","contact_choice","identity_summary","portrait","proof_of_address","form"]);function v(e){if(e.type==="waiting_for_network")return{type:"waiting_for_network"};if(e.type!=="step"||!$.has(e.step))return null;let o=e.step,t=typeof e.retryReason=="string"&&/^[a-z0-9_]{1,64}$/.test(e.retryReason)?e.retryReason:void 0;return t?{type:"step",step:o,retryReason:t}:{type:"step",step:o}}var P=new Set(["verified","review_pending","not_verified"]),j=new Set([0,1,2,3]),K=new Set(["no_testers","tester_gate_not_used","tester_gate_missed"]);function u(e){return typeof e=="string"&&e!==""}function _(e){if(e.status==="cancelled")return{status:"cancelled"};if(e.status==="failed")return{status:"failed",code:e.code||"unknown_error"};if(e.status==="finished"&&e.sessionId){let o=P.has(e.displayStatus),t=o?e.displayStatus:"not_verified",s=t==="not_verified",r=e.sandbox?.reason;return{status:"finished",sessionId:e.sessionId,displayStatus:t,...typeof e.level=="number"&&j.has(e.level)?{level:e.level}:{},...u(e.assurance)?{assurance:e.assurance}:{},...s&&o&&u(e.reason)?{reason:e.reason}:{},...s&&o&&u(e.reasonCode)?{reasonCode:e.reasonCode}:{},...u(r)&&K.has(r)?{sandbox:{simulated:!0,reason:r}}:{}}}return{status:"failed",code:"unknown_error"}}function E(){if(!c)throw new l("unsupported_platform","the SekyroReactNative native module is not linked (New Architecture app, pod install / Gradle sync)");return c}var S=!1,Y=new Set(["no_activity","unsupported_platform","flow_in_progress","invalid_config"]);async function y(e){let o=m(e),t=E();if(S)throw new l("flow_in_progress");S=!0;let s=e.onEvent,r=s?t.onEvent(i=>{let n=v(i);n&&s(n)}):void 0;try{return _(await t.start(o))}catch(i){let n=i?.code;if(typeof n=="string"&&Y.has(n))throw new l(n);return{status:"failed",code:"unknown_error"}}finally{r?.remove(),S=!1}}function R(){return E().nativeVersion()}var d=require("react");function N(e){let o=(0,d.useRef)(null),t=(0,d.useRef)(e);return t.current=e,(0,d.useEffect)(()=>{if(o.current===e.clientToken)return;o.current=e.clientToken;let{onResult:s,onEvent:r,...i}=t.current;y({...i,onEvent:n=>t.current.onEvent?.(n)}).then(n=>t.current.onResult(n),n=>t.current.onResult({status:"failed",code:n instanceof l?n.code:"unknown_error"}))},[e.clientToken]),null}var w="0.1.0-rc.40";0&&(module.exports={SDK_VERSION,SekyroError,SekyroFlow,nativeVersion,startSekyro});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
/** UI language of the native flow
|
|
1
|
+
/** UI language of the native flow; every screen is translated in each of the six (spec 2026-10-29 §9). @public */
|
|
2
2
|
type SekyroLocale = 'ar' | 'fr' | 'en' | 'es' | 'pt' | 'de';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Themeable colour roles, shared by the Android and iOS cores. `danger`, `success` and `warning` are deprecated: status
|
|
5
|
+
* colours are standard since 0.1.0-rc.9, the SDK ignores them and they will be removed in 1.0. @public
|
|
6
|
+
*/
|
|
4
7
|
type SekyroColorRole = 'brand' | 'brandFg' | 'bg' | 'surface' | 'fg' | 'fgMuted' | 'border' | 'danger' | 'success' | 'warning';
|
|
5
8
|
/** Runtime theme applied over the native defaults. @public */
|
|
6
9
|
interface SekyroTheme {
|
|
7
10
|
/** `'#RRGGBB'` per role. */
|
|
8
|
-
colors?: Partial<Record<SekyroColorRole, string
|
|
11
|
+
colors?: Partial<Record<Exclude<SekyroColorRole, 'danger' | 'success' | 'warning'>, string>> & {
|
|
12
|
+
/** @deprecated Status colours are standard since 0.1.0-rc.9; this key is ignored and will be removed in 1.0. */
|
|
13
|
+
danger?: string;
|
|
14
|
+
/** @deprecated Status colours are standard since 0.1.0-rc.9; this key is ignored and will be removed in 1.0. */
|
|
15
|
+
success?: string;
|
|
16
|
+
/** @deprecated Status colours are standard since 0.1.0-rc.9; this key is ignored and will be removed in 1.0. */
|
|
17
|
+
warning?: string;
|
|
18
|
+
};
|
|
9
19
|
/** Corner radius in dp / pt, 0–32. */
|
|
10
20
|
radius?: number;
|
|
11
21
|
/**
|
|
@@ -20,10 +30,12 @@ interface SekyroTheme {
|
|
|
20
30
|
/**
|
|
21
31
|
* Screen of the native flow, as reported by step events (`eid`: the national eID sign-in, SDK spec §3.2).
|
|
22
32
|
* Flow model 2026-10-23: `contact_choice` (phone or email), `identity_summary` (check the details read — the event never
|
|
23
|
-
* carries them), `portrait` (the ICAO portrait on its own)
|
|
33
|
+
* carries them), `portrait` (the ICAO portrait on its own), `proof_of_address` (a recent document with the person's
|
|
34
|
+
* address, or the bill holder's letter; spec 2026-11-10), `form` (the partner's questions and consents; spec 2026-11-14,
|
|
35
|
+
* the event never carries the answers). `consent` is never emitted (consent is one line on the first
|
|
24
36
|
* screen); it stays in the union only because the public API may only grow. @public
|
|
25
37
|
*/
|
|
26
|
-
type SekyroStep = 'consent' | 'method' | 'phone_otp' | 'email_otp' | 'registry' | 'document' | 'nfc' | 'liveness' | 'processing' | 'result' | 'update_required' | 'eid' | 'contact_choice' | 'identity_summary' | 'portrait';
|
|
38
|
+
type SekyroStep = 'consent' | 'method' | 'phone_otp' | 'email_otp' | 'registry' | 'document' | 'nfc' | 'liveness' | 'processing' | 'result' | 'update_required' | 'eid' | 'contact_choice' | 'identity_summary' | 'portrait' | 'proof_of_address' | 'form';
|
|
27
39
|
/** Telemetry only; carries no personal data. @public */
|
|
28
40
|
type SekyroEvent = {
|
|
29
41
|
type: 'step';
|
|
@@ -36,11 +48,11 @@ type SekyroEvent = {
|
|
|
36
48
|
interface SekyroConfig {
|
|
37
49
|
/** One-time session token from your backend (`sessions.create`). Never logged. */
|
|
38
50
|
clientToken: string;
|
|
39
|
-
/**
|
|
51
|
+
/** Leave unset: the default, `https://api.sekyro.ai`, serves Sandbox and Live sessions. */
|
|
40
52
|
apiOrigin?: string;
|
|
41
53
|
/**
|
|
42
|
-
* UI language of the flow; required when `strings` is set.
|
|
43
|
-
*
|
|
54
|
+
* UI language of the flow; required when `strings` is set. Without it, the device language when it is one of the
|
|
55
|
+
* six, else French.
|
|
44
56
|
*/
|
|
45
57
|
locale?: SekyroLocale;
|
|
46
58
|
/** Colours, radius, font and colour scheme. */
|
|
@@ -51,15 +63,68 @@ interface SekyroConfig {
|
|
|
51
63
|
onEvent?: (event: SekyroEvent) => void;
|
|
52
64
|
}
|
|
53
65
|
/**
|
|
54
|
-
* What the end user was shown; not the decision. `
|
|
55
|
-
|
|
66
|
+
* What the end user was shown; not the decision. `not_verified` comes with a {@link SekyroSessionReason}. @public
|
|
67
|
+
*/
|
|
68
|
+
type SekyroDisplayStatus = 'verified' | 'review_pending' | 'not_verified';
|
|
69
|
+
/**
|
|
70
|
+
* Why a session ended `not_verified`: `rejected` (a check failed), `inconclusive` (no verdict could be reached),
|
|
71
|
+
* `unavailable` (a check could not run), `abandoned` (the person started but the session expired before a result),
|
|
72
|
+
* `not_opened` (the link was sent but the session expired before it was opened), `policy` (a flow rule stopped it),
|
|
73
|
+
* `cancelled` (your organization cancelled it) or `superseded` (a newer session of the same person took over). A newer server may add one; it is passed through as its string. @public
|
|
74
|
+
*/
|
|
75
|
+
type SekyroSessionReason = 'rejected' | 'inconclusive' | 'unavailable' | 'abandoned' | 'not_opened' | 'policy' | 'cancelled' | 'superseded';
|
|
76
|
+
/**
|
|
77
|
+
* Why a Sandbox session ran on simulated test data: `no_testers` (the organization has no active Sandbox tester),
|
|
78
|
+
* `tester_gate_not_used` (nobody ran the tester check at the start of the session) or `tester_gate_missed` (the tester
|
|
79
|
+
* check ran and recognized nobody). @public
|
|
80
|
+
*/
|
|
81
|
+
type SekyroSandboxSimulatedReason = 'no_testers' | 'tester_gate_not_used' | 'tester_gate_missed';
|
|
82
|
+
/**
|
|
83
|
+
* Set on the finished result of a Sandbox session that ran on simulated test data: no real check ran, so the outcome
|
|
84
|
+
* says nothing about the person. @public
|
|
56
85
|
*/
|
|
57
|
-
|
|
86
|
+
interface SekyroSandboxSimulation {
|
|
87
|
+
/** Always `true`. */
|
|
88
|
+
simulated: true;
|
|
89
|
+
/** Why the session ran on simulated test data. */
|
|
90
|
+
reason: SekyroSandboxSimulatedReason;
|
|
91
|
+
}
|
|
92
|
+
/** The level a finished session proved: 1 Contact, 2 Human, 3 Identity; 0 when nothing was proven. @public */
|
|
93
|
+
type SekyroLevel = 0 | 1 | 2 | 3;
|
|
58
94
|
/** Display-only outcome; read the decision server-side (webhooks / `sessions.get`). @public */
|
|
59
95
|
type SekyroResult = {
|
|
60
96
|
status: 'finished';
|
|
61
97
|
sessionId: string;
|
|
62
98
|
displayStatus: SekyroDisplayStatus;
|
|
99
|
+
/**
|
|
100
|
+
* What the session proved (1 Contact, 2 Human, 3 Identity; 0 when nothing was proven), when the native SDK
|
|
101
|
+
* reports it. Absent when the session closed without one (for example a link nobody opened). A display hint: a
|
|
102
|
+
* check for a real person is `level >= 2` and for identity `level >= 3`, on your server.
|
|
103
|
+
*/
|
|
104
|
+
level?: SekyroLevel;
|
|
105
|
+
/**
|
|
106
|
+
* How `level` was proved: `device_only`, `contact_email`, `contact_phone`, `unbound_identity` (level 1),
|
|
107
|
+
* `live_only`, `live_unique` (level 2), `supplied_biometric`, `document_biometric`, `eid_authenticated`,
|
|
108
|
+
* `chip_biometric` or `registry_biometric` (level 3); a newer server may add one. Absent when the server reports
|
|
109
|
+
* none. To require a particular proof, compare it with a list on your server.
|
|
110
|
+
*/
|
|
111
|
+
assurance?: string;
|
|
112
|
+
/**
|
|
113
|
+
* `not_verified` only: why, when the native SDK reports it. Absent on `verified` and `review_pending`, and when the
|
|
114
|
+
* session did not say.
|
|
115
|
+
*/
|
|
116
|
+
reason?: SekyroSessionReason | (string & {});
|
|
117
|
+
/**
|
|
118
|
+
* `not_verified` only: the machine-readable code behind `reason` (for example `device_cooldown`), when there is one.
|
|
119
|
+
* `identity_not_verified` (with `reason: 'rejected'`) is the neutral end the person saw: the session's real outcome
|
|
120
|
+
* and reason are on your server (`GET /v1/sessions/{id}`, webhooks).
|
|
121
|
+
*/
|
|
122
|
+
reasonCode?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Present when a Sandbox session ran on simulated test data, with why. Absent in Live, on a Sandbox session an
|
|
125
|
+
* enrolled tester ran, and when the native SDK does not report it.
|
|
126
|
+
*/
|
|
127
|
+
sandbox?: SekyroSandboxSimulation;
|
|
63
128
|
} | {
|
|
64
129
|
status: 'cancelled';
|
|
65
130
|
} | {
|
|
@@ -74,7 +139,7 @@ type SekyroResult = {
|
|
|
74
139
|
*/
|
|
75
140
|
declare function startSekyro(config: SekyroConfig): Promise<SekyroResult>;
|
|
76
141
|
/**
|
|
77
|
-
* Version of the bundled native core: `'android 0.1.0-rc.
|
|
142
|
+
* Version of the bundled native core: `'android 0.1.0-rc.32'` / `'ios 0.1.0-rc.32'`.
|
|
78
143
|
* @public
|
|
79
144
|
*/
|
|
80
145
|
declare function nativeVersion(): string;
|
|
@@ -106,4 +171,4 @@ declare class SekyroError extends Error {
|
|
|
106
171
|
*/
|
|
107
172
|
declare const SDK_VERSION: string;
|
|
108
173
|
|
|
109
|
-
export { SDK_VERSION, type SekyroColorRole, type SekyroConfig, type SekyroDisplayStatus, SekyroError, type SekyroErrorCode, type SekyroEvent, SekyroFlow, type SekyroFlowProps, type SekyroLocale, type SekyroResult, type SekyroStep, type SekyroTheme, nativeVersion, startSekyro };
|
|
174
|
+
export { SDK_VERSION, type SekyroColorRole, type SekyroConfig, type SekyroDisplayStatus, SekyroError, type SekyroErrorCode, type SekyroEvent, SekyroFlow, type SekyroFlowProps, type SekyroLevel, type SekyroLocale, type SekyroResult, type SekyroSandboxSimulatedReason, type SekyroSandboxSimulation, type SekyroSessionReason, type SekyroStep, type SekyroTheme, nativeVersion, startSekyro };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
/** UI language of the native flow
|
|
1
|
+
/** UI language of the native flow; every screen is translated in each of the six (spec 2026-10-29 §9). @public */
|
|
2
2
|
type SekyroLocale = 'ar' | 'fr' | 'en' | 'es' | 'pt' | 'de';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Themeable colour roles, shared by the Android and iOS cores. `danger`, `success` and `warning` are deprecated: status
|
|
5
|
+
* colours are standard since 0.1.0-rc.9, the SDK ignores them and they will be removed in 1.0. @public
|
|
6
|
+
*/
|
|
4
7
|
type SekyroColorRole = 'brand' | 'brandFg' | 'bg' | 'surface' | 'fg' | 'fgMuted' | 'border' | 'danger' | 'success' | 'warning';
|
|
5
8
|
/** Runtime theme applied over the native defaults. @public */
|
|
6
9
|
interface SekyroTheme {
|
|
7
10
|
/** `'#RRGGBB'` per role. */
|
|
8
|
-
colors?: Partial<Record<SekyroColorRole, string
|
|
11
|
+
colors?: Partial<Record<Exclude<SekyroColorRole, 'danger' | 'success' | 'warning'>, string>> & {
|
|
12
|
+
/** @deprecated Status colours are standard since 0.1.0-rc.9; this key is ignored and will be removed in 1.0. */
|
|
13
|
+
danger?: string;
|
|
14
|
+
/** @deprecated Status colours are standard since 0.1.0-rc.9; this key is ignored and will be removed in 1.0. */
|
|
15
|
+
success?: string;
|
|
16
|
+
/** @deprecated Status colours are standard since 0.1.0-rc.9; this key is ignored and will be removed in 1.0. */
|
|
17
|
+
warning?: string;
|
|
18
|
+
};
|
|
9
19
|
/** Corner radius in dp / pt, 0–32. */
|
|
10
20
|
radius?: number;
|
|
11
21
|
/**
|
|
@@ -20,10 +30,12 @@ interface SekyroTheme {
|
|
|
20
30
|
/**
|
|
21
31
|
* Screen of the native flow, as reported by step events (`eid`: the national eID sign-in, SDK spec §3.2).
|
|
22
32
|
* Flow model 2026-10-23: `contact_choice` (phone or email), `identity_summary` (check the details read — the event never
|
|
23
|
-
* carries them), `portrait` (the ICAO portrait on its own)
|
|
33
|
+
* carries them), `portrait` (the ICAO portrait on its own), `proof_of_address` (a recent document with the person's
|
|
34
|
+
* address, or the bill holder's letter; spec 2026-11-10), `form` (the partner's questions and consents; spec 2026-11-14,
|
|
35
|
+
* the event never carries the answers). `consent` is never emitted (consent is one line on the first
|
|
24
36
|
* screen); it stays in the union only because the public API may only grow. @public
|
|
25
37
|
*/
|
|
26
|
-
type SekyroStep = 'consent' | 'method' | 'phone_otp' | 'email_otp' | 'registry' | 'document' | 'nfc' | 'liveness' | 'processing' | 'result' | 'update_required' | 'eid' | 'contact_choice' | 'identity_summary' | 'portrait';
|
|
38
|
+
type SekyroStep = 'consent' | 'method' | 'phone_otp' | 'email_otp' | 'registry' | 'document' | 'nfc' | 'liveness' | 'processing' | 'result' | 'update_required' | 'eid' | 'contact_choice' | 'identity_summary' | 'portrait' | 'proof_of_address' | 'form';
|
|
27
39
|
/** Telemetry only; carries no personal data. @public */
|
|
28
40
|
type SekyroEvent = {
|
|
29
41
|
type: 'step';
|
|
@@ -36,11 +48,11 @@ type SekyroEvent = {
|
|
|
36
48
|
interface SekyroConfig {
|
|
37
49
|
/** One-time session token from your backend (`sessions.create`). Never logged. */
|
|
38
50
|
clientToken: string;
|
|
39
|
-
/**
|
|
51
|
+
/** Leave unset: the default, `https://api.sekyro.ai`, serves Sandbox and Live sessions. */
|
|
40
52
|
apiOrigin?: string;
|
|
41
53
|
/**
|
|
42
|
-
* UI language of the flow; required when `strings` is set.
|
|
43
|
-
*
|
|
54
|
+
* UI language of the flow; required when `strings` is set. Without it, the device language when it is one of the
|
|
55
|
+
* six, else French.
|
|
44
56
|
*/
|
|
45
57
|
locale?: SekyroLocale;
|
|
46
58
|
/** Colours, radius, font and colour scheme. */
|
|
@@ -51,15 +63,68 @@ interface SekyroConfig {
|
|
|
51
63
|
onEvent?: (event: SekyroEvent) => void;
|
|
52
64
|
}
|
|
53
65
|
/**
|
|
54
|
-
* What the end user was shown; not the decision. `
|
|
55
|
-
|
|
66
|
+
* What the end user was shown; not the decision. `not_verified` comes with a {@link SekyroSessionReason}. @public
|
|
67
|
+
*/
|
|
68
|
+
type SekyroDisplayStatus = 'verified' | 'review_pending' | 'not_verified';
|
|
69
|
+
/**
|
|
70
|
+
* Why a session ended `not_verified`: `rejected` (a check failed), `inconclusive` (no verdict could be reached),
|
|
71
|
+
* `unavailable` (a check could not run), `abandoned` (the person started but the session expired before a result),
|
|
72
|
+
* `not_opened` (the link was sent but the session expired before it was opened), `policy` (a flow rule stopped it),
|
|
73
|
+
* `cancelled` (your organization cancelled it) or `superseded` (a newer session of the same person took over). A newer server may add one; it is passed through as its string. @public
|
|
74
|
+
*/
|
|
75
|
+
type SekyroSessionReason = 'rejected' | 'inconclusive' | 'unavailable' | 'abandoned' | 'not_opened' | 'policy' | 'cancelled' | 'superseded';
|
|
76
|
+
/**
|
|
77
|
+
* Why a Sandbox session ran on simulated test data: `no_testers` (the organization has no active Sandbox tester),
|
|
78
|
+
* `tester_gate_not_used` (nobody ran the tester check at the start of the session) or `tester_gate_missed` (the tester
|
|
79
|
+
* check ran and recognized nobody). @public
|
|
80
|
+
*/
|
|
81
|
+
type SekyroSandboxSimulatedReason = 'no_testers' | 'tester_gate_not_used' | 'tester_gate_missed';
|
|
82
|
+
/**
|
|
83
|
+
* Set on the finished result of a Sandbox session that ran on simulated test data: no real check ran, so the outcome
|
|
84
|
+
* says nothing about the person. @public
|
|
56
85
|
*/
|
|
57
|
-
|
|
86
|
+
interface SekyroSandboxSimulation {
|
|
87
|
+
/** Always `true`. */
|
|
88
|
+
simulated: true;
|
|
89
|
+
/** Why the session ran on simulated test data. */
|
|
90
|
+
reason: SekyroSandboxSimulatedReason;
|
|
91
|
+
}
|
|
92
|
+
/** The level a finished session proved: 1 Contact, 2 Human, 3 Identity; 0 when nothing was proven. @public */
|
|
93
|
+
type SekyroLevel = 0 | 1 | 2 | 3;
|
|
58
94
|
/** Display-only outcome; read the decision server-side (webhooks / `sessions.get`). @public */
|
|
59
95
|
type SekyroResult = {
|
|
60
96
|
status: 'finished';
|
|
61
97
|
sessionId: string;
|
|
62
98
|
displayStatus: SekyroDisplayStatus;
|
|
99
|
+
/**
|
|
100
|
+
* What the session proved (1 Contact, 2 Human, 3 Identity; 0 when nothing was proven), when the native SDK
|
|
101
|
+
* reports it. Absent when the session closed without one (for example a link nobody opened). A display hint: a
|
|
102
|
+
* check for a real person is `level >= 2` and for identity `level >= 3`, on your server.
|
|
103
|
+
*/
|
|
104
|
+
level?: SekyroLevel;
|
|
105
|
+
/**
|
|
106
|
+
* How `level` was proved: `device_only`, `contact_email`, `contact_phone`, `unbound_identity` (level 1),
|
|
107
|
+
* `live_only`, `live_unique` (level 2), `supplied_biometric`, `document_biometric`, `eid_authenticated`,
|
|
108
|
+
* `chip_biometric` or `registry_biometric` (level 3); a newer server may add one. Absent when the server reports
|
|
109
|
+
* none. To require a particular proof, compare it with a list on your server.
|
|
110
|
+
*/
|
|
111
|
+
assurance?: string;
|
|
112
|
+
/**
|
|
113
|
+
* `not_verified` only: why, when the native SDK reports it. Absent on `verified` and `review_pending`, and when the
|
|
114
|
+
* session did not say.
|
|
115
|
+
*/
|
|
116
|
+
reason?: SekyroSessionReason | (string & {});
|
|
117
|
+
/**
|
|
118
|
+
* `not_verified` only: the machine-readable code behind `reason` (for example `device_cooldown`), when there is one.
|
|
119
|
+
* `identity_not_verified` (with `reason: 'rejected'`) is the neutral end the person saw: the session's real outcome
|
|
120
|
+
* and reason are on your server (`GET /v1/sessions/{id}`, webhooks).
|
|
121
|
+
*/
|
|
122
|
+
reasonCode?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Present when a Sandbox session ran on simulated test data, with why. Absent in Live, on a Sandbox session an
|
|
125
|
+
* enrolled tester ran, and when the native SDK does not report it.
|
|
126
|
+
*/
|
|
127
|
+
sandbox?: SekyroSandboxSimulation;
|
|
63
128
|
} | {
|
|
64
129
|
status: 'cancelled';
|
|
65
130
|
} | {
|
|
@@ -74,7 +139,7 @@ type SekyroResult = {
|
|
|
74
139
|
*/
|
|
75
140
|
declare function startSekyro(config: SekyroConfig): Promise<SekyroResult>;
|
|
76
141
|
/**
|
|
77
|
-
* Version of the bundled native core: `'android 0.1.0-rc.
|
|
142
|
+
* Version of the bundled native core: `'android 0.1.0-rc.32'` / `'ios 0.1.0-rc.32'`.
|
|
78
143
|
* @public
|
|
79
144
|
*/
|
|
80
145
|
declare function nativeVersion(): string;
|
|
@@ -106,4 +171,4 @@ declare class SekyroError extends Error {
|
|
|
106
171
|
*/
|
|
107
172
|
declare const SDK_VERSION: string;
|
|
108
173
|
|
|
109
|
-
export { SDK_VERSION, type SekyroColorRole, type SekyroConfig, type SekyroDisplayStatus, SekyroError, type SekyroErrorCode, type SekyroEvent, SekyroFlow, type SekyroFlowProps, type SekyroLocale, type SekyroResult, type SekyroStep, type SekyroTheme, nativeVersion, startSekyro };
|
|
174
|
+
export { SDK_VERSION, type SekyroColorRole, type SekyroConfig, type SekyroDisplayStatus, SekyroError, type SekyroErrorCode, type SekyroEvent, SekyroFlow, type SekyroFlowProps, type SekyroLevel, type SekyroLocale, type SekyroResult, type SekyroSandboxSimulatedReason, type SekyroSandboxSimulation, type SekyroSessionReason, type SekyroStep, type SekyroTheme, nativeVersion, startSekyro };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{TurboModuleRegistry as
|
|
1
|
+
import{TurboModuleRegistry as _}from"react-native";var y=_.get("SekyroReactNative");var l=class extends Error{code;constructor(o,t=o){super(t),this.name="SekyroError",this.code=o}};var E=500,R=new Set(["ar","fr","en","es","pt","de"]),N=["brand","brandFg","bg","surface","fg","fgMuted","border"],w=["danger","success","warning"],c=!1,b=new Set(["clientToken","apiOrigin","locale","theme","strings","onEvent"]),x=/^#[0-9a-fA-F]{6}$/,h=/^http:\/\/(localhost|127\.0\.0\.1|10\.0\.2\.2)(:\d+)?$/,a=e=>{throw new l("invalid_config",`invalid config: ${e}`)};function S(e){(typeof e!="object"||e===null)&&a("config");for(let n of Object.keys(e))b.has(n)||a(`unknown key "${n.slice(0,32)}"`);(typeof e.clientToken!="string"||e.clientToken.length===0)&&a("clientToken");let o={clientToken:e.clientToken};e.apiOrigin!==void 0&&(typeof e.apiOrigin=="string"&&(/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(e.apiOrigin)||__DEV__&&h.test(e.apiOrigin))||a("apiOrigin"),o.apiOrigin=e.apiOrigin),e.locale!==void 0&&(R.has(e.locale)||a("locale"),o.locale=e.locale);let t=e.theme;if(t){if(t.colors){let n={};for(let[s,i]of Object.entries(t.colors))if(i!==void 0){if(w.includes(s)){__DEV__&&!c&&(c=!0,console.warn("[sekyro] theme.colors.danger/success/warning are ignored: status colours are standard (removed in 1.0)"));continue}(!N.includes(s)||typeof i!="string"||!x.test(i))&&a(`theme.colors.${s.slice(0,32)}`),n[s]=i}o.colors=n}t.radius!==void 0&&((typeof t.radius!="number"||!Number.isFinite(t.radius)||t.radius<0||t.radius>32)&&a("theme.radius"),o.radius=t.radius),t.fontFamily!==void 0&&((typeof t.fontFamily!="string"||!/^[\w .-]{1,64}$/.test(t.fontFamily))&&a("theme.fontFamily"),o.fontFamily=t.fontFamily),t.darkMode!==void 0&&(["system","light","dark"].includes(t.darkMode)||a("theme.darkMode"),o.darkMode=t.darkMode)}if(e.strings){e.locale||a("strings need locale");let n=e.strings[e.locale]??{},s={},i=Object.entries(n).filter(([,r])=>r!==void 0);i.length>E&&a("strings (too many overrides)");for(let[r,u]of i)/^[a-zA-Z0-9_.]{1,96}$/.test(r)||a("strings key"),(typeof u!="string"||u.length>2e3)&&a(`strings.${r}`),s[r]=u;o.strings=s}return o}var C=new Set(["method","phone_otp","email_otp","registry","document","nfc","liveness","processing","result","update_required","eid","contact_choice","identity_summary","portrait","proof_of_address","form"]);function k(e){if(e.type==="waiting_for_network")return{type:"waiting_for_network"};if(e.type!=="step"||!C.has(e.step))return null;let o=e.step,t=typeof e.retryReason=="string"&&/^[a-z0-9_]{1,64}$/.test(e.retryReason)?e.retryReason:void 0;return t?{type:"step",step:o,retryReason:t}:{type:"step",step:o}}var O=new Set(["verified","review_pending","not_verified"]),T=new Set([0,1,2,3]),D=new Set(["no_testers","tester_gate_not_used","tester_gate_missed"]);function d(e){return typeof e=="string"&&e!==""}function g(e){if(e.status==="cancelled")return{status:"cancelled"};if(e.status==="failed")return{status:"failed",code:e.code||"unknown_error"};if(e.status==="finished"&&e.sessionId){let o=O.has(e.displayStatus),t=o?e.displayStatus:"not_verified",n=t==="not_verified",s=e.sandbox?.reason;return{status:"finished",sessionId:e.sessionId,displayStatus:t,...typeof e.level=="number"&&T.has(e.level)?{level:e.level}:{},...d(e.assurance)?{assurance:e.assurance}:{},...n&&o&&d(e.reason)?{reason:e.reason}:{},...n&&o&&d(e.reasonCode)?{reasonCode:e.reasonCode}:{},...d(s)&&D.has(s)?{sandbox:{simulated:!0,reason:s}}:{}}}return{status:"failed",code:"unknown_error"}}function m(){if(!y)throw new l("unsupported_platform","the SekyroReactNative native module is not linked (New Architecture app, pod install / Gradle sync)");return y}var f=!1,I=new Set(["no_activity","unsupported_platform","flow_in_progress","invalid_config"]);async function p(e){let o=S(e),t=m();if(f)throw new l("flow_in_progress");f=!0;let n=e.onEvent,s=n?t.onEvent(i=>{let r=k(i);r&&n(r)}):void 0;try{return g(await t.start(o))}catch(i){let r=i?.code;if(typeof r=="string"&&I.has(r))throw new l(r);return{status:"failed",code:"unknown_error"}}finally{s?.remove(),f=!1}}function F(){return m().nativeVersion()}import{useEffect as V,useRef as v}from"react";function L(e){let o=v(null),t=v(e);return t.current=e,V(()=>{if(o.current===e.clientToken)return;o.current=e.clientToken;let{onResult:n,onEvent:s,...i}=t.current;p({...i,onEvent:r=>t.current.onEvent?.(r)}).then(r=>t.current.onResult(r),r=>t.current.onResult({status:"failed",code:r instanceof l?r.code:"unknown_error"}))},[e.clientToken]),null}var M="0.1.0-rc.40";export{M as SDK_VERSION,l as SekyroError,L as SekyroFlow,F as nativeVersion,p as startSekyro};
|
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
#else
|
|
7
7
|
#import "SekyroReactNative-Swift.h"
|
|
8
8
|
#endif
|
|
9
|
+
#import <React/RCTInvalidating.h>
|
|
10
|
+
|
|
11
|
+
// RCTInvalidating: React Native calls -invalidate when it tears this module down (reload, React instance or host
|
|
12
|
+
// destroyed). A flow still open then settles `failed / flow_interrupted`, as the Android module does.
|
|
13
|
+
@interface RCTSekyroReactNative () <RCTInvalidating>
|
|
14
|
+
@end
|
|
9
15
|
|
|
10
16
|
@implementation RCTSekyroReactNative
|
|
11
17
|
|
|
@@ -54,4 +60,13 @@
|
|
|
54
60
|
});
|
|
55
61
|
}
|
|
56
62
|
|
|
63
|
+
- (void)invalidate {
|
|
64
|
+
// SekyroRNBridge is main-actor state; React Native may call this from the module queue or the main thread.
|
|
65
|
+
if ([NSThread isMainThread]) {
|
|
66
|
+
[SekyroRNBridge invalidate];
|
|
67
|
+
} else {
|
|
68
|
+
dispatch_async(dispatch_get_main_queue(), ^{ [SekyroRNBridge invalidate]; });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
57
72
|
@end
|
package/ios/SekyroRNBridge.swift
CHANGED
|
@@ -5,7 +5,6 @@ import UIKit
|
|
|
5
5
|
|
|
6
6
|
@objc(SekyroRNBridge)
|
|
7
7
|
public final class SekyroRNBridge: NSObject {
|
|
8
|
-
@MainActor private static var running = false
|
|
9
8
|
@MainActor private static var seq: Int32 = 0
|
|
10
9
|
|
|
11
10
|
@objc public static func nativeVersion() -> String { "ios \(Sekyro.sdkVersion)" }
|
|
@@ -48,20 +47,78 @@ public final class SekyroRNBridge: NSObject {
|
|
|
48
47
|
let theme = SekyroTheme(
|
|
49
48
|
brand: try color("brand"), brandFg: try color("brandFg"), background: try color("bg"), surface: try color("surface"),
|
|
50
49
|
foreground: try color("fg"), foregroundMuted: try color("fgMuted"), border: try color("border"),
|
|
51
|
-
danger
|
|
50
|
+
// danger / success / warning are not read: status colours are standard (deprecated no-ops, removed in 1.0).
|
|
52
51
|
cornerRadius: radius, fontFamily: d["fontFamily"] as? String, darkMode: mode, strings: strings)
|
|
53
52
|
return SekyroConfig(clientToken: token, apiOrigin: origin, locale: locale, theme: theme)
|
|
54
53
|
}
|
|
55
54
|
|
|
55
|
+
/// The native SDK's own wire form (`SekyroWire.dictionary`): status, session id, display status (`verified`,
|
|
56
|
+
/// `review_pending`, `not_verified`), `reason` and `reasonCode` on `not_verified`, `level` and `assurance` when known,
|
|
57
|
+
/// `sandbox` (`{ simulated: true, reason }`) when a Sandbox session ran on simulated test data,
|
|
58
|
+
/// and the failure code, without matching the result's associated values here.
|
|
56
59
|
static func wire(_ result: SekyroResult) -> NSDictionary {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
SekyroWire.dictionary(result) as NSDictionary
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/// What the promise of a flow torn down before its result resolves (the Android module's `invalidate` does the same).
|
|
64
|
+
static let interrupted: NSDictionary = ["status": "failed", "code": "flow_interrupted"]
|
|
65
|
+
|
|
66
|
+
/// One running flow. Its promise settles exactly once: with the flow's result (after the flow is dismissed), or
|
|
67
|
+
/// with `flow_interrupted` when the React instance is torn down or the flow goes away without a result.
|
|
68
|
+
@MainActor final class Run {
|
|
69
|
+
private var completion: ((NSDictionary) -> Void)?
|
|
70
|
+
/// The flow's result, held from the moment the flow hands it back until its dismissal ends.
|
|
71
|
+
private(set) var result: NSDictionary?
|
|
72
|
+
weak var flow: UIViewController?
|
|
73
|
+
|
|
74
|
+
init(completion: @escaping (NSDictionary) -> Void) { self.completion = completion }
|
|
75
|
+
|
|
76
|
+
var isSettled: Bool { completion == nil }
|
|
77
|
+
|
|
78
|
+
/// Records the flow's result; false when this run already has one or has settled (a late or duplicate result).
|
|
79
|
+
func record(_ result: NSDictionary) -> Bool {
|
|
80
|
+
guard self.result == nil, !isSettled else { return false }
|
|
81
|
+
self.result = result
|
|
82
|
+
return true
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/// Calls the completion once; later calls do nothing.
|
|
86
|
+
func settle(_ value: NSDictionary) {
|
|
87
|
+
guard let completion else { return }
|
|
88
|
+
self.completion = nil
|
|
89
|
+
completion(value)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/// The running flow, if any: one at a time.
|
|
94
|
+
@MainActor private(set) static var current: Run?
|
|
95
|
+
|
|
96
|
+
@MainActor static func begin(completion: @escaping (NSDictionary) -> Void) -> Run {
|
|
97
|
+
let run = Run(completion: completion)
|
|
98
|
+
current = run
|
|
99
|
+
return run
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/// Ends `run`: frees the module for the next flow and settles the promise (a no-op once settled).
|
|
103
|
+
@MainActor static func finish(_ run: Run, with value: NSDictionary) {
|
|
104
|
+
if current === run { current = nil }
|
|
105
|
+
run.settle(value)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/// The flow is gone (dismissed and released) or the React instance is going away: settle with the result the flow
|
|
109
|
+
/// already handed back, else `flow_interrupted`.
|
|
110
|
+
@MainActor static func end(_ run: Run) {
|
|
111
|
+
finish(run, with: run.result ?? interrupted)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/// Module invalidation (bridge reload, React instance teardown, new architecture host destroyed): closes a flow
|
|
115
|
+
/// that has no result yet and settles its promise, so the module is never left locked on `flow_in_progress`.
|
|
116
|
+
@MainActor @objc public static func invalidate() {
|
|
117
|
+
guard let run = current else { return }
|
|
118
|
+
if run.result == nil, let flow = run.flow, flow.presentingViewController != nil {
|
|
119
|
+
flow.dismiss(animated: false)
|
|
64
120
|
}
|
|
121
|
+
end(run)
|
|
65
122
|
}
|
|
66
123
|
|
|
67
124
|
/// Presents the drop-in. Returns nil when started, else an error code (`invalid_config`, `no_activity`, `flow_in_progress`).
|
|
@@ -69,12 +126,17 @@ public final class SekyroRNBridge: NSObject {
|
|
|
69
126
|
onEvent: @escaping (NSDictionary) -> Void,
|
|
70
127
|
completion: @escaping (NSDictionary) -> Void) -> String? {
|
|
71
128
|
guard let parsed = try? parse(config) else { return "invalid_config" }
|
|
72
|
-
guard
|
|
129
|
+
guard current == nil else { return "flow_in_progress" }
|
|
73
130
|
// UIKit only logs (and never calls back) when the presenter is off-window, mid-transition or
|
|
74
131
|
// already presenting — refuse up front so the promise can never stay pending.
|
|
75
132
|
guard let presenter = topViewController(), canPresent(from: presenter) else { return "no_activity" }
|
|
76
|
-
|
|
77
|
-
Sekyro.start(
|
|
133
|
+
let run = begin(completion: completion)
|
|
134
|
+
// Sekyro.start's own steps (present full screen, dismiss, then the result), with the flow kept in reach for a
|
|
135
|
+
// teardown and watched for going away without a result.
|
|
136
|
+
let flow = SekyroFlowViewController(config: parsed)
|
|
137
|
+
run.flow = flow
|
|
138
|
+
flow.onEvent = { event in
|
|
139
|
+
guard current === run, !run.isSettled else { return }
|
|
78
140
|
seq &+= 1
|
|
79
141
|
switch event {
|
|
80
142
|
case .step(let step, let reason):
|
|
@@ -84,10 +146,17 @@ public final class SekyroRNBridge: NSObject {
|
|
|
84
146
|
case .waitingForNetwork:
|
|
85
147
|
onEvent(["type": "waiting_for_network", "seq": NSNumber(value: seq)])
|
|
86
148
|
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
149
|
+
}
|
|
150
|
+
flow.onResult = { [weak flow] result in
|
|
151
|
+
guard run.record(wire(result)) else { return }
|
|
152
|
+
if let flow, flow.presentingViewController != nil {
|
|
153
|
+
flow.dismiss(animated: true) { end(run) }
|
|
154
|
+
} else {
|
|
155
|
+
end(run)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
FlowWatch.attach(to: flow) { end(run) }
|
|
159
|
+
presenter.present(flow, animated: true)
|
|
91
160
|
return nil
|
|
92
161
|
}
|
|
93
162
|
|
|
@@ -111,3 +180,21 @@ public final class SekyroRNBridge: NSObject {
|
|
|
111
180
|
&& presenter.presentedViewController == nil
|
|
112
181
|
}
|
|
113
182
|
}
|
|
183
|
+
|
|
184
|
+
/// Calls `onGone` on the main actor once the flow controller it is attached to is released: the flow left the screen
|
|
185
|
+
/// (its own dismissal after a result, or the app dismissing it or replacing its window) and nothing holds it any more.
|
|
186
|
+
final class FlowWatch: NSObject {
|
|
187
|
+
private static var key: UInt8 = 0
|
|
188
|
+
private let onGone: @MainActor () -> Void
|
|
189
|
+
|
|
190
|
+
private init(_ onGone: @escaping @MainActor () -> Void) { self.onGone = onGone }
|
|
191
|
+
|
|
192
|
+
static func attach(to object: AnyObject, onGone: @escaping @MainActor () -> Void) {
|
|
193
|
+
objc_setAssociatedObject(object, &key, FlowWatch(onGone), .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
deinit {
|
|
197
|
+
let onGone = onGone
|
|
198
|
+
Task { @MainActor in onGone() }
|
|
199
|
+
}
|
|
200
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sekyro/react-native",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.40",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Sekyro AI eKYC for React Native — glue over the binary Android and iOS SDKs (New Architecture)",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
101
|
"sekyro": {
|
|
102
|
-
"android": "0.1.0-rc.
|
|
103
|
-
"ios": "0.1.0-rc.
|
|
102
|
+
"android": "0.1.0-rc.32",
|
|
103
|
+
"ios": "0.1.0-rc.32"
|
|
104
104
|
}
|
|
105
105
|
}
|
package/sbom.cdx.json
CHANGED
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
"type": "application",
|
|
98
98
|
"name": "react-native",
|
|
99
99
|
"group": "@sekyro",
|
|
100
|
-
"version": "0.1.0-rc.
|
|
101
|
-
"bom-ref": "@sekyro/react-native@0.1.0-rc.
|
|
100
|
+
"version": "0.1.0-rc.40",
|
|
101
|
+
"bom-ref": "@sekyro/react-native@0.1.0-rc.40",
|
|
102
102
|
"description": "Sekyro AI eKYC for React Native — glue over the binary Android and iOS SDKs (New Architecture)",
|
|
103
103
|
"licenses": [
|
|
104
104
|
{
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
],
|
|
111
|
-
"purl": "pkg:npm/%40sekyro/react-native@0.1.0-rc.
|
|
111
|
+
"purl": "pkg:npm/%40sekyro/react-native@0.1.0-rc.40?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2FIBTIKAR-Technologies%2Fibtikar-identity.git%23sekyro-mobile%2Freact-native",
|
|
112
112
|
"externalReferences": [
|
|
113
113
|
{
|
|
114
114
|
"url": "https://github.com/IBTIKAR-Technologies/ibtikar-identity/issues",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"components": [],
|
|
148
148
|
"dependencies": [
|
|
149
149
|
{
|
|
150
|
-
"ref": "@sekyro/react-native@0.1.0-rc.
|
|
150
|
+
"ref": "@sekyro/react-native@0.1.0-rc.40"
|
|
151
151
|
}
|
|
152
152
|
]
|
|
153
153
|
}
|
|
@@ -31,7 +31,19 @@ export type NativeConfig = {
|
|
|
31
31
|
strings?: UnsafeObject;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
export type
|
|
34
|
+
export type NativeSandbox = { simulated?: boolean; reason?: string };
|
|
35
|
+
|
|
36
|
+
export type NativeResult = {
|
|
37
|
+
status: string;
|
|
38
|
+
sessionId?: string;
|
|
39
|
+
displayStatus?: string;
|
|
40
|
+
code?: string;
|
|
41
|
+
level?: Int32;
|
|
42
|
+
assurance?: string;
|
|
43
|
+
reason?: string;
|
|
44
|
+
reasonCode?: string;
|
|
45
|
+
sandbox?: NativeSandbox;
|
|
46
|
+
};
|
|
35
47
|
|
|
36
48
|
export type NativeEvent = { type: string; step?: string; retryReason?: string; seq: Int32 };
|
|
37
49
|
|