@sekyro/node 1.0.0-rc.29 → 1.0.0-rc.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +29 -6
- package/dist/{client-B4wM-_Xp.d.cts → client-B785k5Kg.d.cts} +160 -7
- package/dist/{client-B4wM-_Xp.d.ts → client-B785k5Kg.d.ts} +160 -7
- package/dist/connect/express/index.d.cts +2 -2
- package/dist/connect/express/index.d.ts +2 -2
- package/dist/connect/index.d.cts +2 -2
- package/dist/connect/index.d.ts +2 -2
- package/dist/connect/next/index.d.cts +2 -2
- package/dist/connect/next/index.d.ts +2 -2
- package/dist/{connector-CI50FjGZ.d.cts → connector-CyY0w62i.d.cts} +1 -1
- package/dist/{connector-CR2FHfxc.d.ts → connector-DTcbZzAM.d.ts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/sbom.cdx.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @sekyro/node
|
|
2
2
|
|
|
3
|
+
## 1.0.0-rc.31
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3928b2a: `identity.names[].form` can be `barcode`, for a name read from a document's barcode. `identity.document.issuePlace` is new: where the document was issued, as written, one entry per script.
|
|
8
|
+
- 9f106d5: `IdentityDocument` has `evidence`: what the identity was read from (`mrz`, `barcode`, `visual`, or `chip` once the chip's signature was verified). The API already returned it. `personFromNationalRegistry()` returns every birth place of a registry answer, one entry per script (`[{ script, value }]`), so the Arabic one is kept beside the Latin one.
|
|
9
|
+
|
|
10
|
+
## 1.0.0-rc.30
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 4654c5d: Decide sessions in review from your own review tool. `sekyro.reviews.list()` (with `listPage` and `iterate`) lists the sessions waiting on a decision, oldest first, and `sekyro.sessions.review(id, { outcome, reasons, reviewerRef }, { idempotencyKey })` decides one: `pass`, `fail` or `retake`. They need a key with the `reviews:read` and `reviews:decide` scopes. A step's `decision` now carries `via` (`dashboard`, `api` or `sekyro`) and, for an API decision, `reviewerRef`. New types: `ReviewQueueItem`, `ReviewQueueCheck`, `ReviewDecisionInput`, `ReviewOutcome`, `RetakeHint`, `ReviewVia`, `ListReviewsQuery`.
|
|
15
|
+
|
|
3
16
|
## 1.0.0-rc.29
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -295,9 +295,10 @@ See the [Sandbox guide](https://docs.sekyro.ai/en/getting-started/sandbox) and
|
|
|
295
295
|
### Identity data and media
|
|
296
296
|
|
|
297
297
|
`session.identity` holds what the session read, with the source of every value:
|
|
298
|
-
one `names[]` entry per source and
|
|
299
|
-
`registry`, `eid` or `supplied`), `birthDate`,
|
|
300
|
-
`
|
|
298
|
+
one `names[]` entry per source, script and form (`form`: `mrz`, `printed`,
|
|
299
|
+
`barcode`, `chip`, `registry`, `eid` or `supplied`), `birthDate`,
|
|
300
|
+
`birthPlace[]`, `sex`, `nationalities`, `idNumber`, `document` (with
|
|
301
|
+
`evidence`, what the identity was read from), `address` and `proofOfAddress` (after
|
|
301
302
|
a passed proof of address step) and `sources` (which sources agree on each
|
|
302
303
|
value). It is present once an identity step settled, whatever the status,
|
|
303
304
|
and it rides on `session.verified` and `session.not_verified` when that is
|
|
@@ -369,7 +370,7 @@ created.subjectUse; // "reference" when the flow has a Partner-supplied identity
|
|
|
369
370
|
The first argument is the registry's country (ISO alpha-2) and types the
|
|
370
371
|
answer: `"MR"` takes the ANRPTS `getPersonne` answer
|
|
371
372
|
(`AnrptsPersonneResponse`). The result is a `PersonRecord`: `idNumber`,
|
|
372
|
-
`names` (one entry per script found), `birthDate`, `
|
|
373
|
+
`names` and `birthPlace` (one entry per script found), `birthDate`, `sex`,
|
|
373
374
|
`nationalities` (`[code]`, alpha-2), `photo`, `photoDate` and `fetchedAt`. A
|
|
374
375
|
record without a number, a birth date, a photo or any name, or with an invalid `fetchedAt`,
|
|
375
376
|
throws `SekyroConfigError` `invalid_registry_record` naming the field (never
|
|
@@ -652,7 +653,7 @@ When a person decides a step, the step carries `decision`
|
|
|
652
653
|
(`SessionStepDecision`) on `sekyro.sessions.get` and on the `steps` of the
|
|
653
654
|
`session.*` webhooks, and `session.verified` / `session.not_verified` carry it at the
|
|
654
655
|
top level with `closedBy: 'reviewer'`:
|
|
655
|
-
`{ source, mode, votes, agreement?, reasons, decidedAt, sessionId? }`.
|
|
656
|
+
`{ source, mode, votes, agreement?, reasons, decidedAt, sessionId?, via?, reviewerRef? }`.
|
|
656
657
|
`source` is `review` (a reviewer) or `prior_review` (an earlier approval of the
|
|
657
658
|
same person, reference photo and face was reused; `sessionId` names your
|
|
658
659
|
earlier session). Only approvals are reused: after an earlier rejection, the new
|
|
@@ -660,7 +661,29 @@ session goes through the checks and, when it needs one, to review again. `mode`
|
|
|
660
661
|
formed it and `agreement` says whether two dual reviewers agreed. `reasons`
|
|
661
662
|
(`ReviewReason[]`: `document_authenticity`, `liveness`, `face_match`,
|
|
662
663
|
`data_mismatch`, `screening`, `org_rule`, `other`) says what failed on a rejection, or what was
|
|
663
|
-
overridden on an approval.
|
|
664
|
+
overridden on an approval. `via` says how the deciding decision came in:
|
|
665
|
+
`dashboard`, `api` or `sekyro` (the Sekyro AI review service). An `api` decision
|
|
666
|
+
also carries the `reviewerRef` your system sent. The object never names a
|
|
667
|
+
member of your team or a vote.
|
|
668
|
+
|
|
669
|
+
Your own review tool can decide instead of the dashboard, with a key that has
|
|
670
|
+
the `reviews:read` and `reviews:decide` scopes:
|
|
671
|
+
|
|
672
|
+
```ts
|
|
673
|
+
for await (const r of sekyro.reviews.iterate()) {
|
|
674
|
+
const session = await sekyro.sessions.get(r.sessionId);
|
|
675
|
+
// ...your reviewer looks at the session and its media...
|
|
676
|
+
await sekyro.sessions.review(
|
|
677
|
+
r.sessionId,
|
|
678
|
+
{ outcome: "pass", reasons: ["liveness"], reviewerRef: "<your reviewer id>" },
|
|
679
|
+
{ idempotencyKey: "<one key per decision>" },
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
`reviewerRef` is your id for the person who decided, never an email address or a
|
|
685
|
+
phone number. With two reviewers, two decisions count as two only with two
|
|
686
|
+
different `reviewerRef` values.
|
|
664
687
|
|
|
665
688
|
A review that reaches its deadline ends with `session.not_verified`, `reason:
|
|
666
689
|
'inconclusive'`, `closedBy: 'deadline'` and `reasonCode: 'review_timeout'`, or
|
|
@@ -439,6 +439,112 @@ interface SessionStepDecision {
|
|
|
439
439
|
decidedAt: string;
|
|
440
440
|
/** `prior_review` only: your earlier session whose review decided this one. */
|
|
441
441
|
sessionId?: string;
|
|
442
|
+
/** How the deciding decision came in ({@link ReviewVia}). */
|
|
443
|
+
via?: ReviewVia;
|
|
444
|
+
/** `via: "api"` only: the `reviewerRef` your system sent with the decision. */
|
|
445
|
+
reviewerRef?: string;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* How a review decision came in: `dashboard` (your team in the dashboard),
|
|
449
|
+
* `api` (your system, with {@link SessionsApi.review}) or `sekyro` (the Sekyro
|
|
450
|
+
* AI review service).
|
|
451
|
+
* @public
|
|
452
|
+
*/
|
|
453
|
+
type ReviewVia = "dashboard" | "api" | "sekyro";
|
|
454
|
+
/**
|
|
455
|
+
* A review decision: `pass` and `fail` decide the check in review, `retake`
|
|
456
|
+
* sends the step back to the person for a new capture.
|
|
457
|
+
* @public
|
|
458
|
+
*/
|
|
459
|
+
type ReviewOutcome = "pass" | "fail" | "retake";
|
|
460
|
+
/**
|
|
461
|
+
* What a retake may name besides a {@link ReviewReason}: the capture hint
|
|
462
|
+
* shown to the person on the new try.
|
|
463
|
+
* @public
|
|
464
|
+
*/
|
|
465
|
+
type RetakeHint = "appearance" | "motion" | "lighting" | "framing";
|
|
466
|
+
/**
|
|
467
|
+
* The body of {@link SessionsApi.review}. `reasons`: on a fail, what failed; on
|
|
468
|
+
* a pass, the check you override (it must be in review); a retake may also
|
|
469
|
+
* name a {@link RetakeHint}. `other` alone needs `reasonText`.
|
|
470
|
+
* @public
|
|
471
|
+
*/
|
|
472
|
+
type ReviewDecisionInput = {
|
|
473
|
+
outcome: "pass" | "fail";
|
|
474
|
+
reasons: readonly ReviewReason[];
|
|
475
|
+
reasonText?: string;
|
|
476
|
+
/** The {@link ReviewQueueCheck.checkIndex} you decide. Leave it out for the check in review now. */
|
|
477
|
+
checkIndex?: number;
|
|
478
|
+
/**
|
|
479
|
+
* Your own id for the person who decided: 1 to 128 letters, digits, `.`,
|
|
480
|
+
* `_`, `:` or `-`. Never an email address or a phone number
|
|
481
|
+
* (`400 reviewer_ref_invalid`). Two decisions with the same value are one
|
|
482
|
+
* reviewer in two-reviewer mode.
|
|
483
|
+
*/
|
|
484
|
+
reviewerRef: string;
|
|
485
|
+
} | {
|
|
486
|
+
outcome: "retake";
|
|
487
|
+
reasons: ReadonlyArray<ReviewReason | RetakeHint>;
|
|
488
|
+
reasonText?: string;
|
|
489
|
+
checkIndex?: number;
|
|
490
|
+
reviewerRef: string;
|
|
491
|
+
};
|
|
492
|
+
/**
|
|
493
|
+
* A check of a {@link ReviewQueueItem} that waits on a person.
|
|
494
|
+
* @public
|
|
495
|
+
*/
|
|
496
|
+
interface ReviewQueueCheck {
|
|
497
|
+
/** Send it as {@link ReviewDecisionInput} `checkIndex`. */
|
|
498
|
+
checkIndex: number;
|
|
499
|
+
/** The step id, as in {@link SessionStep.id}. */
|
|
500
|
+
step?: string;
|
|
501
|
+
/** The service of the step, as in {@link SessionStep.service}. */
|
|
502
|
+
check?: string;
|
|
503
|
+
/** Liveness and face match: the band the score was decided on. */
|
|
504
|
+
band?: {
|
|
505
|
+
failBelow: number;
|
|
506
|
+
passAtOrAbove: number;
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* A session waiting on a review decision, from {@link ReviewsApi.list}. Ids,
|
|
511
|
+
* times and counts only: read the evidence with {@link SessionsApi.get} and
|
|
512
|
+
* {@link SessionsApi.media}.
|
|
513
|
+
* @public
|
|
514
|
+
*/
|
|
515
|
+
interface ReviewQueueItem {
|
|
516
|
+
sessionId: string;
|
|
517
|
+
/** ISO 8601. */
|
|
518
|
+
createdAt: string;
|
|
519
|
+
/** ISO 8601: when the session went to review. */
|
|
520
|
+
reviewPendingAt: string;
|
|
521
|
+
/** ISO 8601: when the review deadline rejects it if nobody decides. */
|
|
522
|
+
deadlineAt: string;
|
|
523
|
+
/** How many reviewers must decide (your review setting). */
|
|
524
|
+
reviewersRequired: 1 | 2;
|
|
525
|
+
/** Two reviewers only: the decisions already in, oldest first, without their outcome (the next reviewer decides blind). */
|
|
526
|
+
decisions: Array<{
|
|
527
|
+
via: ReviewVia;
|
|
528
|
+
decidedAt: string;
|
|
529
|
+
}>;
|
|
530
|
+
/** `held` while a reviewer in the dashboard has the review open, `until` when that ends. */
|
|
531
|
+
lock: {
|
|
532
|
+
held: boolean;
|
|
533
|
+
until?: string;
|
|
534
|
+
};
|
|
535
|
+
/** The checks in review. */
|
|
536
|
+
checks: ReviewQueueCheck[];
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Paging of {@link ReviewsApi.list}, {@link ReviewsApi.listPage} and
|
|
540
|
+
* {@link ReviewsApi.iterate}. Oldest review first.
|
|
541
|
+
* @public
|
|
542
|
+
*/
|
|
543
|
+
interface ListReviewsQuery {
|
|
544
|
+
/** Page size, 1 to 100 (the API's default is 50). */
|
|
545
|
+
limit?: number;
|
|
546
|
+
/** The {@link Page.nextCursor} of the previous page. */
|
|
547
|
+
cursor?: string;
|
|
442
548
|
}
|
|
443
549
|
/**
|
|
444
550
|
* A failure identification match (terminal sessions, when the flow's
|
|
@@ -1684,11 +1790,12 @@ type IdentitySource = "document" | "chip" | "registry" | "eid" | "supplied";
|
|
|
1684
1790
|
/**
|
|
1685
1791
|
* How a name of {@link Identity.names} was obtained: `mrz` (the ICAO
|
|
1686
1792
|
* transliteration of the machine readable zone: upper case, truncated, no
|
|
1687
|
-
* diacritics), `printed` (the visual zone, as written), `
|
|
1688
|
-
* data groups), `registry`, `eid` or
|
|
1793
|
+
* diacritics), `printed` (the visual zone, as written), `barcode` (the
|
|
1794
|
+
* document's barcode), `chip` (the chip's data groups), `registry`, `eid` or
|
|
1795
|
+
* `supplied`.
|
|
1689
1796
|
* @public
|
|
1690
1797
|
*/
|
|
1691
|
-
type NameForm = "mrz" | "printed" | "chip" | "registry" | "eid" | "supplied";
|
|
1798
|
+
type NameForm = "mrz" | "printed" | "barcode" | "chip" | "registry" | "eid" | "supplied";
|
|
1692
1799
|
/**
|
|
1693
1800
|
* One name as one source gives it. Names from different sources are never
|
|
1694
1801
|
* merged. For an `mrz` entry `family` holds the ICAO primary identifier and
|
|
@@ -1736,12 +1843,23 @@ interface IdentityDocument {
|
|
|
1736
1843
|
number?: string;
|
|
1737
1844
|
/** `YYYY-MM-DD`. */
|
|
1738
1845
|
expiryDate?: string;
|
|
1739
|
-
/** `YYYY-MM-DD`, from the chip. */
|
|
1846
|
+
/** `YYYY-MM-DD`, from the chip, the barcode or the printed text. */
|
|
1740
1847
|
issueDate?: string;
|
|
1741
|
-
/**
|
|
1848
|
+
/** Where the document was issued, as written, one entry per script (ISO 15924). */
|
|
1849
|
+
issuePlace?: Array<{
|
|
1850
|
+
script: string;
|
|
1851
|
+
value: string;
|
|
1852
|
+
}>;
|
|
1853
|
+
/** The issuing authority, from the chip or as the document series prints it. */
|
|
1742
1854
|
issuingAuthority?: string;
|
|
1743
|
-
/** The keys whose value a check digit protects. Never the names. */
|
|
1855
|
+
/** The keys whose value a check digit protects. Never the names: no check digit covers a name. */
|
|
1744
1856
|
mrzVerified?: Array<"number" | "birthDate" | "expiryDate" | "idNumber">;
|
|
1857
|
+
/**
|
|
1858
|
+
* What the identity was read from: `mrz` (the machine readable zone),
|
|
1859
|
+
* `barcode`, `visual` (the printed text alone), or `chip` once the chip's
|
|
1860
|
+
* signature was verified against its issuer's certificate.
|
|
1861
|
+
*/
|
|
1862
|
+
evidence?: "mrz" | "barcode" | "visual" | "chip";
|
|
1745
1863
|
}
|
|
1746
1864
|
/** The address an identity carries ({@link Identity.address}). @public */
|
|
1747
1865
|
interface IdentityAddress {
|
|
@@ -3120,6 +3238,20 @@ declare class SessionsApi {
|
|
|
3120
3238
|
* ended (a repeated cancel included). Needs the `sessions:create` scope.
|
|
3121
3239
|
*/
|
|
3122
3240
|
cancel(id: string, opts?: RequestOptions): Promise<Session>;
|
|
3241
|
+
/**
|
|
3242
|
+
* `POST /sessions/:id/review`: decide a session in review from your own
|
|
3243
|
+
* review tool, as a reviewer in the dashboard would: `pass`, `fail` or
|
|
3244
|
+
* `retake`, with the reasons and the `reviewerRef` of the person who decided.
|
|
3245
|
+
* Two-reviewer mode, the deadline, the webhooks and the result token behave
|
|
3246
|
+
* as for a dashboard decision. Returns the session. Needs the
|
|
3247
|
+
* `reviews:decide` scope. `409 review_locked` while a reviewer in the
|
|
3248
|
+
* dashboard has it open (`details.lockedUntil`), `409 reviewer_already_decided`
|
|
3249
|
+
* when this `reviewerRef` already decided it, `409 review_by_sekyro` when
|
|
3250
|
+
* Sekyro AI reviews your Live sessions. The API requires an idempotency key:
|
|
3251
|
+
* one is generated when you pass none, so pass your own to make a retry of
|
|
3252
|
+
* the same decision safe.
|
|
3253
|
+
*/
|
|
3254
|
+
review(id: string, input: ReviewDecisionInput, opts?: RequestOptions): Promise<Session>;
|
|
3123
3255
|
/**
|
|
3124
3256
|
* `POST /sessions/:id/link/resend` — send the hosted link again through the
|
|
3125
3257
|
* session's own `deliver` channel, to the same destination (neither can be
|
|
@@ -3423,6 +3555,25 @@ declare class ScreeningListsApi {
|
|
|
3423
3555
|
/** `DELETE /screening-lists/:id`: deletes the list and all its entries. */
|
|
3424
3556
|
delete(id: string): Promise<DeletedScreeningListItem>;
|
|
3425
3557
|
}
|
|
3558
|
+
/**
|
|
3559
|
+
* The sessions waiting on a review decision ({@link ReviewQueueItem}), for your
|
|
3560
|
+
* own review tool. Exposed as {@link Sekyro.reviews}. Needs the `reviews:read`
|
|
3561
|
+
* scope; decide one with {@link SessionsApi.review}. Exported as a TYPE only.
|
|
3562
|
+
* @public
|
|
3563
|
+
*/
|
|
3564
|
+
declare class ReviewsApi {
|
|
3565
|
+
private readonly t;
|
|
3566
|
+
/** @internal */
|
|
3567
|
+
constructor(t: {
|
|
3568
|
+
page<T>(path: string): Promise<Page<T>>;
|
|
3569
|
+
});
|
|
3570
|
+
/** The first page of the sessions in review (`GET /reviews`), oldest first. Every page: {@link ReviewsApi.iterate}. */
|
|
3571
|
+
list(query?: ListReviewsQuery): Promise<ReviewQueueItem[]>;
|
|
3572
|
+
/** One page of {@link ReviewsApi.list} with its `nextCursor` (absent on the last page). */
|
|
3573
|
+
listPage(query?: ListReviewsQuery): Promise<Page<ReviewQueueItem>>;
|
|
3574
|
+
/** Every session in review, oldest first, following `nextCursor` page after page. */
|
|
3575
|
+
iterate(query?: ListReviewsQuery): AsyncGenerator<ReviewQueueItem, void, undefined>;
|
|
3576
|
+
}
|
|
3426
3577
|
/**
|
|
3427
3578
|
* What you know about a device before you block it. Exposed as {@link Sekyro.devices}. Needs the
|
|
3428
3579
|
* `blocks:read` or `blocks:write` scope. Exported as a TYPE only.
|
|
@@ -3518,6 +3669,8 @@ declare class Sekyro {
|
|
|
3518
3669
|
readonly blocks: BlocksApi;
|
|
3519
3670
|
readonly signals: SignalsApi;
|
|
3520
3671
|
readonly screeningLists: ScreeningListsApi;
|
|
3672
|
+
/** The sessions in review: {@link ReviewsApi}. */
|
|
3673
|
+
readonly reviews: ReviewsApi;
|
|
3521
3674
|
readonly devices: DevicesApi;
|
|
3522
3675
|
readonly flows: FlowsApi;
|
|
3523
3676
|
readonly webhooks: WebhooksApi;
|
|
@@ -3540,4 +3693,4 @@ declare class Sekyro {
|
|
|
3540
3693
|
readiness(): Promise<ReadinessReport>;
|
|
3541
3694
|
}
|
|
3542
3695
|
|
|
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
|
|
3696
|
+
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 PoaRule 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 ListScreeningListEntriesQuery as aA, type ListScreeningsQuery as aB, type ListSessionsQuery as aC, type ListSignalsQuery as aD, type MatchReason as aE, type MediaBytes as aF, type MediaBytesOptions as aG, type MediaItem as aH, type MediaKind as aI, type MediaList as aJ, type NameForm as aK, type OverridableServiceId as aL, type Page as aM, PeopleApi as aN, type Person as aO, type PersonAddressInput as aP, type PersonBirthPlaceInput as aQ, type PersonDeletedEventData as aR, type PersonDocumentInput as aS, type PersonEnrolledEventData as aT, type PersonRef as aU, type PersonSession as aV, type PersonSessionInput as aW, type PersonSessionTarget as aX, type PersonUpdatedEventData as aY, type PoaDocumentKind as aZ, type PoaReason 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 ListReviewsQuery as az, type ServiceId as b, type SessionVerifiedEventData as b$, type PoaRuleKind as b0, type PoaRules as b1, type PortraitReportEntry as b2, type PriorReviewReason as b3, type ProbeBindingReason as b4, type ProbeQuality as b5, type ProfileDocumentType as b6, type ReadinessProtection as b7, type ReadinessReport as b8, type RequestOptions as b9, type SessionClosedEventDataBase as bA, type SessionDecidingStep as bB, type SessionDevice as bC, type SessionEventDataBase as bD, type SessionEventStep as bE, type SessionFailureReason as bF, type SessionFlowRef as bG, type SessionHandoff as bH, type SessionHandoffDevice as bI, type SessionLifecycleEventData as bJ, type SessionLinkDelivery as bK, type SessionLinkExpiry as bL, type SessionLinkInput as bM, type SessionNetwork as bN, type SessionNetworkEvent as bO, type SessionNotVerifiedEventData as bP, type SessionRetakeRequestedEventData as bQ, type SessionReviewPendingEventData as bR, type SessionScreening as bS, type SessionStatus as bT, type SessionStep as bU, type SessionStepAttempts as bV, type SessionStepBand as bW, type SessionStepDecision as bX, type SessionStepDocument as bY, type SessionStepPortrait as bZ, SessionTestApi as b_, type ResultTokenResponse as ba, type RetakeHint as bb, type ReviewDecisionInput as bc, type ReviewOutcome as bd, type ReviewOutcomeReason as be, type ReviewQueueCheck as bf, type ReviewQueueItem as bg, type ReviewVia as bh, ReviewsApi as bi, type RevokePersonInput as bj, type SandboxSimulatedReason as bk, type SandboxSimulation as bl, type ScreenPersonInput as bm, type Screening as bn, type ScreeningHit as bo, type ScreeningHitSummary as bp, type ScreeningList as bq, ScreeningListEntriesApi as br, type ScreeningListStrictness as bs, ScreeningListsApi as bt, type ScreeningStatus as bu, type ScreeningTrigger as bv, type ScreeningUnavailableReason as bw, type SekyroOptions as bx, SekyroTestApi as by, type Session as bz, type SessionPersonInput as c, SessionsApi as c0, type Signal as c1, type SignalEventData as c2, type SignalEvidence as c3, type SignalGrade as c4, type SignalKeyKind as c5, type SignalKind as c6, type SignalSeverity as c7, type SignalStatus as c8, SignalsApi as c9, type SimulateSessionInput as ca, type StepResult as cb, type SubjectAssurance as cc, type SubjectIdNumber as cd, type SubjectName as ce, type SubjectReferenceSource as cf, type SubjectReuseTarget as cg, type SubjectStatus as ch, type UpdateScreeningListInput as ci, type UpdateSignalInput as cj, type UsageLimitReachedEventData as ck, type UsageThresholdReachedEventData as cl, type VerifiedContacts as cm, type WebhookEnvelopeOf as cn, type WebhookEventDataMap as co, type WebhookTestInput as cp, type WebhookTestResult as cq, WebhooksApi as cr, 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 };
|
|
@@ -439,6 +439,112 @@ interface SessionStepDecision {
|
|
|
439
439
|
decidedAt: string;
|
|
440
440
|
/** `prior_review` only: your earlier session whose review decided this one. */
|
|
441
441
|
sessionId?: string;
|
|
442
|
+
/** How the deciding decision came in ({@link ReviewVia}). */
|
|
443
|
+
via?: ReviewVia;
|
|
444
|
+
/** `via: "api"` only: the `reviewerRef` your system sent with the decision. */
|
|
445
|
+
reviewerRef?: string;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* How a review decision came in: `dashboard` (your team in the dashboard),
|
|
449
|
+
* `api` (your system, with {@link SessionsApi.review}) or `sekyro` (the Sekyro
|
|
450
|
+
* AI review service).
|
|
451
|
+
* @public
|
|
452
|
+
*/
|
|
453
|
+
type ReviewVia = "dashboard" | "api" | "sekyro";
|
|
454
|
+
/**
|
|
455
|
+
* A review decision: `pass` and `fail` decide the check in review, `retake`
|
|
456
|
+
* sends the step back to the person for a new capture.
|
|
457
|
+
* @public
|
|
458
|
+
*/
|
|
459
|
+
type ReviewOutcome = "pass" | "fail" | "retake";
|
|
460
|
+
/**
|
|
461
|
+
* What a retake may name besides a {@link ReviewReason}: the capture hint
|
|
462
|
+
* shown to the person on the new try.
|
|
463
|
+
* @public
|
|
464
|
+
*/
|
|
465
|
+
type RetakeHint = "appearance" | "motion" | "lighting" | "framing";
|
|
466
|
+
/**
|
|
467
|
+
* The body of {@link SessionsApi.review}. `reasons`: on a fail, what failed; on
|
|
468
|
+
* a pass, the check you override (it must be in review); a retake may also
|
|
469
|
+
* name a {@link RetakeHint}. `other` alone needs `reasonText`.
|
|
470
|
+
* @public
|
|
471
|
+
*/
|
|
472
|
+
type ReviewDecisionInput = {
|
|
473
|
+
outcome: "pass" | "fail";
|
|
474
|
+
reasons: readonly ReviewReason[];
|
|
475
|
+
reasonText?: string;
|
|
476
|
+
/** The {@link ReviewQueueCheck.checkIndex} you decide. Leave it out for the check in review now. */
|
|
477
|
+
checkIndex?: number;
|
|
478
|
+
/**
|
|
479
|
+
* Your own id for the person who decided: 1 to 128 letters, digits, `.`,
|
|
480
|
+
* `_`, `:` or `-`. Never an email address or a phone number
|
|
481
|
+
* (`400 reviewer_ref_invalid`). Two decisions with the same value are one
|
|
482
|
+
* reviewer in two-reviewer mode.
|
|
483
|
+
*/
|
|
484
|
+
reviewerRef: string;
|
|
485
|
+
} | {
|
|
486
|
+
outcome: "retake";
|
|
487
|
+
reasons: ReadonlyArray<ReviewReason | RetakeHint>;
|
|
488
|
+
reasonText?: string;
|
|
489
|
+
checkIndex?: number;
|
|
490
|
+
reviewerRef: string;
|
|
491
|
+
};
|
|
492
|
+
/**
|
|
493
|
+
* A check of a {@link ReviewQueueItem} that waits on a person.
|
|
494
|
+
* @public
|
|
495
|
+
*/
|
|
496
|
+
interface ReviewQueueCheck {
|
|
497
|
+
/** Send it as {@link ReviewDecisionInput} `checkIndex`. */
|
|
498
|
+
checkIndex: number;
|
|
499
|
+
/** The step id, as in {@link SessionStep.id}. */
|
|
500
|
+
step?: string;
|
|
501
|
+
/** The service of the step, as in {@link SessionStep.service}. */
|
|
502
|
+
check?: string;
|
|
503
|
+
/** Liveness and face match: the band the score was decided on. */
|
|
504
|
+
band?: {
|
|
505
|
+
failBelow: number;
|
|
506
|
+
passAtOrAbove: number;
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* A session waiting on a review decision, from {@link ReviewsApi.list}. Ids,
|
|
511
|
+
* times and counts only: read the evidence with {@link SessionsApi.get} and
|
|
512
|
+
* {@link SessionsApi.media}.
|
|
513
|
+
* @public
|
|
514
|
+
*/
|
|
515
|
+
interface ReviewQueueItem {
|
|
516
|
+
sessionId: string;
|
|
517
|
+
/** ISO 8601. */
|
|
518
|
+
createdAt: string;
|
|
519
|
+
/** ISO 8601: when the session went to review. */
|
|
520
|
+
reviewPendingAt: string;
|
|
521
|
+
/** ISO 8601: when the review deadline rejects it if nobody decides. */
|
|
522
|
+
deadlineAt: string;
|
|
523
|
+
/** How many reviewers must decide (your review setting). */
|
|
524
|
+
reviewersRequired: 1 | 2;
|
|
525
|
+
/** Two reviewers only: the decisions already in, oldest first, without their outcome (the next reviewer decides blind). */
|
|
526
|
+
decisions: Array<{
|
|
527
|
+
via: ReviewVia;
|
|
528
|
+
decidedAt: string;
|
|
529
|
+
}>;
|
|
530
|
+
/** `held` while a reviewer in the dashboard has the review open, `until` when that ends. */
|
|
531
|
+
lock: {
|
|
532
|
+
held: boolean;
|
|
533
|
+
until?: string;
|
|
534
|
+
};
|
|
535
|
+
/** The checks in review. */
|
|
536
|
+
checks: ReviewQueueCheck[];
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Paging of {@link ReviewsApi.list}, {@link ReviewsApi.listPage} and
|
|
540
|
+
* {@link ReviewsApi.iterate}. Oldest review first.
|
|
541
|
+
* @public
|
|
542
|
+
*/
|
|
543
|
+
interface ListReviewsQuery {
|
|
544
|
+
/** Page size, 1 to 100 (the API's default is 50). */
|
|
545
|
+
limit?: number;
|
|
546
|
+
/** The {@link Page.nextCursor} of the previous page. */
|
|
547
|
+
cursor?: string;
|
|
442
548
|
}
|
|
443
549
|
/**
|
|
444
550
|
* A failure identification match (terminal sessions, when the flow's
|
|
@@ -1684,11 +1790,12 @@ type IdentitySource = "document" | "chip" | "registry" | "eid" | "supplied";
|
|
|
1684
1790
|
/**
|
|
1685
1791
|
* How a name of {@link Identity.names} was obtained: `mrz` (the ICAO
|
|
1686
1792
|
* transliteration of the machine readable zone: upper case, truncated, no
|
|
1687
|
-
* diacritics), `printed` (the visual zone, as written), `
|
|
1688
|
-
* data groups), `registry`, `eid` or
|
|
1793
|
+
* diacritics), `printed` (the visual zone, as written), `barcode` (the
|
|
1794
|
+
* document's barcode), `chip` (the chip's data groups), `registry`, `eid` or
|
|
1795
|
+
* `supplied`.
|
|
1689
1796
|
* @public
|
|
1690
1797
|
*/
|
|
1691
|
-
type NameForm = "mrz" | "printed" | "chip" | "registry" | "eid" | "supplied";
|
|
1798
|
+
type NameForm = "mrz" | "printed" | "barcode" | "chip" | "registry" | "eid" | "supplied";
|
|
1692
1799
|
/**
|
|
1693
1800
|
* One name as one source gives it. Names from different sources are never
|
|
1694
1801
|
* merged. For an `mrz` entry `family` holds the ICAO primary identifier and
|
|
@@ -1736,12 +1843,23 @@ interface IdentityDocument {
|
|
|
1736
1843
|
number?: string;
|
|
1737
1844
|
/** `YYYY-MM-DD`. */
|
|
1738
1845
|
expiryDate?: string;
|
|
1739
|
-
/** `YYYY-MM-DD`, from the chip. */
|
|
1846
|
+
/** `YYYY-MM-DD`, from the chip, the barcode or the printed text. */
|
|
1740
1847
|
issueDate?: string;
|
|
1741
|
-
/**
|
|
1848
|
+
/** Where the document was issued, as written, one entry per script (ISO 15924). */
|
|
1849
|
+
issuePlace?: Array<{
|
|
1850
|
+
script: string;
|
|
1851
|
+
value: string;
|
|
1852
|
+
}>;
|
|
1853
|
+
/** The issuing authority, from the chip or as the document series prints it. */
|
|
1742
1854
|
issuingAuthority?: string;
|
|
1743
|
-
/** The keys whose value a check digit protects. Never the names. */
|
|
1855
|
+
/** The keys whose value a check digit protects. Never the names: no check digit covers a name. */
|
|
1744
1856
|
mrzVerified?: Array<"number" | "birthDate" | "expiryDate" | "idNumber">;
|
|
1857
|
+
/**
|
|
1858
|
+
* What the identity was read from: `mrz` (the machine readable zone),
|
|
1859
|
+
* `barcode`, `visual` (the printed text alone), or `chip` once the chip's
|
|
1860
|
+
* signature was verified against its issuer's certificate.
|
|
1861
|
+
*/
|
|
1862
|
+
evidence?: "mrz" | "barcode" | "visual" | "chip";
|
|
1745
1863
|
}
|
|
1746
1864
|
/** The address an identity carries ({@link Identity.address}). @public */
|
|
1747
1865
|
interface IdentityAddress {
|
|
@@ -3120,6 +3238,20 @@ declare class SessionsApi {
|
|
|
3120
3238
|
* ended (a repeated cancel included). Needs the `sessions:create` scope.
|
|
3121
3239
|
*/
|
|
3122
3240
|
cancel(id: string, opts?: RequestOptions): Promise<Session>;
|
|
3241
|
+
/**
|
|
3242
|
+
* `POST /sessions/:id/review`: decide a session in review from your own
|
|
3243
|
+
* review tool, as a reviewer in the dashboard would: `pass`, `fail` or
|
|
3244
|
+
* `retake`, with the reasons and the `reviewerRef` of the person who decided.
|
|
3245
|
+
* Two-reviewer mode, the deadline, the webhooks and the result token behave
|
|
3246
|
+
* as for a dashboard decision. Returns the session. Needs the
|
|
3247
|
+
* `reviews:decide` scope. `409 review_locked` while a reviewer in the
|
|
3248
|
+
* dashboard has it open (`details.lockedUntil`), `409 reviewer_already_decided`
|
|
3249
|
+
* when this `reviewerRef` already decided it, `409 review_by_sekyro` when
|
|
3250
|
+
* Sekyro AI reviews your Live sessions. The API requires an idempotency key:
|
|
3251
|
+
* one is generated when you pass none, so pass your own to make a retry of
|
|
3252
|
+
* the same decision safe.
|
|
3253
|
+
*/
|
|
3254
|
+
review(id: string, input: ReviewDecisionInput, opts?: RequestOptions): Promise<Session>;
|
|
3123
3255
|
/**
|
|
3124
3256
|
* `POST /sessions/:id/link/resend` — send the hosted link again through the
|
|
3125
3257
|
* session's own `deliver` channel, to the same destination (neither can be
|
|
@@ -3423,6 +3555,25 @@ declare class ScreeningListsApi {
|
|
|
3423
3555
|
/** `DELETE /screening-lists/:id`: deletes the list and all its entries. */
|
|
3424
3556
|
delete(id: string): Promise<DeletedScreeningListItem>;
|
|
3425
3557
|
}
|
|
3558
|
+
/**
|
|
3559
|
+
* The sessions waiting on a review decision ({@link ReviewQueueItem}), for your
|
|
3560
|
+
* own review tool. Exposed as {@link Sekyro.reviews}. Needs the `reviews:read`
|
|
3561
|
+
* scope; decide one with {@link SessionsApi.review}. Exported as a TYPE only.
|
|
3562
|
+
* @public
|
|
3563
|
+
*/
|
|
3564
|
+
declare class ReviewsApi {
|
|
3565
|
+
private readonly t;
|
|
3566
|
+
/** @internal */
|
|
3567
|
+
constructor(t: {
|
|
3568
|
+
page<T>(path: string): Promise<Page<T>>;
|
|
3569
|
+
});
|
|
3570
|
+
/** The first page of the sessions in review (`GET /reviews`), oldest first. Every page: {@link ReviewsApi.iterate}. */
|
|
3571
|
+
list(query?: ListReviewsQuery): Promise<ReviewQueueItem[]>;
|
|
3572
|
+
/** One page of {@link ReviewsApi.list} with its `nextCursor` (absent on the last page). */
|
|
3573
|
+
listPage(query?: ListReviewsQuery): Promise<Page<ReviewQueueItem>>;
|
|
3574
|
+
/** Every session in review, oldest first, following `nextCursor` page after page. */
|
|
3575
|
+
iterate(query?: ListReviewsQuery): AsyncGenerator<ReviewQueueItem, void, undefined>;
|
|
3576
|
+
}
|
|
3426
3577
|
/**
|
|
3427
3578
|
* What you know about a device before you block it. Exposed as {@link Sekyro.devices}. Needs the
|
|
3428
3579
|
* `blocks:read` or `blocks:write` scope. Exported as a TYPE only.
|
|
@@ -3518,6 +3669,8 @@ declare class Sekyro {
|
|
|
3518
3669
|
readonly blocks: BlocksApi;
|
|
3519
3670
|
readonly signals: SignalsApi;
|
|
3520
3671
|
readonly screeningLists: ScreeningListsApi;
|
|
3672
|
+
/** The sessions in review: {@link ReviewsApi}. */
|
|
3673
|
+
readonly reviews: ReviewsApi;
|
|
3521
3674
|
readonly devices: DevicesApi;
|
|
3522
3675
|
readonly flows: FlowsApi;
|
|
3523
3676
|
readonly webhooks: WebhooksApi;
|
|
@@ -3540,4 +3693,4 @@ declare class Sekyro {
|
|
|
3540
3693
|
readiness(): Promise<ReadinessReport>;
|
|
3541
3694
|
}
|
|
3542
3695
|
|
|
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
|
|
3696
|
+
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 PoaRule 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 ListScreeningListEntriesQuery as aA, type ListScreeningsQuery as aB, type ListSessionsQuery as aC, type ListSignalsQuery as aD, type MatchReason as aE, type MediaBytes as aF, type MediaBytesOptions as aG, type MediaItem as aH, type MediaKind as aI, type MediaList as aJ, type NameForm as aK, type OverridableServiceId as aL, type Page as aM, PeopleApi as aN, type Person as aO, type PersonAddressInput as aP, type PersonBirthPlaceInput as aQ, type PersonDeletedEventData as aR, type PersonDocumentInput as aS, type PersonEnrolledEventData as aT, type PersonRef as aU, type PersonSession as aV, type PersonSessionInput as aW, type PersonSessionTarget as aX, type PersonUpdatedEventData as aY, type PoaDocumentKind as aZ, type PoaReason 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 ListReviewsQuery as az, type ServiceId as b, type SessionVerifiedEventData as b$, type PoaRuleKind as b0, type PoaRules as b1, type PortraitReportEntry as b2, type PriorReviewReason as b3, type ProbeBindingReason as b4, type ProbeQuality as b5, type ProfileDocumentType as b6, type ReadinessProtection as b7, type ReadinessReport as b8, type RequestOptions as b9, type SessionClosedEventDataBase as bA, type SessionDecidingStep as bB, type SessionDevice as bC, type SessionEventDataBase as bD, type SessionEventStep as bE, type SessionFailureReason as bF, type SessionFlowRef as bG, type SessionHandoff as bH, type SessionHandoffDevice as bI, type SessionLifecycleEventData as bJ, type SessionLinkDelivery as bK, type SessionLinkExpiry as bL, type SessionLinkInput as bM, type SessionNetwork as bN, type SessionNetworkEvent as bO, type SessionNotVerifiedEventData as bP, type SessionRetakeRequestedEventData as bQ, type SessionReviewPendingEventData as bR, type SessionScreening as bS, type SessionStatus as bT, type SessionStep as bU, type SessionStepAttempts as bV, type SessionStepBand as bW, type SessionStepDecision as bX, type SessionStepDocument as bY, type SessionStepPortrait as bZ, SessionTestApi as b_, type ResultTokenResponse as ba, type RetakeHint as bb, type ReviewDecisionInput as bc, type ReviewOutcome as bd, type ReviewOutcomeReason as be, type ReviewQueueCheck as bf, type ReviewQueueItem as bg, type ReviewVia as bh, ReviewsApi as bi, type RevokePersonInput as bj, type SandboxSimulatedReason as bk, type SandboxSimulation as bl, type ScreenPersonInput as bm, type Screening as bn, type ScreeningHit as bo, type ScreeningHitSummary as bp, type ScreeningList as bq, ScreeningListEntriesApi as br, type ScreeningListStrictness as bs, ScreeningListsApi as bt, type ScreeningStatus as bu, type ScreeningTrigger as bv, type ScreeningUnavailableReason as bw, type SekyroOptions as bx, SekyroTestApi as by, type Session as bz, type SessionPersonInput as c, SessionsApi as c0, type Signal as c1, type SignalEventData as c2, type SignalEvidence as c3, type SignalGrade as c4, type SignalKeyKind as c5, type SignalKind as c6, type SignalSeverity as c7, type SignalStatus as c8, SignalsApi as c9, type SimulateSessionInput as ca, type StepResult as cb, type SubjectAssurance as cc, type SubjectIdNumber as cd, type SubjectName as ce, type SubjectReferenceSource as cf, type SubjectReuseTarget as cg, type SubjectStatus as ch, type UpdateScreeningListInput as ci, type UpdateSignalInput as cj, type UsageLimitReachedEventData as ck, type UsageThresholdReachedEventData as cl, type VerifiedContacts as cm, type WebhookEnvelopeOf as cn, type WebhookEventDataMap as co, type WebhookTestInput as cp, type WebhookTestResult as cq, WebhooksApi as cr, 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-
|
|
2
|
-
import '../../client-
|
|
1
|
+
import { C as Connector, P as ProviderAdapter, G as GatePolicy, a as GateResult } from '../../connector-CyY0w62i.cjs';
|
|
2
|
+
import '../../client-B785k5Kg.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-
|
|
2
|
-
import '../../client-
|
|
1
|
+
import { C as Connector, P as ProviderAdapter, G as GatePolicy, a as GateResult } from '../../connector-DTcbZzAM.js';
|
|
2
|
+
import '../../client-B785k5Kg.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* `@sekyro/node/connect/express`: a route gate for Express (and any
|
package/dist/connect/index.d.cts
CHANGED
|
@@ -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-
|
|
2
|
-
export { A as AgeMethod, W as WebhookEventType } from '../client-
|
|
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-CyY0w62i.cjs';
|
|
2
|
+
export { A as AgeMethod, W as WebhookEventType } from '../client-B785k5Kg.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Why a connector refused to act:
|
package/dist/connect/index.d.ts
CHANGED
|
@@ -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-
|
|
2
|
-
export { A as AgeMethod, W as WebhookEventType } from '../client-
|
|
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-DTcbZzAM.js';
|
|
2
|
+
export { A as AgeMethod, W as WebhookEventType } from '../client-B785k5Kg.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-
|
|
2
|
-
import '../../client-
|
|
1
|
+
import { a as GateResult, C as Connector, P as ProviderAdapter, G as GatePolicy } from '../../connector-CyY0w62i.cjs';
|
|
2
|
+
import '../../client-B785k5Kg.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-
|
|
2
|
-
import '../../client-
|
|
1
|
+
import { a as GateResult, C as Connector, P as ProviderAdapter, G as GatePolicy } from '../../connector-DTcbZzAM.js';
|
|
2
|
+
import '../../client-B785k5Kg.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-
|
|
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-B785k5Kg.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-
|
|
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-B785k5Kg.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.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});
|
|
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.31";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 review(id,input,opts={}){return assertId("sessions.review",id),this.t.call("POST",path1("/sessions",id,"/review"),input,opts.idempotencyKey??globalThis.crypto.randomUUID())}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))}},ReviewsApi=class{constructor(t){this.t=t}t;async list(query={}){return(await this.listPage(query)).data}async listPage(query={}){let qs=new URLSearchParams;return setPaging("reviews.list",qs,query),this.t.page(withQuery("/reviews",qs))}iterate(query={}){return follow(query.cursor,cursor=>this.listPage(cursor===void 0?{...query}:{...query,cursor}))}},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;reviews;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.reviews=new ReviewsApi(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=[],placeLatin=text(p.lieuNaissanceFr);placeLatin!==void 0&&birthPlace.push({script:"Latn",value:placeLatin});let placeArabic=text(p.lieuNaissanceAr);placeArabic!==void 0&&birthPlace.push({script:"Arab",value:placeArabic}),birthPlace.length>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-
|
|
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
|
|
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-B785k5Kg.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 ListReviewsQuery, aA as ListScreeningListEntriesQuery, aB as ListScreeningsQuery, aC as ListSessionsQuery, aD as ListSignalsQuery, L as Locale, aE as MatchReason, aF as MediaBytes, aG as MediaBytesOptions, aH as MediaItem, aI as MediaKind, aJ as MediaList, aK as NameForm, aL as OverridableServiceId, aM as Page, aN as PeopleApi, aO as Person, aP as PersonAddressInput, aQ as PersonBirthPlaceInput, aR as PersonDeletedEventData, aS as PersonDocumentInput, aT as PersonEnrolledEventData, aU as PersonRef, aV as PersonSession, aW as PersonSessionInput, aX as PersonSessionTarget, aY as PersonUpdatedEventData, aZ as PoaDocumentKind, a_ as PoaReason, a$ as PoaRule, b0 as PoaRuleKind, b1 as PoaRules, b2 as PortraitReportEntry, b3 as PriorReviewReason, b4 as ProbeBindingReason, b5 as ProbeQuality, b6 as ProfileDocumentType, b7 as ReadinessProtection, b8 as ReadinessReport, b9 as RequestOptions, ba as ResultTokenResponse, bb as RetakeHint, bc as ReviewDecisionInput, bd as ReviewOutcome, be as ReviewOutcomeReason, bf as ReviewQueueCheck, bg as ReviewQueueItem, bh as ReviewVia, bi as ReviewsApi, bj as RevokePersonInput, bk as SandboxSimulatedReason, bl as SandboxSimulation, bm as ScreenPersonInput, bn as Screening, bo as ScreeningHit, bp as ScreeningHitSummary, bq as ScreeningList, br as ScreeningListEntriesApi, bs as ScreeningListStrictness, bt as ScreeningListsApi, bu as ScreeningStatus, bv as ScreeningTrigger, bw as ScreeningUnavailableReason, a as Sekyro, bx as SekyroOptions, by as SekyroTestApi, bz as Session, bA as SessionClosedEventDataBase, bB as SessionDecidingStep, bC as SessionDevice, bD as SessionEventDataBase, bE as SessionEventStep, bF as SessionFailureReason, bG as SessionFlowRef, bH as SessionHandoff, bI as SessionHandoffDevice, bJ as SessionLifecycleEventData, bK as SessionLinkDelivery, bL as SessionLinkExpiry, bM as SessionLinkInput, bN as SessionNetwork, bO as SessionNetworkEvent, bP as SessionNotVerifiedEventData, S as SessionReason, bQ as SessionRetakeRequestedEventData, bR as SessionReviewPendingEventData, bS as SessionScreening, bT as SessionStatus, bU as SessionStep, bV as SessionStepAttempts, bW as SessionStepBand, bX as SessionStepDecision, bY as SessionStepDocument, bZ as SessionStepPortrait, b_ as SessionTestApi, b$ as SessionVerifiedEventData, c0 as SessionsApi, c1 as Signal, c2 as SignalEventData, c3 as SignalEvidence, c4 as SignalGrade, c5 as SignalKeyKind, c6 as SignalKind, c7 as SignalSeverity, c8 as SignalStatus, c9 as SignalsApi, ca as SimulateSessionInput, cb as StepResult, cc as SubjectAssurance, cd as SubjectIdNumber, ce as SubjectName, cf as SubjectReferenceSource, cg as SubjectReuseTarget, ch as SubjectStatus, ci as UpdateScreeningListInput, cj as UpdateSignalInput, ck as UsageLimitReachedEventData, cl as UsageThresholdReachedEventData, cm as VerifiedContacts, cn as WebhookEnvelopeOf, co as WebhookEventDataMap, W as WebhookEventType, cp as WebhookTestInput, cq as WebhookTestResult, cr as WebhooksApi } from './client-B785k5Kg.cjs';
|
|
3
3
|
|
|
4
4
|
/** Why {@link verifyWebhook} rejected a delivery. @public */
|
|
5
5
|
type SekyroWebhookErrorCode = "invalid_signature" | "stale" | "malformed";
|
package/dist/index.d.ts
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-
|
|
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
|
|
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-B785k5Kg.js';
|
|
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 ListReviewsQuery, aA as ListScreeningListEntriesQuery, aB as ListScreeningsQuery, aC as ListSessionsQuery, aD as ListSignalsQuery, L as Locale, aE as MatchReason, aF as MediaBytes, aG as MediaBytesOptions, aH as MediaItem, aI as MediaKind, aJ as MediaList, aK as NameForm, aL as OverridableServiceId, aM as Page, aN as PeopleApi, aO as Person, aP as PersonAddressInput, aQ as PersonBirthPlaceInput, aR as PersonDeletedEventData, aS as PersonDocumentInput, aT as PersonEnrolledEventData, aU as PersonRef, aV as PersonSession, aW as PersonSessionInput, aX as PersonSessionTarget, aY as PersonUpdatedEventData, aZ as PoaDocumentKind, a_ as PoaReason, a$ as PoaRule, b0 as PoaRuleKind, b1 as PoaRules, b2 as PortraitReportEntry, b3 as PriorReviewReason, b4 as ProbeBindingReason, b5 as ProbeQuality, b6 as ProfileDocumentType, b7 as ReadinessProtection, b8 as ReadinessReport, b9 as RequestOptions, ba as ResultTokenResponse, bb as RetakeHint, bc as ReviewDecisionInput, bd as ReviewOutcome, be as ReviewOutcomeReason, bf as ReviewQueueCheck, bg as ReviewQueueItem, bh as ReviewVia, bi as ReviewsApi, bj as RevokePersonInput, bk as SandboxSimulatedReason, bl as SandboxSimulation, bm as ScreenPersonInput, bn as Screening, bo as ScreeningHit, bp as ScreeningHitSummary, bq as ScreeningList, br as ScreeningListEntriesApi, bs as ScreeningListStrictness, bt as ScreeningListsApi, bu as ScreeningStatus, bv as ScreeningTrigger, bw as ScreeningUnavailableReason, a as Sekyro, bx as SekyroOptions, by as SekyroTestApi, bz as Session, bA as SessionClosedEventDataBase, bB as SessionDecidingStep, bC as SessionDevice, bD as SessionEventDataBase, bE as SessionEventStep, bF as SessionFailureReason, bG as SessionFlowRef, bH as SessionHandoff, bI as SessionHandoffDevice, bJ as SessionLifecycleEventData, bK as SessionLinkDelivery, bL as SessionLinkExpiry, bM as SessionLinkInput, bN as SessionNetwork, bO as SessionNetworkEvent, bP as SessionNotVerifiedEventData, S as SessionReason, bQ as SessionRetakeRequestedEventData, bR as SessionReviewPendingEventData, bS as SessionScreening, bT as SessionStatus, bU as SessionStep, bV as SessionStepAttempts, bW as SessionStepBand, bX as SessionStepDecision, bY as SessionStepDocument, bZ as SessionStepPortrait, b_ as SessionTestApi, b$ as SessionVerifiedEventData, c0 as SessionsApi, c1 as Signal, c2 as SignalEventData, c3 as SignalEvidence, c4 as SignalGrade, c5 as SignalKeyKind, c6 as SignalKind, c7 as SignalSeverity, c8 as SignalStatus, c9 as SignalsApi, ca as SimulateSessionInput, cb as StepResult, cc as SubjectAssurance, cd as SubjectIdNumber, ce as SubjectName, cf as SubjectReferenceSource, cg as SubjectReuseTarget, ch as SubjectStatus, ci as UpdateScreeningListInput, cj as UpdateSignalInput, ck as UsageLimitReachedEventData, cl as UsageThresholdReachedEventData, cm as VerifiedContacts, cn as WebhookEnvelopeOf, co as WebhookEventDataMap, W as WebhookEventType, cp as WebhookTestInput, cq as WebhookTestResult, cr as WebhooksApi } from './client-B785k5Kg.js';
|
|
3
3
|
|
|
4
4
|
/** Why {@link verifyWebhook} rejected a delivery. @public */
|
|
5
5
|
type SekyroWebhookErrorCode = "invalid_signature" | "stale" | "malformed";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
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}import{createHmac,timingSafeEqual}from"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=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&&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}import{createLocalJWKSet,errors as joseErrors,jwtVerify}from"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 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 joseErrors.JWTExpired)return new SekyroResultTokenError("expired",void 0,err);if(err instanceof joseErrors.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 jwtVerify(token,keys,verifyOpts)}catch(err){if(!(err instanceof joseErrors.JWKSNoMatchingKey))throw err;let entry=jwksCache.get(jwksUrl);if(entry&&now()-entry.fetchedAt<JWKS_COOLDOWN_MS)throw err;verified=await 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))}export{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
|
+
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.31";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 review(id,input,opts={}){return assertId("sessions.review",id),this.t.call("POST",path1("/sessions",id,"/review"),input,opts.idempotencyKey??globalThis.crypto.randomUUID())}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))}},ReviewsApi=class{constructor(t){this.t=t}t;async list(query={}){return(await this.listPage(query)).data}async listPage(query={}){let qs=new URLSearchParams;return setPaging("reviews.list",qs,query),this.t.page(withQuery("/reviews",qs))}iterate(query={}){return follow(query.cursor,cursor=>this.listPage(cursor===void 0?{...query}:{...query,cursor}))}},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;reviews;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.reviews=new ReviewsApi(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=[],placeLatin=text(p.lieuNaissanceFr);placeLatin!==void 0&&birthPlace.push({script:"Latn",value:placeLatin});let placeArabic=text(p.lieuNaissanceAr);placeArabic!==void 0&&birthPlace.push({script:"Arab",value:placeArabic}),birthPlace.length>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}import{createHmac,timingSafeEqual}from"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=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&&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}import{createLocalJWKSet,errors as joseErrors,jwtVerify}from"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 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 joseErrors.JWTExpired)return new SekyroResultTokenError("expired",void 0,err);if(err instanceof joseErrors.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 jwtVerify(token,keys,verifyOpts)}catch(err){if(!(err instanceof joseErrors.JWKSNoMatchingKey))throw err;let entry=jwksCache.get(jwksUrl);if(entry&&now()-entry.fetchedAt<JWKS_COOLDOWN_MS)throw err;verified=await 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))}export{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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sekyro/node",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.31",
|
|
4
4
|
"description": "Sekyro AI server SDK for Node.js — create and read verification sessions, verify signed webhooks and result tokens.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
package/sbom.cdx.json
CHANGED
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
"type": "application",
|
|
98
98
|
"name": "node",
|
|
99
99
|
"group": "@sekyro",
|
|
100
|
-
"version": "1.0.0-rc.
|
|
101
|
-
"bom-ref": "@sekyro/node@1.0.0-rc.
|
|
100
|
+
"version": "1.0.0-rc.31",
|
|
101
|
+
"bom-ref": "@sekyro/node@1.0.0-rc.31",
|
|
102
102
|
"description": "Sekyro AI server SDK for Node.js — create and read verification sessions, verify signed webhooks and result tokens.",
|
|
103
103
|
"licenses": [
|
|
104
104
|
{
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
],
|
|
111
|
-
"purl": "pkg:npm/%40sekyro/node@1.0.0-rc.
|
|
111
|
+
"purl": "pkg:npm/%40sekyro/node@1.0.0-rc.31?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2FIBTIKAR-Technologies%2Fibtikar-identity.git%23packages%2Fsekyro-node",
|
|
112
112
|
"externalReferences": [
|
|
113
113
|
{
|
|
114
114
|
"url": "https://github.com/IBTIKAR-Technologies/ibtikar-identity/issues",
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
"type": "library",
|
|
150
150
|
"name": "jose",
|
|
151
151
|
"version": "5.10.0",
|
|
152
|
-
"bom-ref": "@sekyro/node@1.0.0-rc.
|
|
152
|
+
"bom-ref": "@sekyro/node@1.0.0-rc.31|jose@5.10.0",
|
|
153
153
|
"licenses": [
|
|
154
154
|
{
|
|
155
155
|
"license": {
|
|
@@ -182,13 +182,13 @@
|
|
|
182
182
|
],
|
|
183
183
|
"dependencies": [
|
|
184
184
|
{
|
|
185
|
-
"ref": "@sekyro/node@1.0.0-rc.
|
|
185
|
+
"ref": "@sekyro/node@1.0.0-rc.31",
|
|
186
186
|
"dependsOn": [
|
|
187
|
-
"@sekyro/node@1.0.0-rc.
|
|
187
|
+
"@sekyro/node@1.0.0-rc.31|jose@5.10.0"
|
|
188
188
|
]
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
|
-
"ref": "@sekyro/node@1.0.0-rc.
|
|
191
|
+
"ref": "@sekyro/node@1.0.0-rc.31|jose@5.10.0"
|
|
192
192
|
}
|
|
193
193
|
]
|
|
194
194
|
}
|