@sekyro/react-native 0.1.0-rc.3 → 0.1.0-rc.31

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 CHANGED
@@ -1,5 +1,187 @@
1
1
  # @sekyro/react-native
2
2
 
3
+ ## 0.1.0-rc.31
4
+
5
+ ### Patch Changes
6
+
7
+ - 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.
8
+
9
+ ## 0.1.0-rc.30
10
+
11
+ ### Patch Changes
12
+
13
+ - 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.
14
+
15
+ ## 0.1.0-rc.29
16
+
17
+ ### Patch Changes
18
+
19
+ - 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.
20
+
21
+ ## 0.1.0-rc.28
22
+
23
+ ### Patch Changes
24
+
25
+ - 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.
26
+
27
+ ## 0.1.0-rc.27
28
+
29
+ ### Patch Changes
30
+
31
+ - 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.
32
+
33
+ ## 0.1.0-rc.26
34
+
35
+ ### Patch Changes
36
+
37
+ - 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.
38
+
39
+ ## 0.1.0-rc.25
40
+
41
+ ### Patch Changes
42
+
43
+ - 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).
44
+
45
+ ## 0.1.0-rc.24
46
+
47
+ ### Patch Changes
48
+
49
+ - 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.
50
+ - 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.
51
+ - 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.
52
+ - 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.
53
+
54
+ ## 0.1.0-rc.23
55
+
56
+ ### Patch Changes
57
+
58
+ - 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.
59
+
60
+ ## 0.1.0-rc.22
61
+
62
+ ### Minor Changes
63
+
64
+ - 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.
65
+
66
+ ### Patch Changes
67
+
68
+ - 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`.
69
+
70
+ ## 0.1.0-rc.21
71
+
72
+ ### Patch Changes
73
+
74
+ - 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.
75
+
76
+ ## 0.1.0-rc.20
77
+
78
+ ### Minor Changes
79
+
80
+ - 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.
81
+
82
+ ## 0.1.0-rc.19
83
+
84
+ ### Patch Changes
85
+
86
+ - 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.
87
+
88
+ ## 0.1.0-rc.18
89
+
90
+ ### Patch Changes
91
+
92
+ - 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.
93
+
94
+ ## 0.1.0-rc.17
95
+
96
+ ### Patch Changes
97
+
98
+ - 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.
99
+
100
+ ## 0.1.0-rc.16
101
+
102
+ ### Minor Changes
103
+
104
+ - 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`.
105
+
106
+ ### Patch Changes
107
+
108
+ - 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.
109
+
110
+ ## 0.1.0-rc.15
111
+
112
+ ### Patch Changes
113
+
114
+ - 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.
115
+
116
+ ## 0.1.0-rc.14
117
+
118
+ ### Patch Changes
119
+
120
+ - 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.
121
+ - 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.
122
+
123
+ ## 0.1.0-rc.13
124
+
125
+ ### Patch Changes
126
+
127
+ - 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.
128
+ - 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.
129
+ - 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.
130
+
131
+ ## 0.1.0-rc.12
132
+
133
+ ### Patch Changes
134
+
135
+ - 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.
136
+
137
+ ## 0.1.0-rc.11
138
+
139
+ ### Patch Changes
140
+
141
+ - 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.
142
+
143
+ ## 0.1.0-rc.10
144
+
145
+ ### Patch Changes
146
+
147
+ - 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.
148
+
149
+ ## 0.1.0-rc.9
150
+
151
+ ### Patch Changes
152
+
153
+ - 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.
154
+
155
+ ## 0.1.0-rc.8
156
+
157
+ ### Patch Changes
158
+
159
+ - 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.
160
+
161
+ ## 0.1.0-rc.7
162
+
163
+ ### Patch Changes
164
+
165
+ - 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.
166
+
167
+ ## 0.1.0-rc.6
168
+
169
+ ### Patch Changes
170
+
171
+ - 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.
172
+
173
+ ## 0.1.0-rc.5
174
+
175
+ ### Patch Changes
176
+
177
+ - 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.
178
+
179
+ ## 0.1.0-rc.4
180
+
181
+ ### Patch Changes
182
+
183
+ - e914cee: Pins the native SDKs 0.1.0-rc.4 (Android `ai.sekyro:sekyro-bom`, iOS `sekyro-ios-dist`). Android: the liveness clip falls back through simpler video formats and every encoder on the phone before failing, a clip that is too large or a phone that cannot record shows its own message instead of "camera unavailable", and a failed liveness capture is reported to the backend (no image, no personal data). Both platforms: es, pt and de for Human sessions, the Human session copy and attribution link, the no-camera path with a permission-specific message when camera access is refused, the step-up face match latch, and the daily code limit notice.
184
+
3
185
  ## 0.1.0-rc.3
4
186
 
5
187
  ### 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 (consent, document, NFC chip, liveness) full screen and
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. A flow interrupted
71
- because the React instance was torn down resolves `{ status: 'failed', code: 'flow_interrupted' }`.
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.core.DisplayStatus
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"), danger = color(colors, "danger"),
43
- success = color(colors, "success"), warning = color(colors, "warning"),
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")) {
@@ -50,26 +50,48 @@ internal object ConfigMapper {
50
50
  clientToken = token,
51
51
  apiOrigin = m.str("apiOrigin"),
52
52
  locale = when (m.str("locale")) {
53
- "ar" -> SekyroLocale.AR; "fr" -> SekyroLocale.FR; "en" -> SekyroLocale.EN; else -> null
53
+ "ar" -> SekyroLocale.AR; "fr" -> SekyroLocale.FR; "en" -> SekyroLocale.EN
54
+ "es" -> SekyroLocale.ES; "pt" -> SekyroLocale.PT; "de" -> SekyroLocale.DE
55
+ else -> null
54
56
  },
55
57
  theme = theme,
56
58
  strings = strings,
57
59
  )
58
60
  }
59
61
 
60
- /** [into] is injectable so JVM tests can use a JavaOnlyMap (Arguments.createMap() needs the RN native libs). */
61
- fun toWire(r: SekyroResult, into: WritableMap = Arguments.createMap()): WritableMap = into.apply {
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 {
62
71
  when (r) {
63
72
  is SekyroResult.Finished -> {
64
73
  putString("status", "finished"); putString("sessionId", r.sessionId)
65
- // EXPIRED is a display status in JS too ({ status: 'finished', displayStatus: 'expired' }), as on iOS.
66
- putString("displayStatus", when (r.displayStatus) {
67
- DisplayStatus.APPROVED -> "approved"; DisplayStatus.REVIEW_PENDING -> "review_pending"
68
- DisplayStatus.REJECTED -> "rejected"; DisplayStatus.EXPIRED -> "expired"
69
- })
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
+ }
70
88
  }
71
89
  SekyroResult.Cancelled -> putString("status", "cancelled")
72
90
  is SekyroResult.Failed -> { putString("status", "failed"); putString("code", r.code) }
73
91
  }
74
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() }
75
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
- @Volatile private var pending: Promise? = null
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 = promise
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 = null
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: settle it rather than leak it.
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 u=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var C=(e,r)=>{for(var t in r)u(e,t,{get:r[t],enumerable:!0})},O=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of w(r))!h.call(e,i)&&i!==t&&u(e,i,{get:()=>r[i],enumerable:!(n=N(r,i))||n.enumerable});return e};var x=e=>O(u({},"__esModule",{value:!0}),e);var j={};C(j,{SDK_VERSION:()=>R,SekyroError:()=>l,SekyroFlow:()=>E,nativeVersion:()=>_,startSekyro:()=>y});module.exports=x(j);var S=require("react-native"),d=S.TurboModuleRegistry.get("SekyroReactNative");var l=class extends Error{code;constructor(r,t=r){super(t),this.name="SekyroError",this.code=r}};var b=500,T=new Set(["ar","fr","en"]),I=["brand","brandFg","bg","surface","fg","fgMuted","border","danger","success","warning"],F=new Set(["clientToken","apiOrigin","locale","theme","strings","onEvent"]),D=/^#[0-9a-fA-F]{6}$/,V=/^http:\/\/(localhost|127\.0\.0\.1|10\.0\.2\.2)(:\d+)?$/,a=e=>{throw new l("invalid_config",`invalid config: ${e}`)};function k(e){(typeof e!="object"||e===null)&&a("config");for(let n of Object.keys(e))F.has(n)||a(`unknown key "${n.slice(0,32)}"`);(typeof e.clientToken!="string"||e.clientToken.length===0)&&a("clientToken");let r={clientToken:e.clientToken};e.apiOrigin!==void 0&&(typeof e.apiOrigin=="string"&&(/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(e.apiOrigin)||__DEV__&&V.test(e.apiOrigin))||a("apiOrigin"),r.apiOrigin=e.apiOrigin),e.locale!==void 0&&(T.has(e.locale)||a("locale"),r.locale=e.locale);let t=e.theme;if(t){if(t.colors){let n={};for(let[i,s]of Object.entries(t.colors))s!==void 0&&((!I.includes(i)||typeof s!="string"||!D.test(s))&&a(`theme.colors.${i.slice(0,32)}`),n[i]=s);r.colors=n}t.radius!==void 0&&((typeof t.radius!="number"||!Number.isFinite(t.radius)||t.radius<0||t.radius>32)&&a("theme.radius"),r.radius=t.radius),t.fontFamily!==void 0&&((typeof t.fontFamily!="string"||!/^[\w .-]{1,64}$/.test(t.fontFamily))&&a("theme.fontFamily"),r.fontFamily=t.fontFamily),t.darkMode!==void 0&&(["system","light","dark"].includes(t.darkMode)||a("theme.darkMode"),r.darkMode=t.darkMode)}if(e.strings){e.locale||a("strings need locale");let n=e.strings[e.locale]??{},i={},s=Object.entries(n).filter(([,o])=>o!==void 0);s.length>b&&a("strings (too many overrides)");for(let[o,f]of s)/^[a-zA-Z0-9_.]{1,96}$/.test(o)||a("strings key"),(typeof f!="string"||f.length>2e3)&&a(`strings.${o}`),i[o]=f;r.strings=i}return r}var M=new Set(["method","phone_otp","email_otp","registry","document","nfc","liveness","processing","result","update_required","eid","contact_choice","identity_summary","portrait"]);function g(e){if(e.type==="waiting_for_network")return{type:"waiting_for_network"};if(e.type!=="step"||!M.has(e.step))return null;let r=e.step,t=typeof e.retryReason=="string"&&/^[a-z0-9_]{1,64}$/.test(e.retryReason)?e.retryReason:void 0;return t?{type:"step",step:r,retryReason:t}:{type:"step",step:r}}var $=new Set(["approved","review_pending","rejected","expired"]);function m(e){return e.status==="cancelled"?{status:"cancelled"}:e.status==="failed"?{status:"failed",code:e.code||"unknown_error"}:e.status==="finished"&&e.sessionId&&$.has(e.displayStatus)?{status:"finished",sessionId:e.sessionId,displayStatus:e.displayStatus}:{status:"failed",code:"unknown_error"}}function v(){if(!d)throw new l("unsupported_platform","the SekyroReactNative native module is not linked (New Architecture app, pod install / Gradle sync)");return d}var c=!1,A=new Set(["no_activity","unsupported_platform","flow_in_progress","invalid_config"]);async function y(e){let r=k(e),t=v();if(c)throw new l("flow_in_progress");c=!0;let n=e.onEvent,i=n?t.onEvent(s=>{let o=g(s);o&&n(o)}):void 0;try{return m(await t.start(r))}catch(s){let o=s?.code;if(typeof o=="string"&&A.has(o))throw new l(o);return{status:"failed",code:"unknown_error"}}finally{i?.remove(),c=!1}}function _(){return v().nativeVersion()}var p=require("react");function E(e){let r=(0,p.useRef)(null),t=(0,p.useRef)(e);return t.current=e,(0,p.useEffect)(()=>{if(r.current===e.clientToken)return;r.current=e.clientToken;let{onResult:n,onEvent:i,...s}=t.current;y({...s,onEvent:o=>t.current.onEvent?.(o)}).then(o=>t.current.onResult(o),o=>t.current.onResult({status:"failed",code:o instanceof l?o.code:"unknown_error"}))},[e.clientToken]),null}var R="0.1.0-rc.3";0&&(module.exports={SDK_VERSION,SekyroError,SekyroFlow,nativeVersion,startSekyro});
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.31";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. @public */
2
- type SekyroLocale = 'ar' | 'fr' | 'en';
3
- /** Themeable colour roles, shared by the Android and iOS cores. @public */
1
+ /** UI language of the native flow; every screen is translated in each of the six (spec 2026-10-29 §9). @public */
2
+ type SekyroLocale = 'ar' | 'fr' | 'en' | 'es' | 'pt' | 'de';
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). `consent` is never emitted (consent is one line on the first
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,9 +48,12 @@ type SekyroEvent = {
36
48
  interface SekyroConfig {
37
49
  /** One-time session token from your backend (`sessions.create`). Never logged. */
38
50
  clientToken: string;
39
- /** e.g. `'https://api-staging.sekyro.ai'`; defaults to production. */
51
+ /** Leave unset: the default, `https://api.sekyro.ai`, serves Sandbox and Live sessions. */
40
52
  apiOrigin?: string;
41
- /** UI language of the flow; required when `strings` is set. */
53
+ /**
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.
56
+ */
42
57
  locale?: SekyroLocale;
43
58
  /** Colours, radius, font and colour scheme. */
44
59
  theme?: SekyroTheme;
@@ -48,15 +63,68 @@ interface SekyroConfig {
48
63
  onEvent?: (event: SekyroEvent) => void;
49
64
  }
50
65
  /**
51
- * What the end user was shown; not the decision. `expired`: the session expired before it finished (the person was
52
- * asked to start again from your app), as on the native SDKs. @public
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
53
74
  */
54
- type SekyroDisplayStatus = 'approved' | 'review_pending' | 'rejected' | 'expired';
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
85
+ */
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;
55
94
  /** Display-only outcome; read the decision server-side (webhooks / `sessions.get`). @public */
56
95
  type SekyroResult = {
57
96
  status: 'finished';
58
97
  sessionId: string;
59
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;
60
128
  } | {
61
129
  status: 'cancelled';
62
130
  } | {
@@ -71,7 +139,7 @@ type SekyroResult = {
71
139
  */
72
140
  declare function startSekyro(config: SekyroConfig): Promise<SekyroResult>;
73
141
  /**
74
- * Version of the bundled native core: `'android 0.1.0-rc.3'` / `'ios 0.1.0-rc.3'`.
142
+ * Version of the bundled native core: `'android 0.1.0-rc.26'` / `'ios 0.1.0-rc.26'`.
75
143
  * @public
76
144
  */
77
145
  declare function nativeVersion(): string;
@@ -103,4 +171,4 @@ declare class SekyroError extends Error {
103
171
  */
104
172
  declare const SDK_VERSION: string;
105
173
 
106
- 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. @public */
2
- type SekyroLocale = 'ar' | 'fr' | 'en';
3
- /** Themeable colour roles, shared by the Android and iOS cores. @public */
1
+ /** UI language of the native flow; every screen is translated in each of the six (spec 2026-10-29 §9). @public */
2
+ type SekyroLocale = 'ar' | 'fr' | 'en' | 'es' | 'pt' | 'de';
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). `consent` is never emitted (consent is one line on the first
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,9 +48,12 @@ type SekyroEvent = {
36
48
  interface SekyroConfig {
37
49
  /** One-time session token from your backend (`sessions.create`). Never logged. */
38
50
  clientToken: string;
39
- /** e.g. `'https://api-staging.sekyro.ai'`; defaults to production. */
51
+ /** Leave unset: the default, `https://api.sekyro.ai`, serves Sandbox and Live sessions. */
40
52
  apiOrigin?: string;
41
- /** UI language of the flow; required when `strings` is set. */
53
+ /**
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.
56
+ */
42
57
  locale?: SekyroLocale;
43
58
  /** Colours, radius, font and colour scheme. */
44
59
  theme?: SekyroTheme;
@@ -48,15 +63,68 @@ interface SekyroConfig {
48
63
  onEvent?: (event: SekyroEvent) => void;
49
64
  }
50
65
  /**
51
- * What the end user was shown; not the decision. `expired`: the session expired before it finished (the person was
52
- * asked to start again from your app), as on the native SDKs. @public
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
53
74
  */
54
- type SekyroDisplayStatus = 'approved' | 'review_pending' | 'rejected' | 'expired';
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
85
+ */
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;
55
94
  /** Display-only outcome; read the decision server-side (webhooks / `sessions.get`). @public */
56
95
  type SekyroResult = {
57
96
  status: 'finished';
58
97
  sessionId: string;
59
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;
60
128
  } | {
61
129
  status: 'cancelled';
62
130
  } | {
@@ -71,7 +139,7 @@ type SekyroResult = {
71
139
  */
72
140
  declare function startSekyro(config: SekyroConfig): Promise<SekyroResult>;
73
141
  /**
74
- * Version of the bundled native core: `'android 0.1.0-rc.3'` / `'ios 0.1.0-rc.3'`.
142
+ * Version of the bundled native core: `'android 0.1.0-rc.26'` / `'ios 0.1.0-rc.26'`.
75
143
  * @public
76
144
  */
77
145
  declare function nativeVersion(): string;
@@ -103,4 +171,4 @@ declare class SekyroError extends Error {
103
171
  */
104
172
  declare const SDK_VERSION: string;
105
173
 
106
- 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 m}from"react-native";var y=m.get("SekyroReactNative");var a=class extends Error{code;constructor(r,t=r){super(t),this.name="SekyroError",this.code=r}};var v=500,_=new Set(["ar","fr","en"]),E=["brand","brandFg","bg","surface","fg","fgMuted","border","danger","success","warning"],R=new Set(["clientToken","apiOrigin","locale","theme","strings","onEvent"]),N=/^#[0-9a-fA-F]{6}$/,w=/^http:\/\/(localhost|127\.0\.0\.1|10\.0\.2\.2)(:\d+)?$/,i=e=>{throw new a("invalid_config",`invalid config: ${e}`)};function d(e){(typeof e!="object"||e===null)&&i("config");for(let s of Object.keys(e))R.has(s)||i(`unknown key "${s.slice(0,32)}"`);(typeof e.clientToken!="string"||e.clientToken.length===0)&&i("clientToken");let r={clientToken:e.clientToken};e.apiOrigin!==void 0&&(typeof e.apiOrigin=="string"&&(/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(e.apiOrigin)||__DEV__&&w.test(e.apiOrigin))||i("apiOrigin"),r.apiOrigin=e.apiOrigin),e.locale!==void 0&&(_.has(e.locale)||i("locale"),r.locale=e.locale);let t=e.theme;if(t){if(t.colors){let s={};for(let[l,n]of Object.entries(t.colors))n!==void 0&&((!E.includes(l)||typeof n!="string"||!N.test(n))&&i(`theme.colors.${l.slice(0,32)}`),s[l]=n);r.colors=s}t.radius!==void 0&&((typeof t.radius!="number"||!Number.isFinite(t.radius)||t.radius<0||t.radius>32)&&i("theme.radius"),r.radius=t.radius),t.fontFamily!==void 0&&((typeof t.fontFamily!="string"||!/^[\w .-]{1,64}$/.test(t.fontFamily))&&i("theme.fontFamily"),r.fontFamily=t.fontFamily),t.darkMode!==void 0&&(["system","light","dark"].includes(t.darkMode)||i("theme.darkMode"),r.darkMode=t.darkMode)}if(e.strings){e.locale||i("strings need locale");let s=e.strings[e.locale]??{},l={},n=Object.entries(s).filter(([,o])=>o!==void 0);n.length>v&&i("strings (too many overrides)");for(let[o,p]of n)/^[a-zA-Z0-9_.]{1,96}$/.test(o)||i("strings key"),(typeof p!="string"||p.length>2e3)&&i(`strings.${o}`),l[o]=p;r.strings=l}return r}var h=new Set(["method","phone_otp","email_otp","registry","document","nfc","liveness","processing","result","update_required","eid","contact_choice","identity_summary","portrait"]);function c(e){if(e.type==="waiting_for_network")return{type:"waiting_for_network"};if(e.type!=="step"||!h.has(e.step))return null;let r=e.step,t=typeof e.retryReason=="string"&&/^[a-z0-9_]{1,64}$/.test(e.retryReason)?e.retryReason:void 0;return t?{type:"step",step:r,retryReason:t}:{type:"step",step:r}}var C=new Set(["approved","review_pending","rejected","expired"]);function S(e){return e.status==="cancelled"?{status:"cancelled"}:e.status==="failed"?{status:"failed",code:e.code||"unknown_error"}:e.status==="finished"&&e.sessionId&&C.has(e.displayStatus)?{status:"finished",sessionId:e.sessionId,displayStatus:e.displayStatus}:{status:"failed",code:"unknown_error"}}function k(){if(!y)throw new a("unsupported_platform","the SekyroReactNative native module is not linked (New Architecture app, pod install / Gradle sync)");return y}var f=!1,O=new Set(["no_activity","unsupported_platform","flow_in_progress","invalid_config"]);async function u(e){let r=d(e),t=k();if(f)throw new a("flow_in_progress");f=!0;let s=e.onEvent,l=s?t.onEvent(n=>{let o=c(n);o&&s(o)}):void 0;try{return S(await t.start(r))}catch(n){let o=n?.code;if(typeof o=="string"&&O.has(o))throw new a(o);return{status:"failed",code:"unknown_error"}}finally{l?.remove(),f=!1}}function x(){return k().nativeVersion()}import{useEffect as b,useRef as g}from"react";function T(e){let r=g(null),t=g(e);return t.current=e,b(()=>{if(r.current===e.clientToken)return;r.current=e.clientToken;let{onResult:s,onEvent:l,...n}=t.current;u({...n,onEvent:o=>t.current.onEvent?.(o)}).then(o=>t.current.onResult(o),o=>t.current.onResult({status:"failed",code:o instanceof a?o.code:"unknown_error"}))},[e.clientToken]),null}var I="0.1.0-rc.3";export{I as SDK_VERSION,a as SekyroError,T as SekyroFlow,x as nativeVersion,u as startSekyro};
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.31";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
@@ -5,13 +5,18 @@ 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)" }
12
11
 
13
12
  struct InvalidConfig: Error {}
14
13
 
14
+ /// No `locale` passed: the device language, among ar, fr and en only (as before Plan C), so an existing partner's
15
+ /// screens keep their language. es, pt and de apply only when the partner passes them.
16
+ static func deviceLocale(_ preferred: [String]) -> String? {
17
+ preferred.lazy.map { String($0.prefix(2)).lowercased() }.first { ["ar", "fr", "en"].contains($0) }
18
+ }
19
+
15
20
  /// The JS layer validated the config; this re-checks the shape. Never logs it (the token is a bearer credential).
16
21
  static func parse(_ d: NSDictionary) throws -> SekyroConfig {
17
22
  guard let token = d["clientToken"] as? String, !token.isEmpty else { throw InvalidConfig() }
@@ -20,8 +25,7 @@ public final class SekyroRNBridge: NSObject {
20
25
  guard let url = URL(string: raw), url.scheme == "https" || url.host == "localhost" || url.host == "127.0.0.1" else { throw InvalidConfig() }
21
26
  origin = url
22
27
  }
23
- let preferred = Locale.preferredLanguages.lazy.map { String($0.prefix(2)) }.first { ["ar", "fr", "en"].contains($0) }
24
- let locale = SekyroLocale(rawValue: (d["locale"] as? String) ?? preferred ?? "fr") ?? .fr
28
+ let locale = SekyroLocale(rawValue: (d["locale"] as? String) ?? deviceLocale(Locale.preferredLanguages) ?? "fr") ?? .fr
25
29
  let colors = d["colors"] as? [String: Any] ?? [:]
26
30
  func color(_ key: String) throws -> SekyroColor? {
27
31
  guard let value = colors[key] else { return nil }
@@ -43,20 +47,78 @@ public final class SekyroRNBridge: NSObject {
43
47
  let theme = SekyroTheme(
44
48
  brand: try color("brand"), brandFg: try color("brandFg"), background: try color("bg"), surface: try color("surface"),
45
49
  foreground: try color("fg"), foregroundMuted: try color("fgMuted"), border: try color("border"),
46
- danger: try color("danger"), success: try color("success"), warning: try color("warning"),
50
+ // danger / success / warning are not read: status colours are standard (deprecated no-ops, removed in 1.0).
47
51
  cornerRadius: radius, fontFamily: d["fontFamily"] as? String, darkMode: mode, strings: strings)
48
52
  return SekyroConfig(clientToken: token, apiOrigin: origin, locale: locale, theme: theme)
49
53
  }
50
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.
51
59
  static func wire(_ result: SekyroResult) -> NSDictionary {
52
- switch result {
53
- case .finished(let sessionId, let status):
54
- return ["status": "finished", "sessionId": sessionId, "displayStatus": status.rawValue]
55
- case .cancelled:
56
- return ["status": "cancelled"]
57
- case .failed(let code):
58
- return ["status": "failed", "code": code]
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)
59
120
  }
121
+ end(run)
60
122
  }
61
123
 
62
124
  /// Presents the drop-in. Returns nil when started, else an error code (`invalid_config`, `no_activity`, `flow_in_progress`).
@@ -64,12 +126,17 @@ public final class SekyroRNBridge: NSObject {
64
126
  onEvent: @escaping (NSDictionary) -> Void,
65
127
  completion: @escaping (NSDictionary) -> Void) -> String? {
66
128
  guard let parsed = try? parse(config) else { return "invalid_config" }
67
- guard !running else { return "flow_in_progress" }
129
+ guard current == nil else { return "flow_in_progress" }
68
130
  // UIKit only logs (and never calls back) when the presenter is off-window, mid-transition or
69
131
  // already presenting — refuse up front so the promise can never stay pending.
70
132
  guard let presenter = topViewController(), canPresent(from: presenter) else { return "no_activity" }
71
- running = true
72
- Sekyro.start(from: presenter, config: parsed, onEvent: { event in
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 }
73
140
  seq &+= 1
74
141
  switch event {
75
142
  case .step(let step, let reason):
@@ -79,10 +146,17 @@ public final class SekyroRNBridge: NSObject {
79
146
  case .waitingForNetwork:
80
147
  onEvent(["type": "waiting_for_network", "seq": NSNumber(value: seq)])
81
148
  }
82
- }, completion: { result in
83
- running = false
84
- completion(wire(result))
85
- })
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)
86
160
  return nil
87
161
  }
88
162
 
@@ -106,3 +180,21 @@ public final class SekyroRNBridge: NSObject {
106
180
  && presenter.presentedViewController == nil
107
181
  }
108
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",
3
+ "version": "0.1.0-rc.31",
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.3",
103
- "ios": "0.1.0-rc.3"
102
+ "android": "0.1.0-rc.26",
103
+ "ios": "0.1.0-rc.26"
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.3",
101
- "bom-ref": "@sekyro/react-native@0.1.0-rc.3",
100
+ "version": "0.1.0-rc.31",
101
+ "bom-ref": "@sekyro/react-native@0.1.0-rc.31",
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.3?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2FIBTIKAR-Technologies%2Fibtikar-identity.git%23sekyro-mobile%2Freact-native",
111
+ "purl": "pkg:npm/%40sekyro/react-native@0.1.0-rc.31?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.3"
150
+ "ref": "@sekyro/react-native@0.1.0-rc.31"
151
151
  }
152
152
  ]
153
153
  }
@@ -31,7 +31,19 @@ export type NativeConfig = {
31
31
  strings?: UnsafeObject;
32
32
  };
33
33
 
34
- export type NativeResult = { status: string; sessionId?: string; displayStatus?: string; code?: string };
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