@sekyro/react-native 0.1.0-rc.2 → 0.1.0-rc.21

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,126 @@
1
1
  # @sekyro/react-native
2
2
 
3
+ ## 0.1.0-rc.21
4
+
5
+ ### Patch Changes
6
+
7
+ - 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.
8
+
9
+ ## 0.1.0-rc.20
10
+
11
+ ### Minor Changes
12
+
13
+ - 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.
14
+
15
+ ## 0.1.0-rc.19
16
+
17
+ ### Patch Changes
18
+
19
+ - 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.
20
+
21
+ ## 0.1.0-rc.18
22
+
23
+ ### Patch Changes
24
+
25
+ - 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.
26
+
27
+ ## 0.1.0-rc.17
28
+
29
+ ### Patch Changes
30
+
31
+ - 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.
32
+
33
+ ## 0.1.0-rc.16
34
+
35
+ ### Minor Changes
36
+
37
+ - 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`.
38
+
39
+ ### Patch Changes
40
+
41
+ - 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.
42
+
43
+ ## 0.1.0-rc.15
44
+
45
+ ### Patch Changes
46
+
47
+ - 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.
48
+
49
+ ## 0.1.0-rc.14
50
+
51
+ ### Patch Changes
52
+
53
+ - 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.
54
+ - 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.
55
+
56
+ ## 0.1.0-rc.13
57
+
58
+ ### Patch Changes
59
+
60
+ - 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.
61
+ - 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.
62
+ - 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.
63
+
64
+ ## 0.1.0-rc.12
65
+
66
+ ### Patch Changes
67
+
68
+ - 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.
69
+
70
+ ## 0.1.0-rc.11
71
+
72
+ ### Patch Changes
73
+
74
+ - 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.
75
+
76
+ ## 0.1.0-rc.10
77
+
78
+ ### Patch Changes
79
+
80
+ - 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.
81
+
82
+ ## 0.1.0-rc.9
83
+
84
+ ### Patch Changes
85
+
86
+ - 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.
87
+
88
+ ## 0.1.0-rc.8
89
+
90
+ ### Patch Changes
91
+
92
+ - 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.
93
+
94
+ ## 0.1.0-rc.7
95
+
96
+ ### Patch Changes
97
+
98
+ - 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.
99
+
100
+ ## 0.1.0-rc.6
101
+
102
+ ### Patch Changes
103
+
104
+ - 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.
105
+
106
+ ## 0.1.0-rc.5
107
+
108
+ ### Patch Changes
109
+
110
+ - 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.
111
+
112
+ ## 0.1.0-rc.4
113
+
114
+ ### Patch Changes
115
+
116
+ - 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.
117
+
118
+ ## 0.1.0-rc.3
119
+
120
+ ### Patch Changes
121
+
122
+ - b474b43: Pins the native SDKs 0.1.0-rc.3 (Android `ai.sekyro:sekyro-bom`, iOS `sekyro-ios-dist`): the session's capture mode decides the camera (front only for a self capture, the back camera with a flip control for an assisted one), the liveness screen is portrait-locked on phones with a hold-upright guard, and the capture reports `mode`, `facingMode` and `formFactor`.
123
+
3
124
  ## 0.1.0-rc.2
4
125
 
5
126
  ### Minor 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,29 @@ 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? } | { 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
+
64
69
  Or declaratively: `<SekyroFlow clientToken={token} onResult={setResult} />` (renders nothing).
65
70
 
66
71
  Never log the `clientToken`; it is a one-time bearer credential.
67
72
 
73
+ **Languages.** `locale` takes `ar`, `fr`, `en`, `es`, `pt` or `de`; only `ar` is right to left. All six translate every screen,
74
+ the identity screens (document, chip, ID number, registry) included. Without a locale, the SDK uses the device
75
+ language when it is one of the six, else `fr`.
76
+
68
77
  While a flow runs, the wrapper owns the native SDK's process-wide event listener
69
78
  (`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' }`.
79
+ flow ends, so a listener your app set natively is replaced for that time. When the React
80
+ instance is torn down while a flow is open (a reload, the React host destroyed), the SDK closes
81
+ the flow and the promise resolves `{ status: 'failed', code: 'flow_interrupted' }` on Android and
82
+ iOS; on iOS the same happens if your app dismisses the flow screen itself. The promise settles
83
+ once. Unmounting `<SekyroFlow>` does not close an open flow: its result still reaches `onResult`.
72
84
 
73
85
  Full guide: [React Native guide](https://docs.sekyro.ai/en/mobile/react-native).
74
86
 
@@ -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,7 +50,9 @@ 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,
@@ -62,11 +64,16 @@ internal object ConfigMapper {
62
64
  when (r) {
63
65
  is SekyroResult.Finished -> {
64
66
  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
- })
67
+ // Everything else from the native SDK's own wire form (SekyroWire.result), so the JS side reads the same
68
+ // strings as Flutter: displayStatus verified | review_pending | not_verified, reason and reasonCode on
69
+ // not_verified, level (1 Contact, 2 Human, 3 Identity, 0 nothing proven) and assurance once decided. Each
70
+ // key only when known: JS reads absent as "none".
71
+ val wire = SekyroWire.result(r)
72
+ (wire["displayStatus"] as? String)?.let { putString("displayStatus", it) }
73
+ (wire["level"] as? Int)?.takeIf { it in 0..3 }?.let { putInt("level", it) }
74
+ for (key in listOf("assurance", "reason", "reasonCode")) {
75
+ (wire[key] as? String)?.takeIf { it.isNotEmpty() }?.let { putString(key, it) }
76
+ }
70
77
  }
71
78
  SekyroResult.Cancelled -> putString("status", "cancelled")
72
79
  is SekyroResult.Failed -> { putString("status", "failed"); putString("code", r.code) }
@@ -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.2";0&&(module.exports={SDK_VERSION,SekyroError,SekyroFlow,nativeVersion,startSekyro});
1
+ "use strict";var d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var b=(e,r)=>{for(var t in r)d(e,t,{get:r[t],enumerable:!0})},x=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of h(r))!O.call(e,s)&&s!==t&&d(e,s,{get:()=>r[s],enumerable:!(n=C(r,s))||n.enumerable});return e};var T=e=>x(d({},"__esModule",{value:!0}),e);var Y={};b(Y,{SDK_VERSION:()=>w,SekyroError:()=>l,SekyroFlow:()=>N,nativeVersion:()=>R,startSekyro:()=>y});module.exports=T(Y);var k=require("react-native"),p=k.TurboModuleRegistry.get("SekyroReactNative");var l=class extends Error{code;constructor(r,t=r){super(t),this.name="SekyroError",this.code=r}};var I=500,D=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}$/,$=/^http:\/\/(localhost|127\.0\.0\.1|10\.0\.2\.2)(:\d+)?$/,a=e=>{throw new l("invalid_config",`invalid config: ${e}`)};function v(e){(typeof e!="object"||e===null)&&a("config");for(let n of Object.keys(e))L.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__&&$.test(e.apiOrigin))||a("apiOrigin"),r.apiOrigin=e.apiOrigin),e.locale!==void 0&&(D.has(e.locale)||a("locale"),r.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(V.includes(s)){__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(s)||typeof i!="string"||!M.test(i))&&a(`theme.colors.${s.slice(0,32)}`),n[s]=i}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]??{},s={},i=Object.entries(n).filter(([,o])=>o!==void 0);i.length>I&&a("strings (too many overrides)");for(let[o,f]of i)/^[a-zA-Z0-9_.]{1,96}$/.test(o)||a("strings key"),(typeof f!="string"||f.length>2e3)&&a(`strings.${o}`),s[o]=f;r.strings=s}return r}var A=new Set(["method","phone_otp","email_otp","registry","document","nfc","liveness","processing","result","update_required","eid","contact_choice","identity_summary","portrait","proof_of_address"]);function m(e){if(e.type==="waiting_for_network")return{type:"waiting_for_network"};if(e.type!=="step"||!A.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 P=new Set(["verified","review_pending","not_verified"]),j=new Set([0,1,2,3]);function c(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 r=P.has(e.displayStatus),t=r?e.displayStatus:"not_verified",n=t==="not_verified";return{status:"finished",sessionId:e.sessionId,displayStatus:t,...typeof e.level=="number"&&j.has(e.level)?{level:e.level}:{},...c(e.assurance)?{assurance:e.assurance}:{},...n&&r&&c(e.reason)?{reason:e.reason}:{},...n&&r&&c(e.reasonCode)?{reasonCode:e.reasonCode}:{}}}return{status:"failed",code:"unknown_error"}}function E(){if(!p)throw new l("unsupported_platform","the SekyroReactNative native module is not linked (New Architecture app, pod install / Gradle sync)");return p}var S=!1,K=new Set(["no_activity","unsupported_platform","flow_in_progress","invalid_config"]);async function y(e){let r=v(e),t=E();if(S)throw new l("flow_in_progress");S=!0;let n=e.onEvent,s=n?t.onEvent(i=>{let o=m(i);o&&n(o)}):void 0;try{return _(await t.start(r))}catch(i){let o=i?.code;if(typeof o=="string"&&K.has(o))throw new l(o);return{status:"failed",code:"unknown_error"}}finally{s?.remove(),S=!1}}function R(){return E().nativeVersion()}var u=require("react");function N(e){let r=(0,u.useRef)(null),t=(0,u.useRef)(e);return t.current=e,(0,u.useEffect)(()=>{if(r.current===e.clientToken)return;r.current=e.clientToken;let{onResult:n,onEvent:s,...i}=t.current;y({...i,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 w="0.1.0-rc.21";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,11 @@ 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). `consent` is never emitted (consent is one line on the first
24
35
  * screen); it stays in the union only because the public API may only grow. @public
25
36
  */
26
- type SekyroStep = 'consent' | 'method' | 'phone_otp' | 'email_otp' | 'registry' | 'document' | 'nfc' | 'liveness' | 'processing' | 'result' | 'update_required' | 'eid' | 'contact_choice' | 'identity_summary' | 'portrait';
37
+ 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';
27
38
  /** Telemetry only; carries no personal data. @public */
28
39
  type SekyroEvent = {
29
40
  type: 'step';
@@ -36,9 +47,12 @@ type SekyroEvent = {
36
47
  interface SekyroConfig {
37
48
  /** One-time session token from your backend (`sessions.create`). Never logged. */
38
49
  clientToken: string;
39
- /** e.g. `'https://api-staging.sekyro.ai'`; defaults to production. */
50
+ /** Leave unset: the default, `https://api.sekyro.ai`, serves Sandbox and Live sessions. */
40
51
  apiOrigin?: string;
41
- /** UI language of the flow; required when `strings` is set. */
52
+ /**
53
+ * UI language of the flow; required when `strings` is set. Without it, the device language when it is one of the
54
+ * six, else French.
55
+ */
42
56
  locale?: SekyroLocale;
43
57
  /** Colours, radius, font and colour scheme. */
44
58
  theme?: SekyroTheme;
@@ -48,15 +62,43 @@ interface SekyroConfig {
48
62
  onEvent?: (event: SekyroEvent) => void;
49
63
  }
50
64
  /**
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
65
+ * What the end user was shown; not the decision. `not_verified` comes with a {@link SekyroSessionReason}. @public
66
+ */
67
+ type SekyroDisplayStatus = 'verified' | 'review_pending' | 'not_verified';
68
+ /**
69
+ * Why a session ended `not_verified`: `rejected` (a check failed), `inconclusive` (no verdict could be reached),
70
+ * `unavailable` (a check could not run), `abandoned` (the person started but the session expired before a result),
71
+ * `not_opened` (the link was sent but the session expired before it was opened), `policy` (a flow rule stopped it),
72
+ * `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
73
  */
54
- type SekyroDisplayStatus = 'approved' | 'review_pending' | 'rejected' | 'expired';
74
+ type SekyroSessionReason = 'rejected' | 'inconclusive' | 'unavailable' | 'abandoned' | 'not_opened' | 'policy' | 'cancelled' | 'superseded';
75
+ /** The level a finished session proved: 1 Contact, 2 Human, 3 Identity; 0 when nothing was proven. @public */
76
+ type SekyroLevel = 0 | 1 | 2 | 3;
55
77
  /** Display-only outcome; read the decision server-side (webhooks / `sessions.get`). @public */
56
78
  type SekyroResult = {
57
79
  status: 'finished';
58
80
  sessionId: string;
59
81
  displayStatus: SekyroDisplayStatus;
82
+ /**
83
+ * What the session proved (1 Contact, 2 Human, 3 Identity; 0 when nothing was proven), when the native SDK
84
+ * reports it. Absent when the session closed without one (for example a link nobody opened). A display hint: a
85
+ * check for a real person is `level >= 2` and for identity `level >= 3`, on your server.
86
+ */
87
+ level?: SekyroLevel;
88
+ /**
89
+ * How `level` was proved: `device_only`, `contact_email`, `contact_phone`, `unbound_identity` (level 1),
90
+ * `live_only`, `live_unique` (level 2), `supplied_biometric`, `document_biometric`, `eid_authenticated`,
91
+ * `chip_biometric` or `registry_biometric` (level 3); a newer server may add one. Absent when the server reports
92
+ * none. To require a particular proof, compare it with a list on your server.
93
+ */
94
+ assurance?: string;
95
+ /**
96
+ * `not_verified` only: why, when the native SDK reports it. Absent on `verified` and `review_pending`, and when the
97
+ * session did not say.
98
+ */
99
+ reason?: SekyroSessionReason | (string & {});
100
+ /** `not_verified` only: the machine-readable code behind `reason` (for example `device_cooldown`), when there is one. */
101
+ reasonCode?: string;
60
102
  } | {
61
103
  status: 'cancelled';
62
104
  } | {
@@ -71,7 +113,7 @@ type SekyroResult = {
71
113
  */
72
114
  declare function startSekyro(config: SekyroConfig): Promise<SekyroResult>;
73
115
  /**
74
- * Version of the bundled native core: `'android 0.1.0-rc.2'` / `'ios 0.1.0-rc.2'`.
116
+ * Version of the bundled native core: `'android 0.1.0-rc.19'` / `'ios 0.1.0-rc.19'`.
75
117
  * @public
76
118
  */
77
119
  declare function nativeVersion(): string;
@@ -103,4 +145,4 @@ declare class SekyroError extends Error {
103
145
  */
104
146
  declare const SDK_VERSION: string;
105
147
 
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 };
148
+ export { SDK_VERSION, type SekyroColorRole, type SekyroConfig, type SekyroDisplayStatus, SekyroError, type SekyroErrorCode, type SekyroEvent, SekyroFlow, type SekyroFlowProps, type SekyroLevel, type SekyroLocale, type SekyroResult, 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,11 @@ 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). `consent` is never emitted (consent is one line on the first
24
35
  * screen); it stays in the union only because the public API may only grow. @public
25
36
  */
26
- type SekyroStep = 'consent' | 'method' | 'phone_otp' | 'email_otp' | 'registry' | 'document' | 'nfc' | 'liveness' | 'processing' | 'result' | 'update_required' | 'eid' | 'contact_choice' | 'identity_summary' | 'portrait';
37
+ 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';
27
38
  /** Telemetry only; carries no personal data. @public */
28
39
  type SekyroEvent = {
29
40
  type: 'step';
@@ -36,9 +47,12 @@ type SekyroEvent = {
36
47
  interface SekyroConfig {
37
48
  /** One-time session token from your backend (`sessions.create`). Never logged. */
38
49
  clientToken: string;
39
- /** e.g. `'https://api-staging.sekyro.ai'`; defaults to production. */
50
+ /** Leave unset: the default, `https://api.sekyro.ai`, serves Sandbox and Live sessions. */
40
51
  apiOrigin?: string;
41
- /** UI language of the flow; required when `strings` is set. */
52
+ /**
53
+ * UI language of the flow; required when `strings` is set. Without it, the device language when it is one of the
54
+ * six, else French.
55
+ */
42
56
  locale?: SekyroLocale;
43
57
  /** Colours, radius, font and colour scheme. */
44
58
  theme?: SekyroTheme;
@@ -48,15 +62,43 @@ interface SekyroConfig {
48
62
  onEvent?: (event: SekyroEvent) => void;
49
63
  }
50
64
  /**
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
65
+ * What the end user was shown; not the decision. `not_verified` comes with a {@link SekyroSessionReason}. @public
66
+ */
67
+ type SekyroDisplayStatus = 'verified' | 'review_pending' | 'not_verified';
68
+ /**
69
+ * Why a session ended `not_verified`: `rejected` (a check failed), `inconclusive` (no verdict could be reached),
70
+ * `unavailable` (a check could not run), `abandoned` (the person started but the session expired before a result),
71
+ * `not_opened` (the link was sent but the session expired before it was opened), `policy` (a flow rule stopped it),
72
+ * `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
73
  */
54
- type SekyroDisplayStatus = 'approved' | 'review_pending' | 'rejected' | 'expired';
74
+ type SekyroSessionReason = 'rejected' | 'inconclusive' | 'unavailable' | 'abandoned' | 'not_opened' | 'policy' | 'cancelled' | 'superseded';
75
+ /** The level a finished session proved: 1 Contact, 2 Human, 3 Identity; 0 when nothing was proven. @public */
76
+ type SekyroLevel = 0 | 1 | 2 | 3;
55
77
  /** Display-only outcome; read the decision server-side (webhooks / `sessions.get`). @public */
56
78
  type SekyroResult = {
57
79
  status: 'finished';
58
80
  sessionId: string;
59
81
  displayStatus: SekyroDisplayStatus;
82
+ /**
83
+ * What the session proved (1 Contact, 2 Human, 3 Identity; 0 when nothing was proven), when the native SDK
84
+ * reports it. Absent when the session closed without one (for example a link nobody opened). A display hint: a
85
+ * check for a real person is `level >= 2` and for identity `level >= 3`, on your server.
86
+ */
87
+ level?: SekyroLevel;
88
+ /**
89
+ * How `level` was proved: `device_only`, `contact_email`, `contact_phone`, `unbound_identity` (level 1),
90
+ * `live_only`, `live_unique` (level 2), `supplied_biometric`, `document_biometric`, `eid_authenticated`,
91
+ * `chip_biometric` or `registry_biometric` (level 3); a newer server may add one. Absent when the server reports
92
+ * none. To require a particular proof, compare it with a list on your server.
93
+ */
94
+ assurance?: string;
95
+ /**
96
+ * `not_verified` only: why, when the native SDK reports it. Absent on `verified` and `review_pending`, and when the
97
+ * session did not say.
98
+ */
99
+ reason?: SekyroSessionReason | (string & {});
100
+ /** `not_verified` only: the machine-readable code behind `reason` (for example `device_cooldown`), when there is one. */
101
+ reasonCode?: string;
60
102
  } | {
61
103
  status: 'cancelled';
62
104
  } | {
@@ -71,7 +113,7 @@ type SekyroResult = {
71
113
  */
72
114
  declare function startSekyro(config: SekyroConfig): Promise<SekyroResult>;
73
115
  /**
74
- * Version of the bundled native core: `'android 0.1.0-rc.2'` / `'ios 0.1.0-rc.2'`.
116
+ * Version of the bundled native core: `'android 0.1.0-rc.19'` / `'ios 0.1.0-rc.19'`.
75
117
  * @public
76
118
  */
77
119
  declare function nativeVersion(): string;
@@ -103,4 +145,4 @@ declare class SekyroError extends Error {
103
145
  */
104
146
  declare const SDK_VERSION: string;
105
147
 
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 };
148
+ export { SDK_VERSION, type SekyroColorRole, type SekyroConfig, type SekyroDisplayStatus, SekyroError, type SekyroErrorCode, type SekyroEvent, SekyroFlow, type SekyroFlowProps, type SekyroLevel, type SekyroLocale, type SekyroResult, 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.2";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 a=class extends Error{code;constructor(r,t=r){super(t),this.name="SekyroError",this.code=r}};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,C=new Set(["clientToken","apiOrigin","locale","theme","strings","onEvent"]),h=/^#[0-9a-fA-F]{6}$/,O=/^http:\/\/(localhost|127\.0\.0\.1|10\.0\.2\.2)(:\d+)?$/,i=e=>{throw new a("invalid_config",`invalid config: ${e}`)};function S(e){(typeof e!="object"||e===null)&&i("config");for(let n of Object.keys(e))C.has(n)||i(`unknown key "${n.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__&&O.test(e.apiOrigin))||i("apiOrigin"),r.apiOrigin=e.apiOrigin),e.locale!==void 0&&(R.has(e.locale)||i("locale"),r.locale=e.locale);let t=e.theme;if(t){if(t.colors){let n={};for(let[l,s]of Object.entries(t.colors))if(s!==void 0){if(w.includes(l)){__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(l)||typeof s!="string"||!h.test(s))&&i(`theme.colors.${l.slice(0,32)}`),n[l]=s}r.colors=n}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 n=e.strings[e.locale]??{},l={},s=Object.entries(n).filter(([,o])=>o!==void 0);s.length>E&&i("strings (too many overrides)");for(let[o,u]of s)/^[a-zA-Z0-9_.]{1,96}$/.test(o)||i("strings key"),(typeof u!="string"||u.length>2e3)&&i(`strings.${o}`),l[o]=u;r.strings=l}return r}var b=new Set(["method","phone_otp","email_otp","registry","document","nfc","liveness","processing","result","update_required","eid","contact_choice","identity_summary","portrait","proof_of_address"]);function k(e){if(e.type==="waiting_for_network")return{type:"waiting_for_network"};if(e.type!=="step"||!b.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 x=new Set(["verified","review_pending","not_verified"]),T=new Set([0,1,2,3]);function f(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 r=x.has(e.displayStatus),t=r?e.displayStatus:"not_verified",n=t==="not_verified";return{status:"finished",sessionId:e.sessionId,displayStatus:t,...typeof e.level=="number"&&T.has(e.level)?{level:e.level}:{},...f(e.assurance)?{assurance:e.assurance}:{},...n&&r&&f(e.reason)?{reason:e.reason}:{},...n&&r&&f(e.reasonCode)?{reasonCode:e.reasonCode}:{}}}return{status:"failed",code:"unknown_error"}}function v(){if(!y)throw new a("unsupported_platform","the SekyroReactNative native module is not linked (New Architecture app, pod install / Gradle sync)");return y}var d=!1,I=new Set(["no_activity","unsupported_platform","flow_in_progress","invalid_config"]);async function p(e){let r=S(e),t=v();if(d)throw new a("flow_in_progress");d=!0;let n=e.onEvent,l=n?t.onEvent(s=>{let o=k(s);o&&n(o)}):void 0;try{return g(await t.start(r))}catch(s){let o=s?.code;if(typeof o=="string"&&I.has(o))throw new a(o);return{status:"failed",code:"unknown_error"}}finally{l?.remove(),d=!1}}function D(){return v().nativeVersion()}import{useEffect as F,useRef as m}from"react";function V(e){let r=m(null),t=m(e);return t.current=e,F(()=>{if(r.current===e.clientToken)return;r.current=e.clientToken;let{onResult:n,onEvent:l,...s}=t.current;p({...s,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 L="0.1.0-rc.21";export{L as SDK_VERSION,a as SekyroError,V as SekyroFlow,D 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,77 @@ 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
+ /// and the failure code, without matching the result's associated values here.
51
58
  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]
59
+ SekyroWire.dictionary(result) as NSDictionary
60
+ }
61
+
62
+ /// What the promise of a flow torn down before its result resolves (the Android module's `invalidate` does the same).
63
+ static let interrupted: NSDictionary = ["status": "failed", "code": "flow_interrupted"]
64
+
65
+ /// One running flow. Its promise settles exactly once: with the flow's result (after the flow is dismissed), or
66
+ /// with `flow_interrupted` when the React instance is torn down or the flow goes away without a result.
67
+ @MainActor final class Run {
68
+ private var completion: ((NSDictionary) -> Void)?
69
+ /// The flow's result, held from the moment the flow hands it back until its dismissal ends.
70
+ private(set) var result: NSDictionary?
71
+ weak var flow: UIViewController?
72
+
73
+ init(completion: @escaping (NSDictionary) -> Void) { self.completion = completion }
74
+
75
+ var isSettled: Bool { completion == nil }
76
+
77
+ /// Records the flow's result; false when this run already has one or has settled (a late or duplicate result).
78
+ func record(_ result: NSDictionary) -> Bool {
79
+ guard self.result == nil, !isSettled else { return false }
80
+ self.result = result
81
+ return true
82
+ }
83
+
84
+ /// Calls the completion once; later calls do nothing.
85
+ func settle(_ value: NSDictionary) {
86
+ guard let completion else { return }
87
+ self.completion = nil
88
+ completion(value)
89
+ }
90
+ }
91
+
92
+ /// The running flow, if any: one at a time.
93
+ @MainActor private(set) static var current: Run?
94
+
95
+ @MainActor static func begin(completion: @escaping (NSDictionary) -> Void) -> Run {
96
+ let run = Run(completion: completion)
97
+ current = run
98
+ return run
99
+ }
100
+
101
+ /// Ends `run`: frees the module for the next flow and settles the promise (a no-op once settled).
102
+ @MainActor static func finish(_ run: Run, with value: NSDictionary) {
103
+ if current === run { current = nil }
104
+ run.settle(value)
105
+ }
106
+
107
+ /// The flow is gone (dismissed and released) or the React instance is going away: settle with the result the flow
108
+ /// already handed back, else `flow_interrupted`.
109
+ @MainActor static func end(_ run: Run) {
110
+ finish(run, with: run.result ?? interrupted)
111
+ }
112
+
113
+ /// Module invalidation (bridge reload, React instance teardown, new architecture host destroyed): closes a flow
114
+ /// that has no result yet and settles its promise, so the module is never left locked on `flow_in_progress`.
115
+ @MainActor @objc public static func invalidate() {
116
+ guard let run = current else { return }
117
+ if run.result == nil, let flow = run.flow, flow.presentingViewController != nil {
118
+ flow.dismiss(animated: false)
59
119
  }
120
+ end(run)
60
121
  }
61
122
 
62
123
  /// Presents the drop-in. Returns nil when started, else an error code (`invalid_config`, `no_activity`, `flow_in_progress`).
@@ -64,12 +125,17 @@ public final class SekyroRNBridge: NSObject {
64
125
  onEvent: @escaping (NSDictionary) -> Void,
65
126
  completion: @escaping (NSDictionary) -> Void) -> String? {
66
127
  guard let parsed = try? parse(config) else { return "invalid_config" }
67
- guard !running else { return "flow_in_progress" }
128
+ guard current == nil else { return "flow_in_progress" }
68
129
  // UIKit only logs (and never calls back) when the presenter is off-window, mid-transition or
69
130
  // already presenting — refuse up front so the promise can never stay pending.
70
131
  guard let presenter = topViewController(), canPresent(from: presenter) else { return "no_activity" }
71
- running = true
72
- Sekyro.start(from: presenter, config: parsed, onEvent: { event in
132
+ let run = begin(completion: completion)
133
+ // Sekyro.start's own steps (present full screen, dismiss, then the result), with the flow kept in reach for a
134
+ // teardown and watched for going away without a result.
135
+ let flow = SekyroFlowViewController(config: parsed)
136
+ run.flow = flow
137
+ flow.onEvent = { event in
138
+ guard current === run, !run.isSettled else { return }
73
139
  seq &+= 1
74
140
  switch event {
75
141
  case .step(let step, let reason):
@@ -79,10 +145,17 @@ public final class SekyroRNBridge: NSObject {
79
145
  case .waitingForNetwork:
80
146
  onEvent(["type": "waiting_for_network", "seq": NSNumber(value: seq)])
81
147
  }
82
- }, completion: { result in
83
- running = false
84
- completion(wire(result))
85
- })
148
+ }
149
+ flow.onResult = { [weak flow] result in
150
+ guard run.record(wire(result)) else { return }
151
+ if let flow, flow.presentingViewController != nil {
152
+ flow.dismiss(animated: true) { end(run) }
153
+ } else {
154
+ end(run)
155
+ }
156
+ }
157
+ FlowWatch.attach(to: flow) { end(run) }
158
+ presenter.present(flow, animated: true)
86
159
  return nil
87
160
  }
88
161
 
@@ -106,3 +179,21 @@ public final class SekyroRNBridge: NSObject {
106
179
  && presenter.presentedViewController == nil
107
180
  }
108
181
  }
182
+
183
+ /// Calls `onGone` on the main actor once the flow controller it is attached to is released: the flow left the screen
184
+ /// (its own dismissal after a result, or the app dismissing it or replacing its window) and nothing holds it any more.
185
+ final class FlowWatch: NSObject {
186
+ private static var key: UInt8 = 0
187
+ private let onGone: @MainActor () -> Void
188
+
189
+ private init(_ onGone: @escaping @MainActor () -> Void) { self.onGone = onGone }
190
+
191
+ static func attach(to object: AnyObject, onGone: @escaping @MainActor () -> Void) {
192
+ objc_setAssociatedObject(object, &key, FlowWatch(onGone), .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
193
+ }
194
+
195
+ deinit {
196
+ let onGone = onGone
197
+ Task { @MainActor in onGone() }
198
+ }
199
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sekyro/react-native",
3
- "version": "0.1.0-rc.2",
3
+ "version": "0.1.0-rc.21",
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.2",
103
- "ios": "0.1.0-rc.2"
102
+ "android": "0.1.0-rc.19",
103
+ "ios": "0.1.0-rc.19"
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.2",
101
- "bom-ref": "@sekyro/react-native@0.1.0-rc.2",
100
+ "version": "0.1.0-rc.21",
101
+ "bom-ref": "@sekyro/react-native@0.1.0-rc.21",
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.2?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.21?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.2"
150
+ "ref": "@sekyro/react-native@0.1.0-rc.21"
151
151
  }
152
152
  ]
153
153
  }
@@ -31,7 +31,16 @@ 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 NativeResult = {
35
+ status: string;
36
+ sessionId?: string;
37
+ displayStatus?: string;
38
+ code?: string;
39
+ level?: Int32;
40
+ assurance?: string;
41
+ reason?: string;
42
+ reasonCode?: string;
43
+ };
35
44
 
36
45
  export type NativeEvent = { type: string; step?: string; retryReason?: string; seq: Int32 };
37
46