@sekyro/node 1.0.0-rc.28 → 1.0.0-rc.29

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.
@@ -1027,6 +1027,8 @@ interface FlowServiceSettings {
1027
1027
  aml_screening: {
1028
1028
  lists: ScreeningList[];
1029
1029
  onHit: "signal" | "review" | "fail";
1030
+ /** `scl_` ids of lists this step does not search; absent = every active list. */
1031
+ excludeClientLists?: string[];
1030
1032
  };
1031
1033
  face_dedup: {
1032
1034
  scope: "app" | "org";
@@ -2613,8 +2615,14 @@ interface DeletedPerson {
2613
2615
  id: string;
2614
2616
  deleted: true;
2615
2617
  }
2616
- /** The lists an AML screening can search. @public */
2617
- type ScreeningList = "sanctions" | "pep" | "adverse_media";
2618
+ /**
2619
+ * The lists an AML screening can search. `client` stands for your own
2620
+ * screening lists ({@link ScreeningListsApi}): it appears in `listsCovered`
2621
+ * and on hits, and is never asked for, since every screening step searches
2622
+ * your active lists unless its flow leaves them out.
2623
+ * @public
2624
+ */
2625
+ type ScreeningList = "sanctions" | "pep" | "adverse_media" | "client";
2618
2626
  /**
2619
2627
  * Where a screening stands: `clear` (nothing scored above the possible
2620
2628
  * threshold), `possible` (a possible match), `hit` (a match), `confirmed` or
@@ -2627,16 +2635,37 @@ type ScreeningStatus = "clear" | "possible" | "hit" | "confirmed" | "dismissed"
2627
2635
  type ScreeningUnavailableReason = "screening_unavailable" | "no_identity_data" | "no_list_covered";
2628
2636
  /** What ran a screening: a session step, a screening run again, or ongoing screening. @public */
2629
2637
  type ScreeningTrigger = "session" | "rescreen" | "monitor";
2630
- /** A list entry that matched the person, best first. Public list data. @public */
2638
+ /**
2639
+ * A list entry that matched the person, best first: public list data
2640
+ * (`source: "public"`), or an entry of one of your own screening lists
2641
+ * (`source: "client"`, with `listId`, `entryId` and your `reference`).
2642
+ * @public
2643
+ */
2631
2644
  interface ScreeningHitSummary {
2632
- /** The stable id of the list entry. */
2645
+ /** The stable id of the list entry (`sle_...` for an entry of your lists). */
2633
2646
  entityId: string;
2634
- /** The name of the entry as the list publishes it. */
2647
+ /** The name of the entry as the list publishes it, or the first name of your entry. */
2635
2648
  caption: string;
2636
2649
  /** How closely the entry matches the person, 0 to 1. */
2637
2650
  score: number;
2638
2651
  /** The searched lists the entry is on. */
2639
2652
  lists: ScreeningList[];
2653
+ /**
2654
+ * Where the entry comes from: the public lists or your own screening lists.
2655
+ * Absent means public (hits recorded before client lists).
2656
+ */
2657
+ source?: "public" | "client";
2658
+ /**
2659
+ * How the hit counts: `hit` is a match, `possible` a near match to check. Absent on hits
2660
+ * recorded before client lists (read the score against the screening status instead).
2661
+ */
2662
+ level?: "hit" | "possible";
2663
+ /** `source: "client"`: the list (`scl_...`). */
2664
+ listId?: string;
2665
+ /** `source: "client"`: the entry (`sle_...`). */
2666
+ entryId?: string;
2667
+ /** `source: "client"`: your own id of the entry, when you gave one. */
2668
+ reference?: string;
2640
2669
  }
2641
2670
  /** A list entry that matched, with its public attributes and sources. @public */
2642
2671
  interface ScreeningHit extends ScreeningHitSummary {
@@ -2737,6 +2766,120 @@ interface AmlMatchFlaggedEventData {
2737
2766
  topScore: number;
2738
2767
  hits: ScreeningHitSummary[];
2739
2768
  }
2769
+ /**
2770
+ * How close a name must be to match an entry of a screening list: `exact`
2771
+ * (near-identical names only), `standard` (the closeness used for the public
2772
+ * lists) or `broad` (looser names, more matches to review). A matching ID
2773
+ * number is a hit at every strictness.
2774
+ * @public
2775
+ */
2776
+ type ScreeningListStrictness = "exact" | "standard" | "broad";
2777
+ /**
2778
+ * One of your organization's own screening lists in this environment
2779
+ * ({@link ScreeningListsApi}). Every AML screening step searches every active
2780
+ * list unless its flow leaves the list out.
2781
+ * @public
2782
+ */
2783
+ interface ClientScreeningList {
2784
+ /** The list id (`scl_...`). */
2785
+ id: string;
2786
+ /** Your name for the list, unique in this environment. */
2787
+ name: string;
2788
+ description?: string;
2789
+ strictness: ScreeningListStrictness;
2790
+ /** Whether screening steps search the list. */
2791
+ active: boolean;
2792
+ /** How many entries the list holds. */
2793
+ entryCount: number;
2794
+ /** ISO 8601. */
2795
+ createdAt: string;
2796
+ /** ISO 8601. */
2797
+ updatedAt: string;
2798
+ }
2799
+ /** Input of {@link ScreeningListsApi.create}. @public */
2800
+ interface CreateScreeningListInput {
2801
+ /** 1 to 80 characters, unique in this environment. */
2802
+ name: string;
2803
+ /** At most 500 characters. */
2804
+ description?: string;
2805
+ /** Default `standard`. */
2806
+ strictness?: ScreeningListStrictness;
2807
+ /** Default `true`. */
2808
+ active?: boolean;
2809
+ }
2810
+ /** Input of {@link ScreeningListsApi.update}: at least one field; `description: ""` clears it. @public */
2811
+ type UpdateScreeningListInput = Partial<CreateScreeningListInput>;
2812
+ /** An ID number of a screening list entry. @public */
2813
+ interface ClientScreeningListIdNumber {
2814
+ /** The number, as on the document (at most 64 characters). */
2815
+ value: string;
2816
+ /** ISO 3166-1 alpha-2 code of the issuing country. */
2817
+ country?: string;
2818
+ type?: "national_id" | "passport" | "residence_permit" | "drivers_license";
2819
+ }
2820
+ /** One entry as you write it ({@link ScreeningListsApi.entries}). @public */
2821
+ interface ClientScreeningListEntryInput {
2822
+ /**
2823
+ * Your own id for the entry, unique in the list (at most 128 characters).
2824
+ * Sending an entry with a reference the list holds replaces that entry.
2825
+ */
2826
+ reference?: string;
2827
+ /** 1 to 20 names in any script, the full name first (each at most 200 characters). */
2828
+ names: string[];
2829
+ /** `YYYY`, `YYYY-MM` or `YYYY-MM-DD`. */
2830
+ birthDate?: string;
2831
+ /** ISO 3166-1 alpha-2 codes, at most 10. */
2832
+ nationalities?: string[];
2833
+ /** At most 10. */
2834
+ idNumbers?: ClientScreeningListIdNumber[];
2835
+ gender?: "male" | "female";
2836
+ /** Your note, at most 500 characters. */
2837
+ note?: string;
2838
+ }
2839
+ /** One entry of a screening list, with the data you wrote. @public */
2840
+ interface ClientScreeningListEntry extends ClientScreeningListEntryInput {
2841
+ /** The entry id (`sle_...`). */
2842
+ id: string;
2843
+ /** The list id (`scl_...`). */
2844
+ listId: string;
2845
+ /** ISO 8601. */
2846
+ addedAt: string;
2847
+ /** ISO 8601. */
2848
+ updatedAt: string;
2849
+ }
2850
+ /**
2851
+ * Why an entry was not written: `invalid_entry` (an unknown field or a wrong
2852
+ * type), `name_required`, `name_too_long`, `too_many_names`,
2853
+ * `too_many_id_numbers`, `too_many_nationalities`, `bad_id_number`, `bad_birth_date`, `bad_country`,
2854
+ * `bad_reference`, `note_too_long`, `duplicate_reference` (the same reference
2855
+ * twice in one call), `name_unmatchable` (no name of two letters or more and no
2856
+ * ID number: the entry could never match).
2857
+ * @public
2858
+ */
2859
+ type ClientScreeningListEntryErrorCode = "invalid_entry" | "name_required" | "name_too_long" | "too_many_names" | "too_many_id_numbers" | "too_many_nationalities" | "bad_id_number" | "bad_birth_date" | "bad_country" | "bad_reference" | "note_too_long" | "duplicate_reference" | "name_unmatchable";
2860
+ /** Result of {@link ScreeningListEntriesApi.upsert}. @public */
2861
+ interface ClientScreeningListEntriesWrite {
2862
+ /** Entries added. */
2863
+ created: number;
2864
+ /** Entries replaced (their `reference` was already on the list). */
2865
+ updated: number;
2866
+ /** The entries not written, by their position in the call (from 0). */
2867
+ errors: Array<{
2868
+ index: number;
2869
+ code: ClientScreeningListEntryErrorCode;
2870
+ }>;
2871
+ }
2872
+ /** Query of {@link ScreeningListEntriesApi.list}. @public */
2873
+ interface ListScreeningListEntriesQuery {
2874
+ /** Page size, 1 to 100 (the API's default is 50). */
2875
+ limit?: number;
2876
+ /** The {@link Page.nextCursor} of the previous page. */
2877
+ cursor?: string;
2878
+ }
2879
+ /** Answer of the screening list deletes. @public */
2880
+ interface DeletedScreeningListItem {
2881
+ deleted: true;
2882
+ }
2740
2883
  /** Options of {@link PeopleApi.revoke}. @public */
2741
2884
  interface RevokePersonInput {
2742
2885
  /** Kept on the audit trail only (≤ 500 characters). Do not put personal data here. */
@@ -3209,6 +3352,77 @@ declare class SignalsApi {
3209
3352
  */
3210
3353
  update(id: string, input: UpdateSignalInput, opts?: RequestOptions): Promise<Signal>;
3211
3354
  }
3355
+ /**
3356
+ * The entries of your screening lists. Exposed as
3357
+ * {@link ScreeningListsApi.entries}. Reading needs the `screening_lists:read`
3358
+ * scope, writing `screening_lists:write`. Exported as a TYPE only.
3359
+ * @public
3360
+ */
3361
+ declare class ScreeningListEntriesApi {
3362
+ private readonly t;
3363
+ /** @internal */
3364
+ constructor(t: {
3365
+ call<T>(method: HttpMethod, path: string, body?: unknown, idempotencyKey?: string): Promise<T>;
3366
+ page<T>(path: string): Promise<Page<T>>;
3367
+ });
3368
+ /**
3369
+ * `POST /screening-lists/:id/entries`: adds or updates 1 to 1000 entries.
3370
+ * An entry with a `reference` the list holds replaces it; one without is
3371
+ * always added. Each entry is checked on its own: a refused one is in
3372
+ * `errors` by its position and the others are written. The API requires an
3373
+ * idempotency key: one is generated when you pass none.
3374
+ */
3375
+ upsert(listId: string, entries: ClientScreeningListEntryInput[], opts?: RequestOptions): Promise<ClientScreeningListEntriesWrite>;
3376
+ /** The first page of the entries of a list, oldest first. Every page: {@link ScreeningListEntriesApi.iterate}. */
3377
+ list(listId: string, query?: ListScreeningListEntriesQuery): Promise<ClientScreeningListEntry[]>;
3378
+ /** One page of {@link ScreeningListEntriesApi.list} with its `nextCursor` (absent on the last page). */
3379
+ listPage(listId: string, query?: ListScreeningListEntriesQuery): Promise<Page<ClientScreeningListEntry>>;
3380
+ /** Every entry of a list, oldest first, following `nextCursor` page after page. */
3381
+ iterate(listId: string, query?: ListScreeningListEntriesQuery): AsyncGenerator<ClientScreeningListEntry, void, undefined>;
3382
+ /** `GET /screening-lists/:id/entries/:entryId`: `404 screening_list_entry_not_found` when the list has no such entry. */
3383
+ get(listId: string, entryId: string): Promise<ClientScreeningListEntry>;
3384
+ /** `DELETE /screening-lists/:id/entries/:entryId`: removes one entry. */
3385
+ delete(listId: string, entryId: string): Promise<DeletedScreeningListItem>;
3386
+ /** `DELETE /screening-lists/:id/entries?reference=`: removes the entry with your `reference`. */
3387
+ deleteByReference(listId: string, reference: string): Promise<DeletedScreeningListItem>;
3388
+ }
3389
+ /**
3390
+ * Your organization's own screening lists in the key's environment: every AML
3391
+ * screening step searches every active list next to the public lists, unless
3392
+ * its flow leaves the list out. Exposed as {@link Sekyro.screeningLists}.
3393
+ * Reading needs the `screening_lists:read` scope, writing
3394
+ * `screening_lists:write`. Exported as a TYPE only.
3395
+ * @public
3396
+ */
3397
+ declare class ScreeningListsApi {
3398
+ private readonly t;
3399
+ /** The entries of a list. */
3400
+ readonly entries: ScreeningListEntriesApi;
3401
+ /** @internal */
3402
+ constructor(t: {
3403
+ call<T>(method: HttpMethod, path: string, body?: unknown, idempotencyKey?: string): Promise<T>;
3404
+ page<T>(path: string): Promise<Page<T>>;
3405
+ });
3406
+ /**
3407
+ * `POST /screening-lists`: creates a list. `409 screening_list_name_taken`
3408
+ * when the environment has a list of that name; `400 screening_list_limit`
3409
+ * past the organization's limit. The API requires an idempotency key: one
3410
+ * is generated when you pass none.
3411
+ */
3412
+ create(input: CreateScreeningListInput, opts?: RequestOptions): Promise<ClientScreeningList>;
3413
+ /** `GET /screening-lists`: the lists of this environment, by name. */
3414
+ list(): Promise<ClientScreeningList[]>;
3415
+ /** `GET /screening-lists/:id`: `404 screening_list_not_found` for a list of another environment. */
3416
+ get(id: string): Promise<ClientScreeningList>;
3417
+ /**
3418
+ * `PATCH /screening-lists/:id`: renames a list or changes its description,
3419
+ * strictness or `active`; an empty `input` throws a `TypeError`. The API
3420
+ * requires an idempotency key: one is generated when you pass none.
3421
+ */
3422
+ update(id: string, input: UpdateScreeningListInput, opts?: RequestOptions): Promise<ClientScreeningList>;
3423
+ /** `DELETE /screening-lists/:id`: deletes the list and all its entries. */
3424
+ delete(id: string): Promise<DeletedScreeningListItem>;
3425
+ }
3212
3426
  /**
3213
3427
  * What you know about a device before you block it. Exposed as {@link Sekyro.devices}. Needs the
3214
3428
  * `blocks:read` or `blocks:write` scope. Exported as a TYPE only.
@@ -3303,6 +3517,7 @@ declare class Sekyro {
3303
3517
  readonly people: PeopleApi;
3304
3518
  readonly blocks: BlocksApi;
3305
3519
  readonly signals: SignalsApi;
3520
+ readonly screeningLists: ScreeningListsApi;
3306
3521
  readonly devices: DevicesApi;
3307
3522
  readonly flows: FlowsApi;
3308
3523
  readonly webhooks: WebhooksApi;
@@ -3325,4 +3540,4 @@ declare class Sekyro {
3325
3540
  readiness(): Promise<ReadinessReport>;
3326
3541
  }
3327
3542
 
3328
- export { type EligibilityReason as $, type AgeMethod as A, type Block as B, type CreatedSession as C, type ConnectorIdentity as D, type CreateBlockInput as E, type FetchLike as F, type CreateSessionInput as G, DEFAULT_BASE_URL as H, DEFAULT_TIMEOUT_MS as I, type DecisionReason as J, type Declared as K, type Locale as L, type DeclaredAddress as M, type DeclaredAnswer as N, type DeclaredConsent as O, type DeclaredMismatch as P, type DeepPartial as Q, type ReviewReason as R, type SessionReason as S, type DeletedPerson as T, type DeliverOptions as U, type VerificationLevel as V, type WebhookEventType as W, type Device as X, DevicesApi as Y, type DocumentSubstitutionSettings as Z, type EidResult as _, Sekyro as a, type RequestOptions as a$, type ExtendLinkInput as a0, type FlowOverridableSettings as a1, type FlowOverrides as a2, type FlowServiceSettings as a3, type FlowSummary as a4, FlowsApi as a5, type FormAnswerValue as a6, type FormQuestionType as a7, type FraudReason as a8, type FraudResponse as a9, type NameForm as aA, type OverridableServiceId as aB, type Page as aC, PeopleApi as aD, type Person as aE, type PersonAddressInput as aF, type PersonBirthPlaceInput as aG, type PersonDeletedEventData as aH, type PersonDocumentInput as aI, type PersonEnrolledEventData as aJ, type PersonRef as aK, type PersonSession as aL, type PersonSessionInput as aM, type PersonSessionTarget as aN, type PersonUpdatedEventData as aO, type PoaDocumentKind as aP, type PoaReason as aQ, type PoaRule as aR, type PoaRuleKind as aS, type PoaRules as aT, type PortraitReportEntry as aU, type PriorReviewReason as aV, type ProbeBindingReason as aW, type ProbeQuality as aX, type ProfileDocumentType as aY, type ReadinessProtection as aZ, type ReadinessReport as a_, type IdNumberReason as aa, type Identity as ab, type IdentityAddress as ac, type IdentityBirthPlace as ad, type IdentityDocument as ae, type IdentityIdNumber as af, type IdentityMethod as ag, type IdentityName as ah, type IdentityProofOfAddress as ai, type IdentityScalarKey as aj, type IdentitySource as ak, type IdentitySources as al, type IncludedVerificationsThresholdReachedEventData as am, type LevelTarget as an, type LiftBlockInput as ao, type ListBlocksQuery as ap, type ListPeopleQuery as aq, type ListScreeningsQuery as ar, type ListSessionsQuery as as, type ListSignalsQuery as at, type MatchReason as au, type MediaBytes as av, type MediaBytesOptions as aw, type MediaItem as ax, type MediaKind as ay, type MediaList as az, type ServiceId as b, type UsageLimitReachedEventData as b$, type ResultTokenResponse as b0, type ReviewOutcomeReason as b1, type RevokePersonInput as b2, type SandboxSimulatedReason as b3, type SandboxSimulation as b4, type ScreenPersonInput as b5, type Screening as b6, type ScreeningHit as b7, type ScreeningHitSummary as b8, type ScreeningList as b9, type SessionStep as bA, type SessionStepAttempts as bB, type SessionStepBand as bC, type SessionStepDecision as bD, type SessionStepDocument as bE, type SessionStepPortrait as bF, SessionTestApi as bG, type SessionVerifiedEventData as bH, SessionsApi as bI, type Signal as bJ, type SignalEventData as bK, type SignalEvidence as bL, type SignalGrade as bM, type SignalKeyKind as bN, type SignalKind as bO, type SignalSeverity as bP, type SignalStatus as bQ, SignalsApi as bR, type SimulateSessionInput as bS, type StepResult as bT, type SubjectAssurance as bU, type SubjectIdNumber as bV, type SubjectName as bW, type SubjectReferenceSource as bX, type SubjectReuseTarget as bY, type SubjectStatus as bZ, type UpdateSignalInput as b_, type ScreeningStatus as ba, type ScreeningTrigger as bb, type ScreeningUnavailableReason as bc, type SekyroOptions as bd, SekyroTestApi as be, type Session as bf, type SessionClosedEventDataBase as bg, type SessionDecidingStep as bh, type SessionDevice as bi, type SessionEventDataBase as bj, type SessionEventStep as bk, type SessionFailureReason as bl, type SessionFlowRef as bm, type SessionHandoff as bn, type SessionHandoffDevice as bo, type SessionLifecycleEventData as bp, type SessionLinkDelivery as bq, type SessionLinkExpiry as br, type SessionLinkInput as bs, type SessionNetwork as bt, type SessionNetworkEvent as bu, type SessionNotVerifiedEventData as bv, type SessionRetakeRequestedEventData as bw, type SessionReviewPendingEventData as bx, type SessionScreening as by, type SessionStatus as bz, type SessionPersonInput as c, type UsageThresholdReachedEventData as c0, type VerifiedContacts as c1, type WebhookEnvelopeOf as c2, type WebhookEventDataMap as c3, type WebhookTestInput as c4, type WebhookTestResult as c5, WebhooksApi as c6, type WebhookEnvelope as d, type SekyroEnvironment as e, type VerificationAssurance as f, type VerificationUnit as g, type SubjectReuseMode as h, type ResultCheckProofs as i, type SessionSignal as j, type FailureIdentification as k, type AgeResult as l, type AmlMatchFlaggedEventData as m, type ApiKeyIdentity as n, type BlockCheck as o, type BlockCheckInput as p, type BlockDuration as q, type BlockIdNumber as r, type BlockKind as s, type BlockMatch as t, type BlockReason as u, BlocksApi as v, type CameraUnavailableCause as w, type CheckState as x, type CheckType as y, type ClosedBy as z };
3543
+ export { type DeepPartial as $, type AgeMethod as A, type Block as B, type CreatedSession as C, type ClientScreeningListEntriesWrite as D, type ClientScreeningListEntry as E, type FetchLike as F, type ClientScreeningListEntryErrorCode as G, type ClientScreeningListEntryInput as H, type ClientScreeningListIdNumber as I, type ClosedBy as J, type ConnectorIdentity as K, type Locale as L, type CreateBlockInput as M, type CreateScreeningListInput as N, type CreateSessionInput as O, DEFAULT_BASE_URL as P, DEFAULT_TIMEOUT_MS as Q, type ReviewReason as R, type SessionReason as S, type DecisionReason as T, type Declared as U, type VerificationLevel as V, type WebhookEventType as W, type DeclaredAddress as X, type DeclaredAnswer as Y, type DeclaredConsent as Z, type DeclaredMismatch as _, Sekyro as a, type PoaRuleKind as a$, type DeletedPerson as a0, type DeletedScreeningListItem as a1, type DeliverOptions as a2, type Device as a3, DevicesApi as a4, type DocumentSubstitutionSettings as a5, type EidResult as a6, type EligibilityReason as a7, type ExtendLinkInput as a8, type FlowOverridableSettings as a9, type ListScreeningsQuery as aA, type ListSessionsQuery as aB, type ListSignalsQuery as aC, type MatchReason as aD, type MediaBytes as aE, type MediaBytesOptions as aF, type MediaItem as aG, type MediaKind as aH, type MediaList as aI, type NameForm as aJ, type OverridableServiceId as aK, type Page as aL, PeopleApi as aM, type Person as aN, type PersonAddressInput as aO, type PersonBirthPlaceInput as aP, type PersonDeletedEventData as aQ, type PersonDocumentInput as aR, type PersonEnrolledEventData as aS, type PersonRef as aT, type PersonSession as aU, type PersonSessionInput as aV, type PersonSessionTarget as aW, type PersonUpdatedEventData as aX, type PoaDocumentKind as aY, type PoaReason as aZ, type PoaRule as a_, type FlowOverrides as aa, type FlowServiceSettings as ab, type FlowSummary as ac, FlowsApi as ad, type FormAnswerValue as ae, type FormQuestionType as af, type FraudReason as ag, type FraudResponse as ah, type IdNumberReason as ai, type Identity as aj, type IdentityAddress as ak, type IdentityBirthPlace as al, type IdentityDocument as am, type IdentityIdNumber as an, type IdentityMethod as ao, type IdentityName as ap, type IdentityProofOfAddress as aq, type IdentityScalarKey as ar, type IdentitySource as as, type IdentitySources as at, type IncludedVerificationsThresholdReachedEventData as au, type LevelTarget as av, type LiftBlockInput as aw, type ListBlocksQuery as ax, type ListPeopleQuery as ay, type ListScreeningListEntriesQuery as az, type ServiceId as b, type SignalSeverity as b$, type PoaRules as b0, type PortraitReportEntry as b1, type PriorReviewReason as b2, type ProbeBindingReason as b3, type ProbeQuality as b4, type ProfileDocumentType as b5, type ReadinessProtection as b6, type ReadinessReport as b7, type RequestOptions as b8, type ResultTokenResponse as b9, type SessionHandoffDevice as bA, type SessionLifecycleEventData as bB, type SessionLinkDelivery as bC, type SessionLinkExpiry as bD, type SessionLinkInput as bE, type SessionNetwork as bF, type SessionNetworkEvent as bG, type SessionNotVerifiedEventData as bH, type SessionRetakeRequestedEventData as bI, type SessionReviewPendingEventData as bJ, type SessionScreening as bK, type SessionStatus as bL, type SessionStep as bM, type SessionStepAttempts as bN, type SessionStepBand as bO, type SessionStepDecision as bP, type SessionStepDocument as bQ, type SessionStepPortrait as bR, SessionTestApi as bS, type SessionVerifiedEventData as bT, SessionsApi as bU, type Signal as bV, type SignalEventData as bW, type SignalEvidence as bX, type SignalGrade as bY, type SignalKeyKind as bZ, type SignalKind as b_, type ReviewOutcomeReason as ba, type RevokePersonInput as bb, type SandboxSimulatedReason as bc, type SandboxSimulation as bd, type ScreenPersonInput as be, type Screening as bf, type ScreeningHit as bg, type ScreeningHitSummary as bh, type ScreeningList as bi, ScreeningListEntriesApi as bj, type ScreeningListStrictness as bk, ScreeningListsApi as bl, type ScreeningStatus as bm, type ScreeningTrigger as bn, type ScreeningUnavailableReason as bo, type SekyroOptions as bp, SekyroTestApi as bq, type Session as br, type SessionClosedEventDataBase as bs, type SessionDecidingStep as bt, type SessionDevice as bu, type SessionEventDataBase as bv, type SessionEventStep as bw, type SessionFailureReason as bx, type SessionFlowRef as by, type SessionHandoff as bz, type SessionPersonInput as c, type SignalStatus as c0, SignalsApi as c1, type SimulateSessionInput as c2, type StepResult as c3, type SubjectAssurance as c4, type SubjectIdNumber as c5, type SubjectName as c6, type SubjectReferenceSource as c7, type SubjectReuseTarget as c8, type SubjectStatus as c9, type UpdateScreeningListInput as ca, type UpdateSignalInput as cb, type UsageLimitReachedEventData as cc, type UsageThresholdReachedEventData as cd, type VerifiedContacts as ce, type WebhookEnvelopeOf as cf, type WebhookEventDataMap as cg, type WebhookTestInput as ch, type WebhookTestResult as ci, WebhooksApi as cj, type WebhookEnvelope as d, type SekyroEnvironment as e, type VerificationAssurance as f, type VerificationUnit as g, type SubjectReuseMode as h, type ResultCheckProofs as i, type SessionSignal as j, type FailureIdentification as k, type AgeResult as l, type AmlMatchFlaggedEventData as m, type ApiKeyIdentity as n, type BlockCheck as o, type BlockCheckInput as p, type BlockDuration as q, type BlockIdNumber as r, type BlockKind as s, type BlockMatch as t, type BlockReason as u, BlocksApi as v, type CameraUnavailableCause as w, type CheckState as x, type CheckType as y, type ClientScreeningList as z };
@@ -1,5 +1,5 @@
1
- import { C as Connector, P as ProviderAdapter, G as GatePolicy, a as GateResult } from '../../connector-C66zNvN7.cjs';
2
- import '../../client-D6zMa7hQ.cjs';
1
+ import { C as Connector, P as ProviderAdapter, G as GatePolicy, a as GateResult } from '../../connector-CI50FjGZ.cjs';
2
+ import '../../client-B4wM-_Xp.cjs';
3
3
 
4
4
  /**
5
5
  * `@sekyro/node/connect/express`: a route gate for Express (and any
@@ -1,5 +1,5 @@
1
- import { C as Connector, P as ProviderAdapter, G as GatePolicy, a as GateResult } from '../../connector-D26UF7LX.js';
2
- import '../../client-D6zMa7hQ.js';
1
+ import { C as Connector, P as ProviderAdapter, G as GatePolicy, a as GateResult } from '../../connector-CR2FHfxc.js';
2
+ import '../../client-B4wM-_Xp.js';
3
3
 
4
4
  /**
5
5
  * `@sekyro/node/connect/express`: a route gate for Express (and any
@@ -1,5 +1,5 @@
1
- export { b as CLAIM_VERSION, c as ClaimFlag, C as Connector, d as ConnectorLogEvent, e as ConnectorOptions, f as ConnectorStore, g as GateAction, G as GatePolicy, h as GateReason, a as GateResult, M as MemoryStore, i as MergeEvent, j as MergeOutcome, k as MergeRule, P as ProviderAdapter, R as RevocationUnresolvedEvent, S as SekyroClaim, l as StartOptions, V as VerificationResultInput, W as WebhookOutcome, m as WebhookSkipReason, n as createConnector, o as evaluateGate, p as memoryStore, q as mergeClaim, r as parseClaim } from '../connector-C66zNvN7.cjs';
2
- export { A as AgeMethod, W as WebhookEventType } from '../client-D6zMa7hQ.cjs';
1
+ export { b as CLAIM_VERSION, c as ClaimFlag, C as Connector, d as ConnectorLogEvent, e as ConnectorOptions, f as ConnectorStore, g as GateAction, G as GatePolicy, h as GateReason, a as GateResult, M as MemoryStore, i as MergeEvent, j as MergeOutcome, k as MergeRule, P as ProviderAdapter, R as RevocationUnresolvedEvent, S as SekyroClaim, l as StartOptions, V as VerificationResultInput, W as WebhookOutcome, m as WebhookSkipReason, n as createConnector, o as evaluateGate, p as memoryStore, q as mergeClaim, r as parseClaim } from '../connector-CI50FjGZ.cjs';
2
+ export { A as AgeMethod, W as WebhookEventType } from '../client-B4wM-_Xp.cjs';
3
3
 
4
4
  /**
5
5
  * Why a connector refused to act:
@@ -1,5 +1,5 @@
1
- export { b as CLAIM_VERSION, c as ClaimFlag, C as Connector, d as ConnectorLogEvent, e as ConnectorOptions, f as ConnectorStore, g as GateAction, G as GatePolicy, h as GateReason, a as GateResult, M as MemoryStore, i as MergeEvent, j as MergeOutcome, k as MergeRule, P as ProviderAdapter, R as RevocationUnresolvedEvent, S as SekyroClaim, l as StartOptions, V as VerificationResultInput, W as WebhookOutcome, m as WebhookSkipReason, n as createConnector, o as evaluateGate, p as memoryStore, q as mergeClaim, r as parseClaim } from '../connector-D26UF7LX.js';
2
- export { A as AgeMethod, W as WebhookEventType } from '../client-D6zMa7hQ.js';
1
+ export { b as CLAIM_VERSION, c as ClaimFlag, C as Connector, d as ConnectorLogEvent, e as ConnectorOptions, f as ConnectorStore, g as GateAction, G as GatePolicy, h as GateReason, a as GateResult, M as MemoryStore, i as MergeEvent, j as MergeOutcome, k as MergeRule, P as ProviderAdapter, R as RevocationUnresolvedEvent, S as SekyroClaim, l as StartOptions, V as VerificationResultInput, W as WebhookOutcome, m as WebhookSkipReason, n as createConnector, o as evaluateGate, p as memoryStore, q as mergeClaim, r as parseClaim } from '../connector-CR2FHfxc.js';
2
+ export { A as AgeMethod, W as WebhookEventType } from '../client-B4wM-_Xp.js';
3
3
 
4
4
  /**
5
5
  * Why a connector refused to act:
@@ -1,5 +1,5 @@
1
- import { a as GateResult, C as Connector, P as ProviderAdapter, G as GatePolicy } from '../../connector-C66zNvN7.cjs';
2
- import '../../client-D6zMa7hQ.cjs';
1
+ import { a as GateResult, C as Connector, P as ProviderAdapter, G as GatePolicy } from '../../connector-CI50FjGZ.cjs';
2
+ import '../../client-B4wM-_Xp.cjs';
3
3
 
4
4
  /**
5
5
  * `@sekyro/node/connect/next`: gate helpers for Next.js middleware, route
@@ -1,5 +1,5 @@
1
- import { a as GateResult, C as Connector, P as ProviderAdapter, G as GatePolicy } from '../../connector-D26UF7LX.js';
2
- import '../../client-D6zMa7hQ.js';
1
+ import { a as GateResult, C as Connector, P as ProviderAdapter, G as GatePolicy } from '../../connector-CR2FHfxc.js';
2
+ import '../../client-B4wM-_Xp.js';
3
3
 
4
4
  /**
5
5
  * `@sekyro/node/connect/next`: gate helpers for Next.js middleware, route
@@ -1,4 +1,4 @@
1
- import { A as AgeMethod, S as SessionReason, W as WebhookEventType, L as Locale, C as CreatedSession, a as Sekyro, F as FetchLike } from './client-D6zMa7hQ.cjs';
1
+ import { A as AgeMethod, S as SessionReason, W as WebhookEventType, L as Locale, C as CreatedSession, a as Sekyro, F as FetchLike } from './client-B4wM-_Xp.cjs';
2
2
 
3
3
  /**
4
4
  * The Sekyro claim contract and its only state machine, `mergeClaim` (spec
@@ -1,4 +1,4 @@
1
- import { A as AgeMethod, S as SessionReason, W as WebhookEventType, L as Locale, C as CreatedSession, a as Sekyro, F as FetchLike } from './client-D6zMa7hQ.js';
1
+ import { A as AgeMethod, S as SessionReason, W as WebhookEventType, L as Locale, C as CreatedSession, a as Sekyro, F as FetchLike } from './client-B4wM-_Xp.js';
2
2
 
3
3
  /**
4
4
  * The Sekyro claim contract and its only state machine, `mergeClaim` (spec
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};__export(src_exports,{DEFAULT_BASE_URL:()=>DEFAULT_BASE_URL,DEFAULT_RESULT_TOKEN_ISSUER:()=>DEFAULT_RESULT_TOKEN_ISSUER,DEFAULT_TIMEOUT_MS:()=>DEFAULT_TIMEOUT_MS,LEGACY_SIGNATURE_HEADER:()=>LEGACY_SIGNATURE_HEADER,RESULT_TOKEN_JWKS_PATH:()=>RESULT_TOKEN_JWKS_PATH,SEKYRO_SIGNATURE_HEADER:()=>SEKYRO_SIGNATURE_HEADER,Sekyro:()=>Sekyro,SekyroApiError:()=>SekyroApiError,SekyroConfigError:()=>SekyroConfigError,SekyroResultTokenError:()=>SekyroResultTokenError,SekyroWebhookError:()=>SekyroWebhookError,isFlowError:()=>isFlowError,personFromNationalRegistry:()=>personFromNationalRegistry,signatureFromHeaders:()=>signatureFromHeaders,verifyResultToken:()=>verifyResultToken,verifyWebhook:()=>verifyWebhook});module.exports=__toCommonJS(src_exports);var WEBHOOK_MESSAGES={invalid_signature:"No v1 signature in the header matches this body and secret",stale:"Delivery timestamp is outside the tolerance window",malformed:"Signature header or body is not in the expected format"},SekyroWebhookError=class extends Error{name="SekyroWebhookError";code;constructor(code,message=WEBHOOK_MESSAGES[code]){super(message),this.code=code}},RESULT_TOKEN_MESSAGES={invalid_token:"The result token is not a valid Sekyro AI token",expired:"The result token has expired",wrong_audience:"The result token was issued for another app",wrong_issuer:"The result token was not issued by the expected issuer",wrong_env:"The result token is for another environment",env_required:'`env` is required by verifyResultToken: pass "live" or "sandbox"',key_env_mismatch:"The result token environment does not match its signing key",jwks_unavailable:"The Sekyro AI public key set could not be fetched",invalid_options:"Invalid options for verifyResultToken"},SekyroResultTokenError=class extends Error{name="SekyroResultTokenError";code;constructor(code,message=RESULT_TOKEN_MESSAGES[code],cause){super(message,cause===void 0?void 0:{cause}),this.code=code}},CONFIG_MESSAGES={missing_api_key:"Sekyro AI: `apiKey` is required",invalid_base_url:"Sekyro AI: `baseUrl` must be an https: URL (http: is allowed only for localhost, 127.0.0.1 or [::1])",invalid_registry_record:"Sekyro AI: the registry answer can't be used as a registry record",registry_country_unsupported:"Sekyro AI: no national registry format for this country",registry_nationality_unmapped:"Sekyro AI: the registry answer has a nationality the SDK cannot map"},SekyroConfigError=class extends TypeError{name="SekyroConfigError";code;constructor(code,message=CONFIG_MESSAGES[code]){super(message),this.code=code}},SekyroApiError=class extends Error{name="SekyroApiError";status;code;requestId;details;fieldErrors;retryable;retryAfterSeconds;constructor(init){super(init.message,init.cause===void 0?void 0:{cause:init.cause}),this.status=init.status,this.code=init.code,this.requestId=init.requestId,this.details=init.details,this.fieldErrors=fieldErrorsOf(init.details),this.retryable=isRetryable(init.status,init.code),this.retryAfterSeconds=init.retryAfterSeconds}};function fieldErrorsOf(details){if(typeof details!="object"||details===null)return;let raw=details.fieldErrors;if(!Array.isArray(raw))return;let out=[];for(let entry of raw){if(typeof entry!="object"||entry===null)continue;let{field,code,expected}=entry;if(typeof field!="string"||typeof code!="string")continue;let item={field,code};typeof expected=="string"&&(item.expected=expected),out.push(item)}return out.length>0?out:void 0}function retryAfterSecondsOf(header,now=Date.now()){if(header===null)return;let value=header.trim();if(/^\d+$/.test(value))return Number(value);if(!/[a-z]/i.test(value))return;let at=Date.parse(value);if(!Number.isNaN(at))return Math.max(0,Math.ceil((at-now)/1e3))}var FLOW_ERROR_CODES=new Set(["flow_not_found","flow_not_published","flow_archived","override_invalid","override_widens_flow","reuse_disabled","choice_not_found","choice_locked","choice_option_unavailable"]),FLOW_REF_CODES=new Set(["flow_not_published","flow_archived","reuse_disabled"]),isRecord=x=>typeof x=="object"&&x!==null&&!Array.isArray(x),isStringArray=x=>Array.isArray(x)&&x.every(s=>typeof s=="string");function isIssue(x){return isRecord(x)&&typeof x.code=="string"&&typeof x.message=="string"}function hasFlowDetails(code,details){if(!isRecord(details)||!Array.isArray(details.issues)||!details.issues.every(isIssue))return!1;if(code==="override_widens_flow")return isStringArray(details.fields);if(FLOW_REF_CODES.has(code)){let flow=details.flow;return isRecord(flow)&&typeof flow.id=="string"&&typeof flow.slug=="string"}return!0}function isFlowError(err,...codes){return!(err instanceof SekyroApiError)||!FLOW_ERROR_CODES.has(err.code)||codes.length>0&&!codes.includes(err.code)?!1:hasFlowDetails(err.code,err.details)}function isRetryable(status,code){return code==="network"||code==="timeout"||code==="idempotency_in_progress"||status===429?!0:status>=500&&status<=599}var SDK_VERSION="1.0.0-rc.28";var USER_AGENT=`@sekyro/node/${SDK_VERSION}`,DEFAULT_BASE_URL="https://api.sekyro.ai/api/v2",DEFAULT_TIMEOUT_MS=3e4,CONNECT_TELEMETRY=Symbol.for("@sekyro/node.connect-telemetry"),CONNECTOR_PROVIDER_RE=/^[a-z0-9-]{1,32}$/,CONNECTOR_VERSION_RE=/^[0-9A-Za-z.+-]{1,64}$/;function connectorHeaderOf(identity){if(!identity||typeof identity!="object")return;let{provider,version}=identity;if(!(typeof provider!="string"||!CONNECTOR_PROVIDER_RE.test(provider))&&!(typeof version!="string"||!CONNECTOR_VERSION_RE.test(version)))return`${provider}/${version}`}var SUBJECT_ID_RE=/^(?:per_)?[0-9a-f]{24}$/i;function isSuccessEnvelope(value){return typeof value=="object"&&value!==null&&value.success===!0&&"data"in value}function isErrorEnvelope(value){if(typeof value!="object"||value===null)return!1;let v=value;if(v.success!==!1||typeof v.error!="object"||v.error===null)return!1;let e=v.error;return typeof e.code=="string"&&typeof e.message=="string"}function requestIdOf(error){return typeof error.requestId=="string"?error.requestId:void 0}function isAbortLike(err){if(typeof err!="object"||err===null)return!1;let name=err.name;return name==="TimeoutError"||name==="AbortError"}var LOOPBACK_HOSTS=new Set(["localhost","127.0.0.1","[::1]"]);function assertSafeBaseUrl(baseUrl){let url;try{url=new URL(baseUrl)}catch{throw new SekyroConfigError("invalid_base_url")}if(url.protocol!=="https:"&&!(url.protocol==="http:"&&LOOPBACK_HOSTS.has(url.hostname)))throw new SekyroConfigError("invalid_base_url")}var Transport=class{apiKey;baseUrl;timeoutMs;fetchImpl;connectorHeader;constructor(opts){let baseUrl=(opts.baseUrl??DEFAULT_BASE_URL).replace(/\/+$/,"");assertSafeBaseUrl(baseUrl),this.apiKey=opts.apiKey,this.baseUrl=baseUrl,this.timeoutMs=opts.timeoutMs??DEFAULT_TIMEOUT_MS,this.fetchImpl=opts.fetch??globalThis.fetch,this.connectorHeader=connectorHeaderOf(opts.connector)}async send(method,path,o){let timeoutMs=o.timeoutMs??this.timeoutMs,headers={authorization:`Bearer ${this.apiKey}`,accept:o.accept??"application/json","user-agent":USER_AGENT};o.body!==void 0&&(headers["content-type"]="application/json"),o.idempotencyKey!==void 0&&(headers["x-idempotency-key"]=o.idempotencyKey),this.connectorHeader!==void 0&&(headers["x-sekyro-connector"]=this.connectorHeader);let init={method,headers,signal:AbortSignal.timeout(timeoutMs)};o.body!==void 0&&(init.body=JSON.stringify(o.body));try{return await this.fetchImpl(`${this.baseUrl}${path}`,init)}catch(err){throw isAbortLike(err)?new SekyroApiError({status:0,code:"timeout",message:`Request timed out after ${timeoutMs}ms`,cause:err}):new SekyroApiError({status:0,code:"network",message:`Network error: ${err instanceof Error?err.message:String(err)}`,cause:err})}}errorOf(res,parsed){let retryAfterSeconds=retryAfterSecondsOf(res.headers.get("retry-after"));if(isErrorEnvelope(parsed)){let init2={status:res.status,code:parsed.error.code,message:parsed.error.message},requestId=requestIdOf(parsed.error);return requestId!==void 0&&(init2.requestId=requestId),parsed.error.details!==void 0&&(init2.details=parsed.error.details),retryAfterSeconds!==void 0&&(init2.retryAfterSeconds=retryAfterSeconds),new SekyroApiError(init2)}let init={status:res.status,code:"http_error",message:`HTTP ${res.status}${res.statusText?` ${res.statusText}`:""}`};return retryAfterSeconds!==void 0&&(init.retryAfterSeconds=retryAfterSeconds),new SekyroApiError(init)}async envelope(method,path,o){let res=await this.send(method,path,o),text2=await res.text(),parsed,parseError;try{parsed=text2.length>0?JSON.parse(text2):void 0}catch(err){parseError=err}if(!res.ok)throw this.errorOf(res,parsed);if(!isSuccessEnvelope(parsed))throw new SekyroApiError({status:res.status,code:"malformed_response",message:"Response is not a `{ success: true, data }` envelope",cause:parseError});return parsed}async call(method,path,body,idempotencyKey,timeoutMs=this.timeoutMs){return(await this.envelope(method,path,{body,idempotencyKey,timeoutMs})).data}async page(path){let env=await this.envelope("GET",path,{});if(!Array.isArray(env.data))throw new SekyroApiError({status:200,code:"malformed_response",message:"List response `data` is not an array"});let next=env.meta?.nextCursor;return typeof next=="string"&&next.length>0?{data:env.data,nextCursor:next}:{data:env.data}}async bytes(path){let res=await this.send("GET",path,{accept:"image/*, video/*"});if(!res.ok){let text2=await res.text().catch(()=>""),parsed;try{parsed=text2.length>0?JSON.parse(text2):void 0}catch{parsed=void 0}throw this.errorOf(res,parsed)}return{contentType:res.headers.get("content-type")??"application/octet-stream",bytes:new Uint8Array(await res.arrayBuffer())}}};function assertId(method,id,name="id"){if(typeof id!="string"||id.length===0)throw new TypeError(`${method}: \`${name}\` must be a non-empty string`)}var path1=(prefix,id,rest="")=>`${prefix}/${encodeURIComponent(id)}${rest}`;function isoOf(method,name,v){if(v instanceof Date){if(Number.isNaN(v.getTime()))throw new TypeError(`${method}: \`${name}\` is an invalid Date`);return v.toISOString()}if(typeof v!="string"||v.length===0)throw new TypeError(`${method}: \`${name}\` must be an ISO 8601 string or a Date`);return v}function setPaging(method,qs,q){if(q.limit!==void 0){if(!Number.isInteger(q.limit)||q.limit<1||q.limit>100)throw new TypeError(`${method}: \`limit\` must be an integer from 1 to 100`);qs.set("limit",String(q.limit))}if(q.cursor!==void 0){if(typeof q.cursor!="string"||q.cursor.length===0)throw new TypeError(`${method}: \`cursor\` must be a non-empty string`);qs.set("cursor",q.cursor)}}var withQuery=(path,qs)=>qs.size>0?`${path}?${qs.toString()}`:path;async function*follow(first,read){let cursor=first;for(;;){let page=await read(cursor);if(yield*page.data,page.nextCursor===void 0||page.nextCursor===cursor)return;cursor=page.nextCursor}}var SessionsApi=class{constructor(t){this.t=t}t;async create(input={},opts={}){return this.t.call("POST","/sessions",input,opts.idempotencyKey)}async selectMethod(id,method){return assertId("sessions.selectMethod",id),this.t.call("POST",path1("/sessions",id,"/method"),{method})}async get(id){return assertId("sessions.get",id),this.t.call("GET",path1("/sessions",id))}async cancel(id,opts={}){return assertId("sessions.cancel",id),this.t.call("POST",path1("/sessions",id,"/cancel"),void 0,opts.idempotencyKey)}async resendLink(id,opts={}){return assertId("sessions.resendLink",id),this.t.call("POST",path1("/sessions",id,"/link/resend"),{},opts.idempotencyKey)}async extendLink(id,input,opts={}){assertId("sessions.extendLink",id);let body;if(input!==null&&typeof input=="object"&&"ttlMinutes"in input&&!("expiresAt"in input)){if(!Number.isInteger(input.ttlMinutes)||input.ttlMinutes<1)throw new TypeError("sessions.extendLink: `ttlMinutes` must be a positive integer");body={ttlMinutes:input.ttlMinutes}}else if(input!==null&&typeof input=="object"&&"expiresAt"in input&&!("ttlMinutes"in input))body={expiresAt:isoOf("sessions.extendLink","expiresAt",input.expiresAt)};else throw new TypeError("sessions.extendLink: pass exactly one of `ttlMinutes` or `expiresAt`");return this.t.call("POST",path1("/sessions",id,"/link/extend"),body,opts.idempotencyKey)}async list(query={}){return(await this.listPage(query)).data}async listPage(query={}){let m="sessions.list",qs=new URLSearchParams;if(query.externalRef!==void 0&&(assertId(m,query.externalRef,"externalRef"),qs.set("externalRef",query.externalRef)),query.status!==void 0&&qs.set("status",query.status),query.reason!==void 0&&qs.set("reason",query.reason),query.closedBy!==void 0&&qs.set("closedBy",query.closedBy),query.flow!==void 0&&(assertId(m,query.flow,"flow"),qs.set("flow",query.flow)),query.createdAfter!==void 0&&qs.set("createdAfter",isoOf(m,"createdAfter",query.createdAfter)),query.createdBefore!==void 0&&qs.set("createdBefore",isoOf(m,"createdBefore",query.createdBefore)),query.deviceId!==void 0&&(assertId(m,query.deviceId,"deviceId"),qs.set("deviceId",query.deviceId)),query.signalKind!==void 0){let kinds=[...new Set(Array.isArray(query.signalKind)?query.signalKind:[query.signalKind])];if(kinds.length===0||kinds.some(k=>typeof k!="string"||k.length===0))throw new TypeError(`${m}: \`signalKind\` must be a kind or a non-empty list of kinds`);qs.set("signalKind",kinds.join(","))}query.signalSeverity!==void 0&&qs.set("signalSeverity",query.signalSeverity),setPaging(m,qs,query);let page=await this.t.page(withQuery("/sessions",qs)),data=page.data.filter(s=>(query.externalRef===void 0||s.externalRef===query.externalRef)&&(query.status===void 0||s.status===query.status));return page.nextCursor!==void 0?{data,nextCursor:page.nextCursor}:{data}}iterate(query={}){return follow(query.cursor,cursor=>this.listPage(cursor===void 0?{...query}:{...query,cursor}))}async media(id){return assertId("sessions.media",id),this.t.call("GET",path1("/sessions",id,"/media"))}async mediaBytes(id,kind,opts={}){let m="sessions.mediaBytes";if(assertId(m,id),assertId(m,kind,"kind"),opts.attempt!==void 0&&opts.reference!==void 0)throw new TypeError(`${m}: \`attempt\` and \`reference\` cannot be combined`);let qs=new URLSearchParams;if(opts.attempt!==void 0){if(!Number.isInteger(opts.attempt)||opts.attempt<1)throw new TypeError(`${m}: \`attempt\` must be a positive integer`);qs.set("attempt",String(opts.attempt))}if(opts.reference!==void 0){if(opts.reference!=="first")throw new TypeError(`${m}: \`reference\` must be "first"`);qs.set("reference","first")}return this.t.bytes(withQuery(path1("/sessions",id,`/media/${encodeURIComponent(kind)}`),qs))}async resultToken(id){return assertId("sessions.resultToken",id),this.t.call("GET",path1("/sessions",id,"/result-token"))}},FlowsApi=class{constructor(t){this.t=t}t;async list(){return this.t.call("GET","/flows")}},PeopleApi=class{constructor(t){this.t=t}t;async get(id){return assertId("people.get",id),this.t.call("GET",path1("/people",id))}async list(query={}){return(await this.listPage(query)).data}async listPage(query={}){let qs=new URLSearchParams;query?.externalRef!==void 0&&(assertId("people.list",query.externalRef,"externalRef"),qs.set("externalRef",query.externalRef)),setPaging("people.list",qs,query??{});let page=await this.t.page(withQuery("/people",qs)),ref=query?.externalRef;if(ref===void 0)return page;let data=page.data.filter(p=>Array.isArray(p?.externalRefs)&&p.externalRefs.includes(ref));return page.nextCursor!==void 0?{data,nextCursor:page.nextCursor}:{data}}iterate(query={}){return follow(query.cursor,cursor=>this.listPage(cursor===void 0?{...query}:{...query,cursor}))}async revoke(id,input={},opts={}){return assertId("people.revoke",id),this.t.call("POST",path1("/people",id,"/revoke"),input,opts.idempotencyKey)}async screen(id,input={},opts={}){return assertId("people.screen",id),this.t.call("POST",path1("/people",id,"/screen"),input,opts.idempotencyKey)}async screenings(id,query={}){return(await this.screeningsPage(id,query)).data}async screeningsPage(id,query={}){let m="people.screenings";if(assertId(m,id),query?.limit!==void 0&&(!Number.isInteger(query.limit)||query.limit<1||query.limit>50))throw new TypeError(`${m}: \`limit\` must be an integer from 1 to 50`);let qs=new URLSearchParams;return setPaging(m,qs,query??{}),this.t.page(withQuery(path1("/people",id,"/screenings"),qs))}iterateScreenings(id,query={}){return follow(query.cursor,cursor=>this.screeningsPage(id,cursor===void 0?{...query}:{...query,cursor}))}async delete(id){return assertId("people.delete",id),this.t.call("DELETE",path1("/people",id))}async createSession(target,input,opts={}){let m="people.createSession",path;if(typeof target=="string")assertId(m,target),path=SUBJECT_ID_RE.test(target)?path1("/people",target,"/sessions"):path1("/people/by-external-ref",target,"/sessions");else if(target!==null&&typeof target=="object"&&"personId"in target)assertId(m,target.personId),path=path1("/people",target.personId,"/sessions");else{let ref=target?.externalRef;assertId(m,ref),path=path1("/people/by-external-ref",ref,"/sessions")}if(input?.mode!=="recheck"&&input?.mode!=="step_up")throw new TypeError(`${m}: \`mode\` must be 'recheck' or 'step_up'`);return this.t.call("POST",path,input,opts.idempotencyKey)}},BlocksApi=class{constructor(t){this.t=t}t;async create(input,opts={}){return this.t.call("POST","/blocks",input,opts.idempotencyKey??globalThis.crypto.randomUUID())}async list(query={}){return(await this.listPage(query)).data}async listPage(query={}){let qs=new URLSearchParams;return query?.kind!==void 0&&qs.set("kind",query.kind),query?.status!==void 0&&qs.set("status",query.status),setPaging("blocks.list",qs,query??{}),this.t.page(withQuery("/blocks",qs))}iterate(query={}){return follow(query.cursor,cursor=>this.listPage(cursor===void 0?{...query}:{...query,cursor}))}async get(id){return assertId("blocks.get",id),this.t.call("GET",path1("/blocks",id))}async lift(id,input={},opts={}){return assertId("blocks.lift",id),this.t.call("DELETE",path1("/blocks",id),input,opts.idempotencyKey)}async check(input){return this.t.call("POST","/blocks/check",input)}},SignalsApi=class{constructor(t){this.t=t}t;async list(query={}){return(await this.listPage(query)).data}async listPage(query={}){let m="signals.list",qs=new URLSearchParams;return query.kind!==void 0&&qs.set("kind",query.kind),query.severity!==void 0&&qs.set("severity",query.severity),query.status!==void 0&&qs.set("status",query.status),query.since!==void 0&&qs.set("since",isoOf(m,"since",query.since)),query.until!==void 0&&qs.set("until",isoOf(m,"until",query.until)),setPaging(m,qs,query),this.t.page(withQuery("/signals",qs))}iterate(query={}){return follow(query.cursor,cursor=>this.listPage(cursor===void 0?{...query}:{...query,cursor}))}async get(id){return assertId("signals.get",id),this.t.call("GET",path1("/signals",id))}async update(id,input,opts={}){return assertId("signals.update",id),this.t.call("PATCH",path1("/signals",id),input,opts.idempotencyKey)}},DevicesApi=class{constructor(t){this.t=t}t;async get(deviceId){return assertId("devices.get",deviceId,"deviceId"),this.t.call("GET",path1("/devices",deviceId))}async update(deviceId,input,opts={}){return assertId("devices.update",deviceId,"deviceId"),this.t.call("PATCH",path1("/devices",deviceId),input,opts.idempotencyKey)}},WebhooksApi=class{constructor(t){this.t=t}t;async test(input={}){return this.t.call("POST","/webhooks/test",input)}},SessionTestApi=class{constructor(t){this.t=t}t;async simulate(id,input,opts={}){return assertId("test.sessions.simulate",id),this.t.call("POST",path1("/sessions",id,"/simulate"),input,opts.idempotencyKey)}},SekyroTestApi=class{sessions;constructor(t){this.sessions=new SessionTestApi(t)}},Sekyro=class{sessions;people;blocks;signals;devices;flows;webhooks;test;#transport;constructor(opts){if(typeof opts?.apiKey!="string"||opts.apiKey.length===0)throw new SekyroConfigError("missing_api_key");let transport=new Transport(opts);this.#transport=transport;let bound={call:transport.call.bind(transport),page:transport.page.bind(transport),bytes:transport.bytes.bind(transport)};this.sessions=new SessionsApi(bound),this.people=new PeopleApi(bound),this.blocks=new BlocksApi(bound),this.signals=new SignalsApi(bound),this.devices=new DevicesApi(bound),this.flows=new FlowsApi(bound),this.webhooks=new WebhooksApi(bound),this.test=new SekyroTestApi(bound),Object.defineProperty(this,CONNECT_TELEMETRY,{value:{setConnector(identity){transport.connectorHeader=connectorHeaderOf(identity)},async postEvents(events,timeoutMs){await transport.call("POST","/connect/events",{events},void 0,timeoutMs)}},enumerable:!1})}async me(){return this.#transport.call("GET","/me")}async readiness(){return this.#transport.call("GET","/readiness")}};var REGISTRY_TEXT=[[/mauritan/i,"MR"],[/موريتاني/,"MR"]];function alpha2FromRegistry(values){let out=new Set;for(let v of values??[])if(typeof v=="string")for(let[re,code]of REGISTRY_TEXT)re.test(v)&&out.add(code);return[...out]}var ADAPTERS={MR:fromAnrpts};function personFromNationalRegistry(country,response,options){let adapter=Object.prototype.hasOwnProperty.call(ADAPTERS,country)?ADAPTERS[country]:void 0;if(adapter===void 0)throw new SekyroConfigError("registry_country_unsupported",`Sekyro AI: no national registry format for country \`${String(country)}\``);return adapter(response,options)}function invalid(what){throw new SekyroConfigError("invalid_registry_record",`Sekyro AI: the registry answer has no usable \`${what}\``)}function fromAnrpts(response,options){let raw=response?.personne,p=raw!==null&&typeof raw=="object"?raw:{},number=text(p.nni)??invalid("personne.nni"),names=[],latin=nameOf("Latn",p.prenomFr,p.patronymeFr,p.perePrenomFr);latin!==void 0&&names.push(latin);let arabic=nameOf("Arab",p.prenomAr,p.patronymeAr,p.perePrenomAr);arabic!==void 0&&names.push(arabic),names.length===0&&invalid("names (personne.prenomFr and personne.patronymeFr, or personne.prenomAr and personne.patronymeAr)");let birthDate=isoDay(p.dateNaissance)??invalid("personne.dateNaissance"),photo=(text(response?.photo)??invalid("photo")).replace(/\s+/g,""),fetchedAt=new Date(options?.fetchedAt??Number.NaN);if(Number.isNaN(fetchedAt.getTime()))throw new SekyroConfigError("invalid_registry_record","Sekyro AI: `fetchedAt` (when your system received the registry answer) is missing or not a valid date");let record={idNumber:{type:"national_id",issuingCountry:"MR",number},names,birthDate,photo,fetchedAt:fetchedAt.toISOString()},birthPlace=text(p.lieuNaissanceFr)??text(p.lieuNaissanceAr);birthPlace!==void 0&&(record.birthPlace=birthPlace);let sex=text(p.sexeCode)?.toUpperCase();(sex==="M"||sex==="F")&&(record.sex=sex);let adjectives=Array.isArray(p.nationalities)?p.nationalities.map(text).filter(n=>n!==void 0):[],nationality=text(options?.nationality)?.toUpperCase()??alpha2FromRegistry(adjectives)[0];if(nationality===void 0&&adjectives.length>0)throw new SekyroConfigError("registry_nationality_unmapped","Sekyro AI: the registry answer has a nationality the SDK cannot map; map it and pass options.nationality");nationality!==void 0&&(record.nationalities=[nationality]);let photoDate=isoDay(response?.datePhoto);return photoDate!==void 0&&(record.photoDate=photoDate),record}function nameOf(script,given,family,patronymic){let g=text(given),f=text(family);if(g===void 0||f===void 0)return;let pat=text(patronymic);return pat===void 0?{script,given:g,family:f}:{script,given:g,family:f,patronymic:pat}}function text(value){if(typeof value!="string")return;let s=value.trim();return s.length>0?s:void 0}function isoDay(value){let s=text(value);if(s===void 0)return;let iso=/^(\d{4})-(\d{2})-(\d{2})(?:$|T)/.exec(s),fr=/^(\d{2})\/(\d{2})\/(\d{4})$/.exec(s),[y,m,d]=iso?[iso[1],iso[2],iso[3]]:fr?[fr[3],fr[2],fr[1]]:[];if(y===void 0||m===void 0||d===void 0)return;let t=new Date(Date.UTC(Number(y),Number(m)-1,Number(d)));return t.getUTCFullYear()===Number(y)&&t.getUTCMonth()===Number(m)-1&&t.getUTCDate()===Number(d)?`${y}-${m}-${d}`:void 0}var import_node_crypto=require("crypto");var SEKYRO_SIGNATURE_HEADER="x-sekyro-signature",LEGACY_SIGNATURE_HEADER="x-ibtikar-signature";function signatureFromHeaders(headers){return readHeader(headers,SEKYRO_SIGNATURE_HEADER)??readHeader(headers,LEGACY_SIGNATURE_HEADER)}function readHeader(headers,name){if(typeof headers.get=="function"){let v2=headers.get(name);return v2===null||v2===""?void 0:v2}let record=headers,key=Object.keys(record).find(k=>k.toLowerCase()===name);if(key===void 0)return;let raw=record[key],v=Array.isArray(raw)?raw[0]:raw;return v===void 0||v===""?void 0:v}var HEX64=/^[0-9a-f]{64}$/i;function verifyWebhook(rawBody,header,secret,opts={}){if(!header||!secret)throw new SekyroWebhookError("invalid_signature");let parts=header.split(",").map(part=>{let trimmed=part.trim(),eq=trimmed.indexOf("=");return eq===-1?[trimmed,""]:[trimmed.slice(0,eq).trim(),trimmed.slice(eq+1).trim()]}),tRaw=parts.find(([k])=>k==="t")?.[1],t=tRaw!==void 0&&/^\d+$/.test(tRaw)?Number(tRaw):Number.NaN,sigs=parts.filter(([k])=>k==="v1").map(([,v])=>v);if(!Number.isSafeInteger(t)||sigs.length===0)throw new SekyroWebhookError("malformed");let nowSec=Math.floor((opts.now?.()??Date.now())/1e3),tolerance=opts.toleranceSec??300;if(Math.abs(nowSec-t)>tolerance)throw new SekyroWebhookError("stale");let expected=(0,import_node_crypto.createHmac)("sha256",secret).update(`${t}.${rawBody}`).digest();if(!sigs.some(hex=>{if(!HEX64.test(hex))return!1;let got=Buffer.from(hex,"hex");return got.length===expected.length&&(0,import_node_crypto.timingSafeEqual)(got,expected)}))throw new SekyroWebhookError("invalid_signature");let parsed;try{parsed=JSON.parse(rawBody)}catch{throw new SekyroWebhookError("malformed","Signed body is not valid JSON")}if(parsed===null||typeof parsed!="object"||Array.isArray(parsed))throw new SekyroWebhookError("malformed","Signed body is not a JSON object");return parsed}var import_jose=require("jose");var DEFAULT_RESULT_TOKEN_ISSUER="https://api.sekyro.ai",RESULT_TOKEN_JWKS_PATH="/.well-known/sekyro/jwks.json",SANDBOX_KID_PREFIX="sbx-",JWKS_MAX_AGE_MS=600*1e3,JWKS_COOLDOWN_MS=30*1e3,JWKS_TIMEOUT_MS=5e3,jwksCache=new Map,LOOPBACK_HOSTS2=new Set(["localhost","127.0.0.1","[::1]"]);function assertSafeUrl(raw){let url;try{url=new URL(raw)}catch{throw new SekyroResultTokenError("invalid_options","`jwksUrl` (or `issuer`) is not a URL")}if(url.protocol!=="https:"&&!(url.protocol==="http:"&&LOOPBACK_HOSTS2.has(url.hostname)))throw new SekyroResultTokenError("invalid_options","`jwksUrl` must be an https: URL (http: is allowed only for localhost, 127.0.0.1 or [::1])")}async function fetchKeySet(url,fetchImpl){let res;try{res=await fetchImpl(url,{method:"GET",headers:{accept:"application/json"},signal:AbortSignal.timeout(JWKS_TIMEOUT_MS)})}catch(err){throw new SekyroResultTokenError("jwks_unavailable",void 0,err)}if(!res.ok)throw new SekyroResultTokenError("jwks_unavailable",`Key set answered HTTP ${res.status}`);let body;try{body=await res.json()}catch(err){throw new SekyroResultTokenError("jwks_unavailable","Key set is not JSON",err)}try{return(0,import_jose.createLocalJWKSet)(body)}catch(err){throw new SekyroResultTokenError("jwks_unavailable","Key set is not a JWKS document",err)}}async function keySet(url,fetchImpl,nowMs,force){let entry=jwksCache.get(url);if(entry?.pending)return entry.pending;if(entry?.keys&&!force&&nowMs-entry.fetchedAt<JWKS_MAX_AGE_MS)return entry.keys;let pending=fetchKeySet(url,fetchImpl),next={fetchedAt:entry?.fetchedAt??0,pending};entry?.keys&&(next.keys=entry.keys),jwksCache.set(url,next);try{let keys=await pending;return jwksCache.set(url,{keys,fetchedAt:nowMs}),keys}catch(err){throw next.keys?jwksCache.set(url,{keys:next.keys,fetchedAt:next.fetchedAt}):jwksCache.delete(url),err}}function mapJoseError(err){if(err instanceof SekyroResultTokenError)return err;if(err instanceof import_jose.errors.JWTExpired)return new SekyroResultTokenError("expired",void 0,err);if(err instanceof import_jose.errors.JWTClaimValidationFailed){if(err.claim==="aud")return new SekyroResultTokenError("wrong_audience",void 0,err);if(err.claim==="iss")return new SekyroResultTokenError("wrong_issuer",void 0,err)}return new SekyroResultTokenError("invalid_token",void 0,err)}function str(v){return typeof v=="string"&&v.length>0?v:void 0}function appIdsOf(appId){let ids=Array.isArray(appId)?appId:[appId];if(ids.length===0||ids.some(id=>typeof id!="string"||id.length===0))throw new SekyroResultTokenError("invalid_options","`appId` is required (a non-empty string or array of them)");return ids}function matchedAud(aud,accepted){return typeof aud=="string"?aud:(aud??[]).find(a=>accepted.includes(a))??accepted[0]}function toResult(payload,claim,env,appId){if(claim.status!=="verified")throw new SekyroResultTokenError("invalid_token","The result token does not carry `status: verified`");let out={sessionId:String(claim.session_id),orgId:String(claim.org_id??""),appId,env,level:typeof claim.level=="number"?claim.level:null,assurance:str(claim.assurance)??null,status:"verified",unit:str(claim.unit)??null,verifiedAt:String(claim.verified_at??"")},subjectId=str(payload.sub);subjectId!==void 0&&(out.personId=personIdOf(subjectId));let externalRef=str(claim.external_ref);externalRef!==void 0&&(out.externalRef=externalRef);let flow=claim.flow;flow&&typeof flow.slug=="string"&&typeof flow.version=="number"&&(out.flow={slug:flow.slug,version:flow.version}),(claim.reuse_mode==="recheck"||claim.reuse_mode==="step_up")&&(out.reuseMode=claim.reuse_mode);let c=claim.checks;c&&typeof c=="object"&&(out.checks={attestation:c.attestation,captureProof:c.capture_proof,injectionSignals:c.injection_signals});let signals=signalsOf(claim.signals);signals!==void 0&&(out.signals=signals);let age=claim.age;age&&typeof age=="object"&&typeof age.over=="number"&&Number.isFinite(age.over)&&typeof age.method=="string"&&age.method!==""&&(out.age={over:age.over,method:age.method}),claim.address_verified===!0&&typeof claim.address_country=="string"&&/^[A-Z]{2}$/.test(claim.address_country)&&(out.addressVerified=!0,out.addressCountry=claim.address_country);let decision=decisionOf(claim.decision);decision!==void 0&&(out.decision=decision);let fi=failureIdentificationOf(claim.failure_identification);return fi!==void 0&&(out.failureIdentification=fi),out}function personIdOf(id){return id===""||id.startsWith("per_")?id:`per_${id}`}function isRecord2(v){return typeof v=="object"&&v!==null&&!Array.isArray(v)}var SEVERITIES=new Set(["low","medium","high"]);function signalsOf(raw){if(!Array.isArray(raw))return;let out=[];for(let e of raw){if(!isRecord2(e)||typeof e.kind!="string"||e.kind===""||!SEVERITIES.has(e.severity))continue;let evidence=Array.isArray(e.evidence)?e.evidence.filter(c=>typeof c=="string"&&c!==""):[];if(evidence.length===0)continue;let entry={kind:e.kind,severity:e.severity,evidence};isRecord2(e.details)&&Array.isArray(e.details.people)&&(entry.details={people:e.details.people.filter(isRecord2).map(p=>{let person={personId:personIdOf(str(p.person_id)??"")},ref=str(p.external_ref);return ref!==void 0&&(person.externalRef=ref),person})});let signalId=str(e.signal_id);signalId!==void 0&&(entry.signalId=signalId),out.push(entry)}return out.length>0?out:void 0}function decisionOf(raw){if(!isRecord2(raw))return;let{source,mode,votes}=raw;if(source!=="review"&&source!=="prior_review"||mode!=="single"&&mode!=="dual"||votes!==1&&votes!==2&&votes!==3)return;let out={source,mode,votes,reasons:Array.isArray(raw.reasons)?raw.reasons.filter(r=>typeof r=="string"):[],decidedAt:String(raw.decided_at??"")};typeof raw.agreement=="boolean"&&(out.agreement=raw.agreement);let sessionId=str(raw.session_id);return sessionId!==void 0&&(out.sessionId=sessionId),out}function failureIdentificationOf(raw){if(!isRecord2(raw)||!isRecord2(raw.match))return;let{kind,scope}=raw;if(kind!=="presenter"&&kind!=="shown_face"&&kind!=="other_identity"||scope!=="org"&&scope!=="registry")return;let m=raw.match;if(m.tier!==1&&m.tier!==2&&m.tier!==3||typeof m.score!="number"||m.band!=="strong"&&m.band!=="moderate")return;let match={tier:m.tier,score:m.score,band:m.band},person=str(m.person_id);person!==void 0&&(match.personId=personIdOf(person));let reference=str(m.reference);reference!==void 0&&(match.reference=reference);let photoId=str(m.photo_id);photoId!==void 0&&(match.photoId=photoId);let out={kind,scope,match},source=str(raw.reference_source);return source!==void 0&&(out.referenceSource=source),out}async function verifyResultToken(token,opts){let appIds=appIdsOf(opts?.appId);if(opts.env!=="live"&&opts.env!=="sandbox")throw new SekyroResultTokenError("env_required");if(typeof token!="string"||token.length===0)throw new SekyroResultTokenError("invalid_token","The token is empty");let issuer=(opts.issuer??DEFAULT_RESULT_TOKEN_ISSUER).replace(/\/+$/,""),jwksUrl=opts.jwksUrl??`${issuer}${RESULT_TOKEN_JWKS_PATH}`;assertSafeUrl(jwksUrl);let fetchImpl=opts.fetch??globalThis.fetch,now=opts.now??Date.now,verifyOpts={issuer,audience:appIds,algorithms:["ES256"],currentDate:new Date(now()),clockTolerance:opts.clockToleranceSec??30},verified;try{let keys=await keySet(jwksUrl,fetchImpl,now(),!1);try{verified=await(0,import_jose.jwtVerify)(token,keys,verifyOpts)}catch(err){if(!(err instanceof import_jose.errors.JWKSNoMatchingKey))throw err;let entry=jwksCache.get(jwksUrl);if(entry&&now()-entry.fetchedAt<JWKS_COOLDOWN_MS)throw err;verified=await(0,import_jose.jwtVerify)(token,await keySet(jwksUrl,fetchImpl,now(),!0),verifyOpts)}}catch(err){throw mapJoseError(err)}let{payload,protectedHeader}=verified,claim=payload.sekyro;if(typeof claim!="object"||claim===null||typeof claim.session_id!="string")throw new SekyroResultTokenError("invalid_token","The token has no `sekyro` claim");let c=claim,env=c.env;if(env!=="live"&&env!=="sandbox")throw new SekyroResultTokenError("invalid_token","The token has no valid `sekyro.env` claim");let sandboxKey=String(protectedHeader.kid??"").startsWith(SANDBOX_KID_PREFIX);if(env==="sandbox"!==sandboxKey)throw new SekyroResultTokenError("key_env_mismatch");if(env!==opts.env)throw new SekyroResultTokenError("wrong_env",`The token is for ${env}, expected ${opts.env}`);return toResult(payload,c,env,matchedAud(payload.aud,appIds))}0&&(module.exports={DEFAULT_BASE_URL,DEFAULT_RESULT_TOKEN_ISSUER,DEFAULT_TIMEOUT_MS,LEGACY_SIGNATURE_HEADER,RESULT_TOKEN_JWKS_PATH,SEKYRO_SIGNATURE_HEADER,Sekyro,SekyroApiError,SekyroConfigError,SekyroResultTokenError,SekyroWebhookError,isFlowError,personFromNationalRegistry,signatureFromHeaders,verifyResultToken,verifyWebhook});
1
+ "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};__export(src_exports,{DEFAULT_BASE_URL:()=>DEFAULT_BASE_URL,DEFAULT_RESULT_TOKEN_ISSUER:()=>DEFAULT_RESULT_TOKEN_ISSUER,DEFAULT_TIMEOUT_MS:()=>DEFAULT_TIMEOUT_MS,LEGACY_SIGNATURE_HEADER:()=>LEGACY_SIGNATURE_HEADER,RESULT_TOKEN_JWKS_PATH:()=>RESULT_TOKEN_JWKS_PATH,SEKYRO_SIGNATURE_HEADER:()=>SEKYRO_SIGNATURE_HEADER,Sekyro:()=>Sekyro,SekyroApiError:()=>SekyroApiError,SekyroConfigError:()=>SekyroConfigError,SekyroResultTokenError:()=>SekyroResultTokenError,SekyroWebhookError:()=>SekyroWebhookError,isFlowError:()=>isFlowError,personFromNationalRegistry:()=>personFromNationalRegistry,signatureFromHeaders:()=>signatureFromHeaders,verifyResultToken:()=>verifyResultToken,verifyWebhook:()=>verifyWebhook});module.exports=__toCommonJS(src_exports);var WEBHOOK_MESSAGES={invalid_signature:"No v1 signature in the header matches this body and secret",stale:"Delivery timestamp is outside the tolerance window",malformed:"Signature header or body is not in the expected format"},SekyroWebhookError=class extends Error{name="SekyroWebhookError";code;constructor(code,message=WEBHOOK_MESSAGES[code]){super(message),this.code=code}},RESULT_TOKEN_MESSAGES={invalid_token:"The result token is not a valid Sekyro AI token",expired:"The result token has expired",wrong_audience:"The result token was issued for another app",wrong_issuer:"The result token was not issued by the expected issuer",wrong_env:"The result token is for another environment",env_required:'`env` is required by verifyResultToken: pass "live" or "sandbox"',key_env_mismatch:"The result token environment does not match its signing key",jwks_unavailable:"The Sekyro AI public key set could not be fetched",invalid_options:"Invalid options for verifyResultToken"},SekyroResultTokenError=class extends Error{name="SekyroResultTokenError";code;constructor(code,message=RESULT_TOKEN_MESSAGES[code],cause){super(message,cause===void 0?void 0:{cause}),this.code=code}},CONFIG_MESSAGES={missing_api_key:"Sekyro AI: `apiKey` is required",invalid_base_url:"Sekyro AI: `baseUrl` must be an https: URL (http: is allowed only for localhost, 127.0.0.1 or [::1])",invalid_registry_record:"Sekyro AI: the registry answer can't be used as a registry record",registry_country_unsupported:"Sekyro AI: no national registry format for this country",registry_nationality_unmapped:"Sekyro AI: the registry answer has a nationality the SDK cannot map"},SekyroConfigError=class extends TypeError{name="SekyroConfigError";code;constructor(code,message=CONFIG_MESSAGES[code]){super(message),this.code=code}},SekyroApiError=class extends Error{name="SekyroApiError";status;code;requestId;details;fieldErrors;retryable;retryAfterSeconds;constructor(init){super(init.message,init.cause===void 0?void 0:{cause:init.cause}),this.status=init.status,this.code=init.code,this.requestId=init.requestId,this.details=init.details,this.fieldErrors=fieldErrorsOf(init.details),this.retryable=isRetryable(init.status,init.code),this.retryAfterSeconds=init.retryAfterSeconds}};function fieldErrorsOf(details){if(typeof details!="object"||details===null)return;let raw=details.fieldErrors;if(!Array.isArray(raw))return;let out=[];for(let entry of raw){if(typeof entry!="object"||entry===null)continue;let{field,code,expected}=entry;if(typeof field!="string"||typeof code!="string")continue;let item={field,code};typeof expected=="string"&&(item.expected=expected),out.push(item)}return out.length>0?out:void 0}function retryAfterSecondsOf(header,now=Date.now()){if(header===null)return;let value=header.trim();if(/^\d+$/.test(value))return Number(value);if(!/[a-z]/i.test(value))return;let at=Date.parse(value);if(!Number.isNaN(at))return Math.max(0,Math.ceil((at-now)/1e3))}var FLOW_ERROR_CODES=new Set(["flow_not_found","flow_not_published","flow_archived","override_invalid","override_widens_flow","reuse_disabled","choice_not_found","choice_locked","choice_option_unavailable"]),FLOW_REF_CODES=new Set(["flow_not_published","flow_archived","reuse_disabled"]),isRecord=x=>typeof x=="object"&&x!==null&&!Array.isArray(x),isStringArray=x=>Array.isArray(x)&&x.every(s=>typeof s=="string");function isIssue(x){return isRecord(x)&&typeof x.code=="string"&&typeof x.message=="string"}function hasFlowDetails(code,details){if(!isRecord(details)||!Array.isArray(details.issues)||!details.issues.every(isIssue))return!1;if(code==="override_widens_flow")return isStringArray(details.fields);if(FLOW_REF_CODES.has(code)){let flow=details.flow;return isRecord(flow)&&typeof flow.id=="string"&&typeof flow.slug=="string"}return!0}function isFlowError(err,...codes){return!(err instanceof SekyroApiError)||!FLOW_ERROR_CODES.has(err.code)||codes.length>0&&!codes.includes(err.code)?!1:hasFlowDetails(err.code,err.details)}function isRetryable(status,code){return code==="network"||code==="timeout"||code==="idempotency_in_progress"||status===429?!0:status>=500&&status<=599}var SDK_VERSION="1.0.0-rc.29";var USER_AGENT=`@sekyro/node/${SDK_VERSION}`,DEFAULT_BASE_URL="https://api.sekyro.ai/api/v2",DEFAULT_TIMEOUT_MS=3e4,CONNECT_TELEMETRY=Symbol.for("@sekyro/node.connect-telemetry"),CONNECTOR_PROVIDER_RE=/^[a-z0-9-]{1,32}$/,CONNECTOR_VERSION_RE=/^[0-9A-Za-z.+-]{1,64}$/;function connectorHeaderOf(identity){if(!identity||typeof identity!="object")return;let{provider,version}=identity;if(!(typeof provider!="string"||!CONNECTOR_PROVIDER_RE.test(provider))&&!(typeof version!="string"||!CONNECTOR_VERSION_RE.test(version)))return`${provider}/${version}`}var SUBJECT_ID_RE=/^(?:per_)?[0-9a-f]{24}$/i;function isSuccessEnvelope(value){return typeof value=="object"&&value!==null&&value.success===!0&&"data"in value}function isErrorEnvelope(value){if(typeof value!="object"||value===null)return!1;let v=value;if(v.success!==!1||typeof v.error!="object"||v.error===null)return!1;let e=v.error;return typeof e.code=="string"&&typeof e.message=="string"}function requestIdOf(error){return typeof error.requestId=="string"?error.requestId:void 0}function isAbortLike(err){if(typeof err!="object"||err===null)return!1;let name=err.name;return name==="TimeoutError"||name==="AbortError"}var LOOPBACK_HOSTS=new Set(["localhost","127.0.0.1","[::1]"]);function assertSafeBaseUrl(baseUrl){let url;try{url=new URL(baseUrl)}catch{throw new SekyroConfigError("invalid_base_url")}if(url.protocol!=="https:"&&!(url.protocol==="http:"&&LOOPBACK_HOSTS.has(url.hostname)))throw new SekyroConfigError("invalid_base_url")}var Transport=class{apiKey;baseUrl;timeoutMs;fetchImpl;connectorHeader;constructor(opts){let baseUrl=(opts.baseUrl??DEFAULT_BASE_URL).replace(/\/+$/,"");assertSafeBaseUrl(baseUrl),this.apiKey=opts.apiKey,this.baseUrl=baseUrl,this.timeoutMs=opts.timeoutMs??DEFAULT_TIMEOUT_MS,this.fetchImpl=opts.fetch??globalThis.fetch,this.connectorHeader=connectorHeaderOf(opts.connector)}async send(method,path,o){let timeoutMs=o.timeoutMs??this.timeoutMs,headers={authorization:`Bearer ${this.apiKey}`,accept:o.accept??"application/json","user-agent":USER_AGENT};o.body!==void 0&&(headers["content-type"]="application/json"),o.idempotencyKey!==void 0&&(headers["x-idempotency-key"]=o.idempotencyKey),this.connectorHeader!==void 0&&(headers["x-sekyro-connector"]=this.connectorHeader);let init={method,headers,signal:AbortSignal.timeout(timeoutMs)};o.body!==void 0&&(init.body=JSON.stringify(o.body));try{return await this.fetchImpl(`${this.baseUrl}${path}`,init)}catch(err){throw isAbortLike(err)?new SekyroApiError({status:0,code:"timeout",message:`Request timed out after ${timeoutMs}ms`,cause:err}):new SekyroApiError({status:0,code:"network",message:`Network error: ${err instanceof Error?err.message:String(err)}`,cause:err})}}errorOf(res,parsed){let retryAfterSeconds=retryAfterSecondsOf(res.headers.get("retry-after"));if(isErrorEnvelope(parsed)){let init2={status:res.status,code:parsed.error.code,message:parsed.error.message},requestId=requestIdOf(parsed.error);return requestId!==void 0&&(init2.requestId=requestId),parsed.error.details!==void 0&&(init2.details=parsed.error.details),retryAfterSeconds!==void 0&&(init2.retryAfterSeconds=retryAfterSeconds),new SekyroApiError(init2)}let init={status:res.status,code:"http_error",message:`HTTP ${res.status}${res.statusText?` ${res.statusText}`:""}`};return retryAfterSeconds!==void 0&&(init.retryAfterSeconds=retryAfterSeconds),new SekyroApiError(init)}async envelope(method,path,o){let res=await this.send(method,path,o),text2=await res.text(),parsed,parseError;try{parsed=text2.length>0?JSON.parse(text2):void 0}catch(err){parseError=err}if(!res.ok)throw this.errorOf(res,parsed);if(!isSuccessEnvelope(parsed))throw new SekyroApiError({status:res.status,code:"malformed_response",message:"Response is not a `{ success: true, data }` envelope",cause:parseError});return parsed}async call(method,path,body,idempotencyKey,timeoutMs=this.timeoutMs){return(await this.envelope(method,path,{body,idempotencyKey,timeoutMs})).data}async page(path){let env=await this.envelope("GET",path,{});if(!Array.isArray(env.data))throw new SekyroApiError({status:200,code:"malformed_response",message:"List response `data` is not an array"});let next=env.meta?.nextCursor;return typeof next=="string"&&next.length>0?{data:env.data,nextCursor:next}:{data:env.data}}async bytes(path){let res=await this.send("GET",path,{accept:"image/*, video/*"});if(!res.ok){let text2=await res.text().catch(()=>""),parsed;try{parsed=text2.length>0?JSON.parse(text2):void 0}catch{parsed=void 0}throw this.errorOf(res,parsed)}return{contentType:res.headers.get("content-type")??"application/octet-stream",bytes:new Uint8Array(await res.arrayBuffer())}}};function assertId(method,id,name="id"){if(typeof id!="string"||id.length===0)throw new TypeError(`${method}: \`${name}\` must be a non-empty string`)}var path1=(prefix,id,rest="")=>`${prefix}/${encodeURIComponent(id)}${rest}`;function isoOf(method,name,v){if(v instanceof Date){if(Number.isNaN(v.getTime()))throw new TypeError(`${method}: \`${name}\` is an invalid Date`);return v.toISOString()}if(typeof v!="string"||v.length===0)throw new TypeError(`${method}: \`${name}\` must be an ISO 8601 string or a Date`);return v}function setPaging(method,qs,q){if(q.limit!==void 0){if(!Number.isInteger(q.limit)||q.limit<1||q.limit>100)throw new TypeError(`${method}: \`limit\` must be an integer from 1 to 100`);qs.set("limit",String(q.limit))}if(q.cursor!==void 0){if(typeof q.cursor!="string"||q.cursor.length===0)throw new TypeError(`${method}: \`cursor\` must be a non-empty string`);qs.set("cursor",q.cursor)}}var withQuery=(path,qs)=>qs.size>0?`${path}?${qs.toString()}`:path;async function*follow(first,read){let cursor=first;for(;;){let page=await read(cursor);if(yield*page.data,page.nextCursor===void 0||page.nextCursor===cursor)return;cursor=page.nextCursor}}var SessionsApi=class{constructor(t){this.t=t}t;async create(input={},opts={}){return this.t.call("POST","/sessions",input,opts.idempotencyKey)}async selectMethod(id,method){return assertId("sessions.selectMethod",id),this.t.call("POST",path1("/sessions",id,"/method"),{method})}async get(id){return assertId("sessions.get",id),this.t.call("GET",path1("/sessions",id))}async cancel(id,opts={}){return assertId("sessions.cancel",id),this.t.call("POST",path1("/sessions",id,"/cancel"),void 0,opts.idempotencyKey)}async resendLink(id,opts={}){return assertId("sessions.resendLink",id),this.t.call("POST",path1("/sessions",id,"/link/resend"),{},opts.idempotencyKey)}async extendLink(id,input,opts={}){assertId("sessions.extendLink",id);let body;if(input!==null&&typeof input=="object"&&"ttlMinutes"in input&&!("expiresAt"in input)){if(!Number.isInteger(input.ttlMinutes)||input.ttlMinutes<1)throw new TypeError("sessions.extendLink: `ttlMinutes` must be a positive integer");body={ttlMinutes:input.ttlMinutes}}else if(input!==null&&typeof input=="object"&&"expiresAt"in input&&!("ttlMinutes"in input))body={expiresAt:isoOf("sessions.extendLink","expiresAt",input.expiresAt)};else throw new TypeError("sessions.extendLink: pass exactly one of `ttlMinutes` or `expiresAt`");return this.t.call("POST",path1("/sessions",id,"/link/extend"),body,opts.idempotencyKey)}async list(query={}){return(await this.listPage(query)).data}async listPage(query={}){let m="sessions.list",qs=new URLSearchParams;if(query.externalRef!==void 0&&(assertId(m,query.externalRef,"externalRef"),qs.set("externalRef",query.externalRef)),query.status!==void 0&&qs.set("status",query.status),query.reason!==void 0&&qs.set("reason",query.reason),query.closedBy!==void 0&&qs.set("closedBy",query.closedBy),query.flow!==void 0&&(assertId(m,query.flow,"flow"),qs.set("flow",query.flow)),query.createdAfter!==void 0&&qs.set("createdAfter",isoOf(m,"createdAfter",query.createdAfter)),query.createdBefore!==void 0&&qs.set("createdBefore",isoOf(m,"createdBefore",query.createdBefore)),query.deviceId!==void 0&&(assertId(m,query.deviceId,"deviceId"),qs.set("deviceId",query.deviceId)),query.signalKind!==void 0){let kinds=[...new Set(Array.isArray(query.signalKind)?query.signalKind:[query.signalKind])];if(kinds.length===0||kinds.some(k=>typeof k!="string"||k.length===0))throw new TypeError(`${m}: \`signalKind\` must be a kind or a non-empty list of kinds`);qs.set("signalKind",kinds.join(","))}query.signalSeverity!==void 0&&qs.set("signalSeverity",query.signalSeverity),setPaging(m,qs,query);let page=await this.t.page(withQuery("/sessions",qs)),data=page.data.filter(s=>(query.externalRef===void 0||s.externalRef===query.externalRef)&&(query.status===void 0||s.status===query.status));return page.nextCursor!==void 0?{data,nextCursor:page.nextCursor}:{data}}iterate(query={}){return follow(query.cursor,cursor=>this.listPage(cursor===void 0?{...query}:{...query,cursor}))}async media(id){return assertId("sessions.media",id),this.t.call("GET",path1("/sessions",id,"/media"))}async mediaBytes(id,kind,opts={}){let m="sessions.mediaBytes";if(assertId(m,id),assertId(m,kind,"kind"),opts.attempt!==void 0&&opts.reference!==void 0)throw new TypeError(`${m}: \`attempt\` and \`reference\` cannot be combined`);let qs=new URLSearchParams;if(opts.attempt!==void 0){if(!Number.isInteger(opts.attempt)||opts.attempt<1)throw new TypeError(`${m}: \`attempt\` must be a positive integer`);qs.set("attempt",String(opts.attempt))}if(opts.reference!==void 0){if(opts.reference!=="first")throw new TypeError(`${m}: \`reference\` must be "first"`);qs.set("reference","first")}return this.t.bytes(withQuery(path1("/sessions",id,`/media/${encodeURIComponent(kind)}`),qs))}async resultToken(id){return assertId("sessions.resultToken",id),this.t.call("GET",path1("/sessions",id,"/result-token"))}},FlowsApi=class{constructor(t){this.t=t}t;async list(){return this.t.call("GET","/flows")}},PeopleApi=class{constructor(t){this.t=t}t;async get(id){return assertId("people.get",id),this.t.call("GET",path1("/people",id))}async list(query={}){return(await this.listPage(query)).data}async listPage(query={}){let qs=new URLSearchParams;query?.externalRef!==void 0&&(assertId("people.list",query.externalRef,"externalRef"),qs.set("externalRef",query.externalRef)),setPaging("people.list",qs,query??{});let page=await this.t.page(withQuery("/people",qs)),ref=query?.externalRef;if(ref===void 0)return page;let data=page.data.filter(p=>Array.isArray(p?.externalRefs)&&p.externalRefs.includes(ref));return page.nextCursor!==void 0?{data,nextCursor:page.nextCursor}:{data}}iterate(query={}){return follow(query.cursor,cursor=>this.listPage(cursor===void 0?{...query}:{...query,cursor}))}async revoke(id,input={},opts={}){return assertId("people.revoke",id),this.t.call("POST",path1("/people",id,"/revoke"),input,opts.idempotencyKey)}async screen(id,input={},opts={}){return assertId("people.screen",id),this.t.call("POST",path1("/people",id,"/screen"),input,opts.idempotencyKey)}async screenings(id,query={}){return(await this.screeningsPage(id,query)).data}async screeningsPage(id,query={}){let m="people.screenings";if(assertId(m,id),query?.limit!==void 0&&(!Number.isInteger(query.limit)||query.limit<1||query.limit>50))throw new TypeError(`${m}: \`limit\` must be an integer from 1 to 50`);let qs=new URLSearchParams;return setPaging(m,qs,query??{}),this.t.page(withQuery(path1("/people",id,"/screenings"),qs))}iterateScreenings(id,query={}){return follow(query.cursor,cursor=>this.screeningsPage(id,cursor===void 0?{...query}:{...query,cursor}))}async delete(id){return assertId("people.delete",id),this.t.call("DELETE",path1("/people",id))}async createSession(target,input,opts={}){let m="people.createSession",path;if(typeof target=="string")assertId(m,target),path=SUBJECT_ID_RE.test(target)?path1("/people",target,"/sessions"):path1("/people/by-external-ref",target,"/sessions");else if(target!==null&&typeof target=="object"&&"personId"in target)assertId(m,target.personId),path=path1("/people",target.personId,"/sessions");else{let ref=target?.externalRef;assertId(m,ref),path=path1("/people/by-external-ref",ref,"/sessions")}if(input?.mode!=="recheck"&&input?.mode!=="step_up")throw new TypeError(`${m}: \`mode\` must be 'recheck' or 'step_up'`);return this.t.call("POST",path,input,opts.idempotencyKey)}},BlocksApi=class{constructor(t){this.t=t}t;async create(input,opts={}){return this.t.call("POST","/blocks",input,opts.idempotencyKey??globalThis.crypto.randomUUID())}async list(query={}){return(await this.listPage(query)).data}async listPage(query={}){let qs=new URLSearchParams;return query?.kind!==void 0&&qs.set("kind",query.kind),query?.status!==void 0&&qs.set("status",query.status),setPaging("blocks.list",qs,query??{}),this.t.page(withQuery("/blocks",qs))}iterate(query={}){return follow(query.cursor,cursor=>this.listPage(cursor===void 0?{...query}:{...query,cursor}))}async get(id){return assertId("blocks.get",id),this.t.call("GET",path1("/blocks",id))}async lift(id,input={},opts={}){return assertId("blocks.lift",id),this.t.call("DELETE",path1("/blocks",id),input,opts.idempotencyKey)}async check(input){return this.t.call("POST","/blocks/check",input)}},SignalsApi=class{constructor(t){this.t=t}t;async list(query={}){return(await this.listPage(query)).data}async listPage(query={}){let m="signals.list",qs=new URLSearchParams;return query.kind!==void 0&&qs.set("kind",query.kind),query.severity!==void 0&&qs.set("severity",query.severity),query.status!==void 0&&qs.set("status",query.status),query.since!==void 0&&qs.set("since",isoOf(m,"since",query.since)),query.until!==void 0&&qs.set("until",isoOf(m,"until",query.until)),setPaging(m,qs,query),this.t.page(withQuery("/signals",qs))}iterate(query={}){return follow(query.cursor,cursor=>this.listPage(cursor===void 0?{...query}:{...query,cursor}))}async get(id){return assertId("signals.get",id),this.t.call("GET",path1("/signals",id))}async update(id,input,opts={}){return assertId("signals.update",id),this.t.call("PATCH",path1("/signals",id),input,opts.idempotencyKey)}},ScreeningListEntriesApi=class{constructor(t){this.t=t}t;async upsert(listId,entries,opts={}){if(assertId("screeningLists.entries.upsert",listId,"listId"),!Array.isArray(entries)||entries.length===0||entries.length>1e3)throw new TypeError("screeningLists.entries.upsert: `entries` must hold 1 to 1000 entries");return this.t.call("POST",path1("/screening-lists",listId,"/entries"),{entries},opts.idempotencyKey??globalThis.crypto.randomUUID())}async list(listId,query={}){return(await this.listPage(listId,query)).data}async listPage(listId,query={}){let m="screeningLists.entries.list";assertId(m,listId,"listId");let qs=new URLSearchParams;return setPaging(m,qs,query??{}),this.t.page(withQuery(path1("/screening-lists",listId,"/entries"),qs))}iterate(listId,query={}){return follow(query.cursor,cursor=>this.listPage(listId,cursor===void 0?{...query}:{...query,cursor}))}async get(listId,entryId){return assertId("screeningLists.entries.get",listId,"listId"),assertId("screeningLists.entries.get",entryId,"entryId"),this.t.call("GET",`${path1("/screening-lists",listId,"/entries")}/${encodeURIComponent(entryId)}`)}async delete(listId,entryId){return assertId("screeningLists.entries.delete",listId,"listId"),assertId("screeningLists.entries.delete",entryId,"entryId"),this.t.call("DELETE",`${path1("/screening-lists",listId,"/entries")}/${encodeURIComponent(entryId)}`)}async deleteByReference(listId,reference){assertId("screeningLists.entries.deleteByReference",listId,"listId"),assertId("screeningLists.entries.deleteByReference",reference,"reference");let qs=new URLSearchParams({reference});return this.t.call("DELETE",withQuery(path1("/screening-lists",listId,"/entries"),qs))}},ScreeningListsApi=class{constructor(t){this.t=t;this.entries=new ScreeningListEntriesApi(t)}t;entries;async create(input,opts={}){return this.t.call("POST","/screening-lists",input,opts.idempotencyKey??globalThis.crypto.randomUUID())}async list(){return this.t.call("GET","/screening-lists")}async get(id){return assertId("screeningLists.get",id),this.t.call("GET",path1("/screening-lists",id))}async update(id,input,opts={}){if(assertId("screeningLists.update",id),input===null||typeof input!="object"||Object.keys(input).length===0)throw new TypeError("screeningLists.update: `input` must change at least one field");return this.t.call("PATCH",path1("/screening-lists",id),input,opts.idempotencyKey??globalThis.crypto.randomUUID())}async delete(id){return assertId("screeningLists.delete",id),this.t.call("DELETE",path1("/screening-lists",id))}},DevicesApi=class{constructor(t){this.t=t}t;async get(deviceId){return assertId("devices.get",deviceId,"deviceId"),this.t.call("GET",path1("/devices",deviceId))}async update(deviceId,input,opts={}){return assertId("devices.update",deviceId,"deviceId"),this.t.call("PATCH",path1("/devices",deviceId),input,opts.idempotencyKey)}},WebhooksApi=class{constructor(t){this.t=t}t;async test(input={}){return this.t.call("POST","/webhooks/test",input)}},SessionTestApi=class{constructor(t){this.t=t}t;async simulate(id,input,opts={}){return assertId("test.sessions.simulate",id),this.t.call("POST",path1("/sessions",id,"/simulate"),input,opts.idempotencyKey)}},SekyroTestApi=class{sessions;constructor(t){this.sessions=new SessionTestApi(t)}},Sekyro=class{sessions;people;blocks;signals;screeningLists;devices;flows;webhooks;test;#transport;constructor(opts){if(typeof opts?.apiKey!="string"||opts.apiKey.length===0)throw new SekyroConfigError("missing_api_key");let transport=new Transport(opts);this.#transport=transport;let bound={call:transport.call.bind(transport),page:transport.page.bind(transport),bytes:transport.bytes.bind(transport)};this.sessions=new SessionsApi(bound),this.people=new PeopleApi(bound),this.blocks=new BlocksApi(bound),this.signals=new SignalsApi(bound),this.screeningLists=new ScreeningListsApi(bound),this.devices=new DevicesApi(bound),this.flows=new FlowsApi(bound),this.webhooks=new WebhooksApi(bound),this.test=new SekyroTestApi(bound),Object.defineProperty(this,CONNECT_TELEMETRY,{value:{setConnector(identity){transport.connectorHeader=connectorHeaderOf(identity)},async postEvents(events,timeoutMs){await transport.call("POST","/connect/events",{events},void 0,timeoutMs)}},enumerable:!1})}async me(){return this.#transport.call("GET","/me")}async readiness(){return this.#transport.call("GET","/readiness")}};var REGISTRY_TEXT=[[/mauritan/i,"MR"],[/موريتاني/,"MR"]];function alpha2FromRegistry(values){let out=new Set;for(let v of values??[])if(typeof v=="string")for(let[re,code]of REGISTRY_TEXT)re.test(v)&&out.add(code);return[...out]}var ADAPTERS={MR:fromAnrpts};function personFromNationalRegistry(country,response,options){let adapter=Object.prototype.hasOwnProperty.call(ADAPTERS,country)?ADAPTERS[country]:void 0;if(adapter===void 0)throw new SekyroConfigError("registry_country_unsupported",`Sekyro AI: no national registry format for country \`${String(country)}\``);return adapter(response,options)}function invalid(what){throw new SekyroConfigError("invalid_registry_record",`Sekyro AI: the registry answer has no usable \`${what}\``)}function fromAnrpts(response,options){let raw=response?.personne,p=raw!==null&&typeof raw=="object"?raw:{},number=text(p.nni)??invalid("personne.nni"),names=[],latin=nameOf("Latn",p.prenomFr,p.patronymeFr,p.perePrenomFr);latin!==void 0&&names.push(latin);let arabic=nameOf("Arab",p.prenomAr,p.patronymeAr,p.perePrenomAr);arabic!==void 0&&names.push(arabic),names.length===0&&invalid("names (personne.prenomFr and personne.patronymeFr, or personne.prenomAr and personne.patronymeAr)");let birthDate=isoDay(p.dateNaissance)??invalid("personne.dateNaissance"),photo=(text(response?.photo)??invalid("photo")).replace(/\s+/g,""),fetchedAt=new Date(options?.fetchedAt??Number.NaN);if(Number.isNaN(fetchedAt.getTime()))throw new SekyroConfigError("invalid_registry_record","Sekyro AI: `fetchedAt` (when your system received the registry answer) is missing or not a valid date");let record={idNumber:{type:"national_id",issuingCountry:"MR",number},names,birthDate,photo,fetchedAt:fetchedAt.toISOString()},birthPlace=text(p.lieuNaissanceFr)??text(p.lieuNaissanceAr);birthPlace!==void 0&&(record.birthPlace=birthPlace);let sex=text(p.sexeCode)?.toUpperCase();(sex==="M"||sex==="F")&&(record.sex=sex);let adjectives=Array.isArray(p.nationalities)?p.nationalities.map(text).filter(n=>n!==void 0):[],nationality=text(options?.nationality)?.toUpperCase()??alpha2FromRegistry(adjectives)[0];if(nationality===void 0&&adjectives.length>0)throw new SekyroConfigError("registry_nationality_unmapped","Sekyro AI: the registry answer has a nationality the SDK cannot map; map it and pass options.nationality");nationality!==void 0&&(record.nationalities=[nationality]);let photoDate=isoDay(response?.datePhoto);return photoDate!==void 0&&(record.photoDate=photoDate),record}function nameOf(script,given,family,patronymic){let g=text(given),f=text(family);if(g===void 0||f===void 0)return;let pat=text(patronymic);return pat===void 0?{script,given:g,family:f}:{script,given:g,family:f,patronymic:pat}}function text(value){if(typeof value!="string")return;let s=value.trim();return s.length>0?s:void 0}function isoDay(value){let s=text(value);if(s===void 0)return;let iso=/^(\d{4})-(\d{2})-(\d{2})(?:$|T)/.exec(s),fr=/^(\d{2})\/(\d{2})\/(\d{4})$/.exec(s),[y,m,d]=iso?[iso[1],iso[2],iso[3]]:fr?[fr[3],fr[2],fr[1]]:[];if(y===void 0||m===void 0||d===void 0)return;let t=new Date(Date.UTC(Number(y),Number(m)-1,Number(d)));return t.getUTCFullYear()===Number(y)&&t.getUTCMonth()===Number(m)-1&&t.getUTCDate()===Number(d)?`${y}-${m}-${d}`:void 0}var import_node_crypto=require("crypto");var SEKYRO_SIGNATURE_HEADER="x-sekyro-signature",LEGACY_SIGNATURE_HEADER="x-ibtikar-signature";function signatureFromHeaders(headers){return readHeader(headers,SEKYRO_SIGNATURE_HEADER)??readHeader(headers,LEGACY_SIGNATURE_HEADER)}function readHeader(headers,name){if(typeof headers.get=="function"){let v2=headers.get(name);return v2===null||v2===""?void 0:v2}let record=headers,key=Object.keys(record).find(k=>k.toLowerCase()===name);if(key===void 0)return;let raw=record[key],v=Array.isArray(raw)?raw[0]:raw;return v===void 0||v===""?void 0:v}var HEX64=/^[0-9a-f]{64}$/i;function verifyWebhook(rawBody,header,secret,opts={}){if(!header||!secret)throw new SekyroWebhookError("invalid_signature");let parts=header.split(",").map(part=>{let trimmed=part.trim(),eq=trimmed.indexOf("=");return eq===-1?[trimmed,""]:[trimmed.slice(0,eq).trim(),trimmed.slice(eq+1).trim()]}),tRaw=parts.find(([k])=>k==="t")?.[1],t=tRaw!==void 0&&/^\d+$/.test(tRaw)?Number(tRaw):Number.NaN,sigs=parts.filter(([k])=>k==="v1").map(([,v])=>v);if(!Number.isSafeInteger(t)||sigs.length===0)throw new SekyroWebhookError("malformed");let nowSec=Math.floor((opts.now?.()??Date.now())/1e3),tolerance=opts.toleranceSec??300;if(Math.abs(nowSec-t)>tolerance)throw new SekyroWebhookError("stale");let expected=(0,import_node_crypto.createHmac)("sha256",secret).update(`${t}.${rawBody}`).digest();if(!sigs.some(hex=>{if(!HEX64.test(hex))return!1;let got=Buffer.from(hex,"hex");return got.length===expected.length&&(0,import_node_crypto.timingSafeEqual)(got,expected)}))throw new SekyroWebhookError("invalid_signature");let parsed;try{parsed=JSON.parse(rawBody)}catch{throw new SekyroWebhookError("malformed","Signed body is not valid JSON")}if(parsed===null||typeof parsed!="object"||Array.isArray(parsed))throw new SekyroWebhookError("malformed","Signed body is not a JSON object");return parsed}var import_jose=require("jose");var DEFAULT_RESULT_TOKEN_ISSUER="https://api.sekyro.ai",RESULT_TOKEN_JWKS_PATH="/.well-known/sekyro/jwks.json",SANDBOX_KID_PREFIX="sbx-",JWKS_MAX_AGE_MS=600*1e3,JWKS_COOLDOWN_MS=30*1e3,JWKS_TIMEOUT_MS=5e3,jwksCache=new Map,LOOPBACK_HOSTS2=new Set(["localhost","127.0.0.1","[::1]"]);function assertSafeUrl(raw){let url;try{url=new URL(raw)}catch{throw new SekyroResultTokenError("invalid_options","`jwksUrl` (or `issuer`) is not a URL")}if(url.protocol!=="https:"&&!(url.protocol==="http:"&&LOOPBACK_HOSTS2.has(url.hostname)))throw new SekyroResultTokenError("invalid_options","`jwksUrl` must be an https: URL (http: is allowed only for localhost, 127.0.0.1 or [::1])")}async function fetchKeySet(url,fetchImpl){let res;try{res=await fetchImpl(url,{method:"GET",headers:{accept:"application/json"},signal:AbortSignal.timeout(JWKS_TIMEOUT_MS)})}catch(err){throw new SekyroResultTokenError("jwks_unavailable",void 0,err)}if(!res.ok)throw new SekyroResultTokenError("jwks_unavailable",`Key set answered HTTP ${res.status}`);let body;try{body=await res.json()}catch(err){throw new SekyroResultTokenError("jwks_unavailable","Key set is not JSON",err)}try{return(0,import_jose.createLocalJWKSet)(body)}catch(err){throw new SekyroResultTokenError("jwks_unavailable","Key set is not a JWKS document",err)}}async function keySet(url,fetchImpl,nowMs,force){let entry=jwksCache.get(url);if(entry?.pending)return entry.pending;if(entry?.keys&&!force&&nowMs-entry.fetchedAt<JWKS_MAX_AGE_MS)return entry.keys;let pending=fetchKeySet(url,fetchImpl),next={fetchedAt:entry?.fetchedAt??0,pending};entry?.keys&&(next.keys=entry.keys),jwksCache.set(url,next);try{let keys=await pending;return jwksCache.set(url,{keys,fetchedAt:nowMs}),keys}catch(err){throw next.keys?jwksCache.set(url,{keys:next.keys,fetchedAt:next.fetchedAt}):jwksCache.delete(url),err}}function mapJoseError(err){if(err instanceof SekyroResultTokenError)return err;if(err instanceof import_jose.errors.JWTExpired)return new SekyroResultTokenError("expired",void 0,err);if(err instanceof import_jose.errors.JWTClaimValidationFailed){if(err.claim==="aud")return new SekyroResultTokenError("wrong_audience",void 0,err);if(err.claim==="iss")return new SekyroResultTokenError("wrong_issuer",void 0,err)}return new SekyroResultTokenError("invalid_token",void 0,err)}function str(v){return typeof v=="string"&&v.length>0?v:void 0}function appIdsOf(appId){let ids=Array.isArray(appId)?appId:[appId];if(ids.length===0||ids.some(id=>typeof id!="string"||id.length===0))throw new SekyroResultTokenError("invalid_options","`appId` is required (a non-empty string or array of them)");return ids}function matchedAud(aud,accepted){return typeof aud=="string"?aud:(aud??[]).find(a=>accepted.includes(a))??accepted[0]}function toResult(payload,claim,env,appId){if(claim.status!=="verified")throw new SekyroResultTokenError("invalid_token","The result token does not carry `status: verified`");let out={sessionId:String(claim.session_id),orgId:String(claim.org_id??""),appId,env,level:typeof claim.level=="number"?claim.level:null,assurance:str(claim.assurance)??null,status:"verified",unit:str(claim.unit)??null,verifiedAt:String(claim.verified_at??"")},subjectId=str(payload.sub);subjectId!==void 0&&(out.personId=personIdOf(subjectId));let externalRef=str(claim.external_ref);externalRef!==void 0&&(out.externalRef=externalRef);let flow=claim.flow;flow&&typeof flow.slug=="string"&&typeof flow.version=="number"&&(out.flow={slug:flow.slug,version:flow.version}),(claim.reuse_mode==="recheck"||claim.reuse_mode==="step_up")&&(out.reuseMode=claim.reuse_mode);let c=claim.checks;c&&typeof c=="object"&&(out.checks={attestation:c.attestation,captureProof:c.capture_proof,injectionSignals:c.injection_signals});let signals=signalsOf(claim.signals);signals!==void 0&&(out.signals=signals);let age=claim.age;age&&typeof age=="object"&&typeof age.over=="number"&&Number.isFinite(age.over)&&typeof age.method=="string"&&age.method!==""&&(out.age={over:age.over,method:age.method}),claim.address_verified===!0&&typeof claim.address_country=="string"&&/^[A-Z]{2}$/.test(claim.address_country)&&(out.addressVerified=!0,out.addressCountry=claim.address_country);let decision=decisionOf(claim.decision);decision!==void 0&&(out.decision=decision);let fi=failureIdentificationOf(claim.failure_identification);return fi!==void 0&&(out.failureIdentification=fi),out}function personIdOf(id){return id===""||id.startsWith("per_")?id:`per_${id}`}function isRecord2(v){return typeof v=="object"&&v!==null&&!Array.isArray(v)}var SEVERITIES=new Set(["low","medium","high"]);function signalsOf(raw){if(!Array.isArray(raw))return;let out=[];for(let e of raw){if(!isRecord2(e)||typeof e.kind!="string"||e.kind===""||!SEVERITIES.has(e.severity))continue;let evidence=Array.isArray(e.evidence)?e.evidence.filter(c=>typeof c=="string"&&c!==""):[];if(evidence.length===0)continue;let entry={kind:e.kind,severity:e.severity,evidence};isRecord2(e.details)&&Array.isArray(e.details.people)&&(entry.details={people:e.details.people.filter(isRecord2).map(p=>{let person={personId:personIdOf(str(p.person_id)??"")},ref=str(p.external_ref);return ref!==void 0&&(person.externalRef=ref),person})});let signalId=str(e.signal_id);signalId!==void 0&&(entry.signalId=signalId),out.push(entry)}return out.length>0?out:void 0}function decisionOf(raw){if(!isRecord2(raw))return;let{source,mode,votes}=raw;if(source!=="review"&&source!=="prior_review"||mode!=="single"&&mode!=="dual"||votes!==1&&votes!==2&&votes!==3)return;let out={source,mode,votes,reasons:Array.isArray(raw.reasons)?raw.reasons.filter(r=>typeof r=="string"):[],decidedAt:String(raw.decided_at??"")};typeof raw.agreement=="boolean"&&(out.agreement=raw.agreement);let sessionId=str(raw.session_id);return sessionId!==void 0&&(out.sessionId=sessionId),out}function failureIdentificationOf(raw){if(!isRecord2(raw)||!isRecord2(raw.match))return;let{kind,scope}=raw;if(kind!=="presenter"&&kind!=="shown_face"&&kind!=="other_identity"||scope!=="org"&&scope!=="registry")return;let m=raw.match;if(m.tier!==1&&m.tier!==2&&m.tier!==3||typeof m.score!="number"||m.band!=="strong"&&m.band!=="moderate")return;let match={tier:m.tier,score:m.score,band:m.band},person=str(m.person_id);person!==void 0&&(match.personId=personIdOf(person));let reference=str(m.reference);reference!==void 0&&(match.reference=reference);let photoId=str(m.photo_id);photoId!==void 0&&(match.photoId=photoId);let out={kind,scope,match},source=str(raw.reference_source);return source!==void 0&&(out.referenceSource=source),out}async function verifyResultToken(token,opts){let appIds=appIdsOf(opts?.appId);if(opts.env!=="live"&&opts.env!=="sandbox")throw new SekyroResultTokenError("env_required");if(typeof token!="string"||token.length===0)throw new SekyroResultTokenError("invalid_token","The token is empty");let issuer=(opts.issuer??DEFAULT_RESULT_TOKEN_ISSUER).replace(/\/+$/,""),jwksUrl=opts.jwksUrl??`${issuer}${RESULT_TOKEN_JWKS_PATH}`;assertSafeUrl(jwksUrl);let fetchImpl=opts.fetch??globalThis.fetch,now=opts.now??Date.now,verifyOpts={issuer,audience:appIds,algorithms:["ES256"],currentDate:new Date(now()),clockTolerance:opts.clockToleranceSec??30},verified;try{let keys=await keySet(jwksUrl,fetchImpl,now(),!1);try{verified=await(0,import_jose.jwtVerify)(token,keys,verifyOpts)}catch(err){if(!(err instanceof import_jose.errors.JWKSNoMatchingKey))throw err;let entry=jwksCache.get(jwksUrl);if(entry&&now()-entry.fetchedAt<JWKS_COOLDOWN_MS)throw err;verified=await(0,import_jose.jwtVerify)(token,await keySet(jwksUrl,fetchImpl,now(),!0),verifyOpts)}}catch(err){throw mapJoseError(err)}let{payload,protectedHeader}=verified,claim=payload.sekyro;if(typeof claim!="object"||claim===null||typeof claim.session_id!="string")throw new SekyroResultTokenError("invalid_token","The token has no `sekyro` claim");let c=claim,env=c.env;if(env!=="live"&&env!=="sandbox")throw new SekyroResultTokenError("invalid_token","The token has no valid `sekyro.env` claim");let sandboxKey=String(protectedHeader.kid??"").startsWith(SANDBOX_KID_PREFIX);if(env==="sandbox"!==sandboxKey)throw new SekyroResultTokenError("key_env_mismatch");if(env!==opts.env)throw new SekyroResultTokenError("wrong_env",`The token is for ${env}, expected ${opts.env}`);return toResult(payload,c,env,matchedAud(payload.aud,appIds))}0&&(module.exports={DEFAULT_BASE_URL,DEFAULT_RESULT_TOKEN_ISSUER,DEFAULT_TIMEOUT_MS,LEGACY_SIGNATURE_HEADER,RESULT_TOKEN_JWKS_PATH,SEKYRO_SIGNATURE_HEADER,Sekyro,SekyroApiError,SekyroConfigError,SekyroResultTokenError,SekyroWebhookError,isFlowError,personFromNationalRegistry,signatureFromHeaders,verifyResultToken,verifyWebhook});
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { b as ServiceId, c as SessionPersonInput, d as WebhookEnvelope, R as ReviewReason, e as SekyroEnvironment, V as VerificationLevel, f as VerificationAssurance, g as VerificationUnit, h as SubjectReuseMode, i as ResultCheckProofs, j as SessionSignal, A as AgeMethod, k as FailureIdentification, F as FetchLike } from './client-D6zMa7hQ.cjs';
2
- export { l as AgeResult, m as AmlMatchFlaggedEventData, n as ApiKeyIdentity, B as Block, o as BlockCheck, p as BlockCheckInput, q as BlockDuration, r as BlockIdNumber, s as BlockKind, t as BlockMatch, u as BlockReason, v as BlocksApi, w as CameraUnavailableCause, x as CheckState, y as CheckType, z as ClosedBy, D as ConnectorIdentity, E as CreateBlockInput, G as CreateSessionInput, C as CreatedSession, H as DEFAULT_BASE_URL, I as DEFAULT_TIMEOUT_MS, J as DecisionReason, K as Declared, M as DeclaredAddress, N as DeclaredAnswer, O as DeclaredConsent, P as DeclaredMismatch, Q as DeepPartial, T as DeletedPerson, U as DeliverOptions, X as Device, Y as DevicesApi, Z as DocumentSubstitutionSettings, _ as EidResult, $ as EligibilityReason, a0 as ExtendLinkInput, a1 as FlowOverridableSettings, a2 as FlowOverrides, a3 as FlowServiceSettings, a4 as FlowSummary, a5 as FlowsApi, a6 as FormAnswerValue, a7 as FormQuestionType, a8 as FraudReason, a9 as FraudResponse, aa as IdNumberReason, ab as Identity, ac as IdentityAddress, ad as IdentityBirthPlace, ae as IdentityDocument, af as IdentityIdNumber, ag as IdentityMethod, ah as IdentityName, ai as IdentityProofOfAddress, aj as IdentityScalarKey, ak as IdentitySource, al as IdentitySources, am as IncludedVerificationsThresholdReachedEventData, an as LevelTarget, ao as LiftBlockInput, ap as ListBlocksQuery, aq as ListPeopleQuery, ar as ListScreeningsQuery, as as ListSessionsQuery, at as ListSignalsQuery, L as Locale, au as MatchReason, av as MediaBytes, aw as MediaBytesOptions, ax as MediaItem, ay as MediaKind, az as MediaList, aA as NameForm, aB as OverridableServiceId, aC as Page, aD as PeopleApi, aE as Person, aF as PersonAddressInput, aG as PersonBirthPlaceInput, aH as PersonDeletedEventData, aI as PersonDocumentInput, aJ as PersonEnrolledEventData, aK as PersonRef, aL as PersonSession, aM as PersonSessionInput, aN as PersonSessionTarget, aO as PersonUpdatedEventData, aP as PoaDocumentKind, aQ as PoaReason, aR as PoaRule, aS as PoaRuleKind, aT as PoaRules, aU as PortraitReportEntry, aV as PriorReviewReason, aW as ProbeBindingReason, aX as ProbeQuality, aY as ProfileDocumentType, aZ as ReadinessProtection, a_ as ReadinessReport, a$ as RequestOptions, b0 as ResultTokenResponse, b1 as ReviewOutcomeReason, b2 as RevokePersonInput, b3 as SandboxSimulatedReason, b4 as SandboxSimulation, b5 as ScreenPersonInput, b6 as Screening, b7 as ScreeningHit, b8 as ScreeningHitSummary, b9 as ScreeningList, ba as ScreeningStatus, bb as ScreeningTrigger, bc as ScreeningUnavailableReason, a as Sekyro, bd as SekyroOptions, be as SekyroTestApi, bf as Session, bg as SessionClosedEventDataBase, bh as SessionDecidingStep, bi as SessionDevice, bj as SessionEventDataBase, bk as SessionEventStep, bl as SessionFailureReason, bm as SessionFlowRef, bn as SessionHandoff, bo as SessionHandoffDevice, bp as SessionLifecycleEventData, bq as SessionLinkDelivery, br as SessionLinkExpiry, bs as SessionLinkInput, bt as SessionNetwork, bu as SessionNetworkEvent, bv as SessionNotVerifiedEventData, S as SessionReason, bw as SessionRetakeRequestedEventData, bx as SessionReviewPendingEventData, by as SessionScreening, bz as SessionStatus, bA as SessionStep, bB as SessionStepAttempts, bC as SessionStepBand, bD as SessionStepDecision, bE as SessionStepDocument, bF as SessionStepPortrait, bG as SessionTestApi, bH as SessionVerifiedEventData, bI as SessionsApi, bJ as Signal, bK as SignalEventData, bL as SignalEvidence, bM as SignalGrade, bN as SignalKeyKind, bO as SignalKind, bP as SignalSeverity, bQ as SignalStatus, bR as SignalsApi, bS as SimulateSessionInput, bT as StepResult, bU as SubjectAssurance, bV as SubjectIdNumber, bW as SubjectName, bX as SubjectReferenceSource, bY as SubjectReuseTarget, bZ as SubjectStatus, b_ as UpdateSignalInput, b$ as UsageLimitReachedEventData, c0 as UsageThresholdReachedEventData, c1 as VerifiedContacts, c2 as WebhookEnvelopeOf, c3 as WebhookEventDataMap, W as WebhookEventType, c4 as WebhookTestInput, c5 as WebhookTestResult, c6 as WebhooksApi } from './client-D6zMa7hQ.cjs';
1
+ import { b as ServiceId, c as SessionPersonInput, d as WebhookEnvelope, R as ReviewReason, e as SekyroEnvironment, V as VerificationLevel, f as VerificationAssurance, g as VerificationUnit, h as SubjectReuseMode, i as ResultCheckProofs, j as SessionSignal, A as AgeMethod, k as FailureIdentification, F as FetchLike } from './client-B4wM-_Xp.cjs';
2
+ export { l as AgeResult, m as AmlMatchFlaggedEventData, n as ApiKeyIdentity, B as Block, o as BlockCheck, p as BlockCheckInput, q as BlockDuration, r as BlockIdNumber, s as BlockKind, t as BlockMatch, u as BlockReason, v as BlocksApi, w as CameraUnavailableCause, x as CheckState, y as CheckType, z as ClientScreeningList, D as ClientScreeningListEntriesWrite, E as ClientScreeningListEntry, G as ClientScreeningListEntryErrorCode, H as ClientScreeningListEntryInput, I as ClientScreeningListIdNumber, J as ClosedBy, K as ConnectorIdentity, M as CreateBlockInput, N as CreateScreeningListInput, O as CreateSessionInput, C as CreatedSession, P as DEFAULT_BASE_URL, Q as DEFAULT_TIMEOUT_MS, T as DecisionReason, U as Declared, X as DeclaredAddress, Y as DeclaredAnswer, Z as DeclaredConsent, _ as DeclaredMismatch, $ as DeepPartial, a0 as DeletedPerson, a1 as DeletedScreeningListItem, a2 as DeliverOptions, a3 as Device, a4 as DevicesApi, a5 as DocumentSubstitutionSettings, a6 as EidResult, a7 as EligibilityReason, a8 as ExtendLinkInput, a9 as FlowOverridableSettings, aa as FlowOverrides, ab as FlowServiceSettings, ac as FlowSummary, ad as FlowsApi, ae as FormAnswerValue, af as FormQuestionType, ag as FraudReason, ah as FraudResponse, ai as IdNumberReason, aj as Identity, ak as IdentityAddress, al as IdentityBirthPlace, am as IdentityDocument, an as IdentityIdNumber, ao as IdentityMethod, ap as IdentityName, aq as IdentityProofOfAddress, ar as IdentityScalarKey, as as IdentitySource, at as IdentitySources, au as IncludedVerificationsThresholdReachedEventData, av as LevelTarget, aw as LiftBlockInput, ax as ListBlocksQuery, ay as ListPeopleQuery, az as ListScreeningListEntriesQuery, aA as ListScreeningsQuery, aB as ListSessionsQuery, aC as ListSignalsQuery, L as Locale, aD as MatchReason, aE as MediaBytes, aF as MediaBytesOptions, aG as MediaItem, aH as MediaKind, aI as MediaList, aJ as NameForm, aK as OverridableServiceId, aL as Page, aM as PeopleApi, aN as Person, aO as PersonAddressInput, aP as PersonBirthPlaceInput, aQ as PersonDeletedEventData, aR as PersonDocumentInput, aS as PersonEnrolledEventData, aT as PersonRef, aU as PersonSession, aV as PersonSessionInput, aW as PersonSessionTarget, aX as PersonUpdatedEventData, aY as PoaDocumentKind, aZ as PoaReason, a_ as PoaRule, a$ as PoaRuleKind, b0 as PoaRules, b1 as PortraitReportEntry, b2 as PriorReviewReason, b3 as ProbeBindingReason, b4 as ProbeQuality, b5 as ProfileDocumentType, b6 as ReadinessProtection, b7 as ReadinessReport, b8 as RequestOptions, b9 as ResultTokenResponse, ba as ReviewOutcomeReason, bb as RevokePersonInput, bc as SandboxSimulatedReason, bd as SandboxSimulation, be as ScreenPersonInput, bf as Screening, bg as ScreeningHit, bh as ScreeningHitSummary, bi as ScreeningList, bj as ScreeningListEntriesApi, bk as ScreeningListStrictness, bl as ScreeningListsApi, bm as ScreeningStatus, bn as ScreeningTrigger, bo as ScreeningUnavailableReason, a as Sekyro, bp as SekyroOptions, bq as SekyroTestApi, br as Session, bs as SessionClosedEventDataBase, bt as SessionDecidingStep, bu as SessionDevice, bv as SessionEventDataBase, bw as SessionEventStep, bx as SessionFailureReason, by as SessionFlowRef, bz as SessionHandoff, bA as SessionHandoffDevice, bB as SessionLifecycleEventData, bC as SessionLinkDelivery, bD as SessionLinkExpiry, bE as SessionLinkInput, bF as SessionNetwork, bG as SessionNetworkEvent, bH as SessionNotVerifiedEventData, S as SessionReason, bI as SessionRetakeRequestedEventData, bJ as SessionReviewPendingEventData, bK as SessionScreening, bL as SessionStatus, bM as SessionStep, bN as SessionStepAttempts, bO as SessionStepBand, bP as SessionStepDecision, bQ as SessionStepDocument, bR as SessionStepPortrait, bS as SessionTestApi, bT as SessionVerifiedEventData, bU as SessionsApi, bV as Signal, bW as SignalEventData, bX as SignalEvidence, bY as SignalGrade, bZ as SignalKeyKind, b_ as SignalKind, b$ as SignalSeverity, c0 as SignalStatus, c1 as SignalsApi, c2 as SimulateSessionInput, c3 as StepResult, c4 as SubjectAssurance, c5 as SubjectIdNumber, c6 as SubjectName, c7 as SubjectReferenceSource, c8 as SubjectReuseTarget, c9 as SubjectStatus, ca as UpdateScreeningListInput, cb as UpdateSignalInput, cc as UsageLimitReachedEventData, cd as UsageThresholdReachedEventData, ce as VerifiedContacts, cf as WebhookEnvelopeOf, cg as WebhookEventDataMap, W as WebhookEventType, ch as WebhookTestInput, ci as WebhookTestResult, cj as WebhooksApi } from './client-B4wM-_Xp.cjs';
3
3
 
4
4
  /** Why {@link verifyWebhook} rejected a delivery. @public */
5
5
  type SekyroWebhookErrorCode = "invalid_signature" | "stale" | "malformed";