@sekyro/node 0.1.0-rc.8 → 1.0.0-rc.15
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 +108 -0
- package/README.md +299 -95
- package/dist/{chunk-TAPXGI3Q.js → chunk-IM3UCVDB.js} +1 -1
- package/dist/chunk-J6U2QY7M.js +1 -0
- package/dist/client-sqMIpSkm.d.cts +2460 -0
- package/dist/client-sqMIpSkm.d.ts +2460 -0
- package/dist/connect/express/index.cjs +1 -1
- package/dist/connect/express/index.d.cts +2 -2
- package/dist/connect/express/index.d.ts +2 -2
- package/dist/connect/express/index.js +1 -1
- package/dist/connect/index.cjs +1 -1
- package/dist/connect/index.d.cts +2 -2
- package/dist/connect/index.d.ts +2 -2
- package/dist/connect/index.js +1 -1
- package/dist/connect/next/index.cjs +1 -1
- package/dist/connect/next/index.d.cts +2 -2
- package/dist/connect/next/index.d.ts +2 -2
- package/dist/connect/next/index.js +1 -1
- package/dist/{connector-DDQhtSv3.d.ts → connector-CF78_88V.d.cts} +98 -15
- package/dist/{connector-BVJ4TA8d.d.cts → connector-DXF-FRVf.d.ts} +98 -15
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +134 -36
- package/dist/index.d.ts +134 -36
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/sbom.cdx.json +7 -7
- package/dist/chunk-O5GJ3YJV.js +0 -1
- package/dist/client-CcZfrjW1.d.cts +0 -1541
- package/dist/client-CcZfrjW1.d.ts +0 -1541
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ServiceId, b as
|
|
2
|
-
export {
|
|
1
|
+
import { a as ServiceId, b as SessionPersonInput, c as WebhookEnvelope, R as ReviewReason, d as SekyroEnvironment, V as VerificationLevel, e as VerificationAssurance, f as SessionOutcome, g as VerificationUnit, h as SubjectReuseMode, i as ResultRisk, j as ResultCheckProofs, k as ResultDuplicate, A as AgeMethod, l as FailureIdentification, F as FetchLike } from './client-sqMIpSkm.cjs';
|
|
2
|
+
export { m as AgeResult, n as AmlMatchFlaggedEventData, o as ApiKeyIdentity, B as Block, p as BlockCheck, q as BlockCheckInput, r as BlockDuration, s as BlockIdNumber, t as BlockKind, u as BlockReason, v as BlocksApi, w as CameraUnavailableCause, x as CheckState, y as CheckType, z as ConnectorIdentity, D as CreateBlockInput, E as CreateSessionInput, C as CreatedSession, G as DEFAULT_BASE_URL, H as DEFAULT_TIMEOUT_MS, I as DecidedBy, J as DecisionReason, K as DeepPartial, M as DeletedPerson, N as DeliverOptions, O as Device, P as DevicesApi, Q as DocumentSubstitutionSettings, T as EidResult, U as EligibilityReason, X as ExtendLinkInput, Y as FlowOverridableSettings, Z as FlowOverrides, _ as FlowServiceSettings, $ as FlowSummary, a0 as FlowsApi, a1 as IdNumberReason, a2 as Identity, a3 as IdentityBirthPlace, a4 as IdentityDocument, a5 as IdentityIdNumber, a6 as IdentityMethod, a7 as IdentityName, a8 as IdentityScalarKey, a9 as IdentitySource, aa as IdentitySources, ab as LevelTarget, ac as LiftBlockInput, ad as ListBlocksQuery, ae as ListPeopleQuery, af as ListScreeningsQuery, ag as ListSessionsQuery, L as Locale, ah as MatchReason, ai as MediaBytes, aj as MediaBytesOptions, ak as MediaItem, al as MediaKind, am as MediaList, an as NameForm, ao as Page, ap as PeopleApi, aq as Person, ar as PersonBirthPlaceInput, as as PersonDeletedEventData, at as PersonDocumentInput, au as PersonEnrolledEventData, av as PersonSession, aw as PersonSessionInput, ax as PersonSessionTarget, ay as PersonSuspiciousActivityEventData, az as PersonUpdatedEventData, aA as PolicyFailureReason, aB as PortraitReportEntry, aC as PriorReviewReason, aD as ProbeBindingReason, aE as ProbeQuality, aF as ProfileDocumentType, aG as RequestOptions, aH as ResultTokenResponse, aI as ReviewOutcomeReason, aJ as RevokePersonInput, aK as ScreenPersonInput, aL as Screening, aM as ScreeningHit, aN as ScreeningHitSummary, aO as ScreeningList, aP as ScreeningStatus, aQ as ScreeningTrigger, aR as ScreeningUnavailableReason, S as Sekyro, aS as SekyroOptions, aT as Session, aU as SessionDevice, aV as SessionDeviceSignal, aW as SessionFailureReason, aX as SessionFlowRef, aY as SessionLifecycleEventData, aZ as SessionLinkDelivery, a_ as SessionLinkExpiry, a$ as SessionLinkInput, b0 as SessionNetwork, b1 as SessionNetworkEvent, b2 as SessionScreening, b3 as SessionStatus, b4 as SessionStep, b5 as SessionStepDecision, b6 as SessionSupersededEventData, b7 as SessionsApi, b8 as SimulateSessionInput, b9 as SubjectAssurance, ba as SubjectIdNumber, bb as SubjectName, bc as SubjectReferenceSource, bd as SubjectReuseTarget, be as SubjectStatus, bf as UsageThresholdReachedEventData, bg as VerifiedContacts, bh as WebhookEnvelopeOf, bi as WebhookEventDataMap, W as WebhookEventType } from './client-sqMIpSkm.cjs';
|
|
3
3
|
|
|
4
4
|
/** Why {@link verifyWebhook} rejected a delivery. @public */
|
|
5
5
|
type SekyroWebhookErrorCode = "invalid_signature" | "stale" | "malformed";
|
|
@@ -21,12 +21,13 @@ declare class SekyroWebhookError extends Error {
|
|
|
21
21
|
* - `wrong_audience`: issued for another app;
|
|
22
22
|
* - `wrong_issuer`: not issued by the expected issuer;
|
|
23
23
|
* - `wrong_env`: a sandbox token when you asked for live, or the reverse;
|
|
24
|
+
* - `env_required`: `env` is missing or is not `"live"` or `"sandbox"`;
|
|
24
25
|
* - `key_env_mismatch`: the environment claim does not match the key that signed it;
|
|
25
26
|
* - `jwks_unavailable`: the public key set could not be fetched;
|
|
26
27
|
* - `invalid_options`: a missing `appId` or an unsafe `jwksUrl`.
|
|
27
28
|
* @public
|
|
28
29
|
*/
|
|
29
|
-
type SekyroResultTokenErrorCode = "invalid_token" | "expired" | "wrong_audience" | "wrong_issuer" | "wrong_env" | "key_env_mismatch" | "jwks_unavailable" | "invalid_options";
|
|
30
|
+
type SekyroResultTokenErrorCode = "invalid_token" | "expired" | "wrong_audience" | "wrong_issuer" | "wrong_env" | "env_required" | "key_env_mismatch" | "jwks_unavailable" | "invalid_options";
|
|
30
31
|
/**
|
|
31
32
|
* Thrown by {@link verifyResultToken}. Do not use the token's content.
|
|
32
33
|
* @public
|
|
@@ -37,9 +38,10 @@ declare class SekyroResultTokenError extends Error {
|
|
|
37
38
|
constructor(code: SekyroResultTokenErrorCode, message?: string, cause?: unknown);
|
|
38
39
|
}
|
|
39
40
|
/** Why the {@link Sekyro} constructor rejected its options. @public */
|
|
40
|
-
type SekyroConfigErrorCode = "missing_api_key" | "invalid_base_url" | "invalid_registry_record";
|
|
41
|
+
type SekyroConfigErrorCode = "missing_api_key" | "invalid_base_url" | "invalid_registry_record" | "registry_country_unsupported" | "registry_nationality_unmapped";
|
|
41
42
|
/**
|
|
42
|
-
* Thrown synchronously by `new Sekyro(...)` for an unusable configuration
|
|
43
|
+
* Thrown synchronously by `new Sekyro(...)` for an unusable configuration, and by
|
|
44
|
+
* {@link personFromNationalRegistry} for an unusable registry answer:
|
|
43
45
|
* before any request is made. Extends `TypeError` so existing
|
|
44
46
|
* `instanceof TypeError` guards keep working.
|
|
45
47
|
* @public
|
|
@@ -60,7 +62,7 @@ declare class SekyroConfigError extends TypeError {
|
|
|
60
62
|
* result that is not a valid flow;
|
|
61
63
|
* - `override_widens_flow` (403): the override makes the flow less strict
|
|
62
64
|
* (e.g. a service turned `'off'`) and the flow does not allow widening;
|
|
63
|
-
* - `reuse_disabled` (409): `
|
|
65
|
+
* - `reuse_disabled` (409): `person.reuse` on a flow whose returning-user
|
|
64
66
|
* sessions are turned off.
|
|
65
67
|
*
|
|
66
68
|
* On `sessions.selectMethod` (a flow session's identity-method choice):
|
|
@@ -82,7 +84,7 @@ interface FlowErrorIssue {
|
|
|
82
84
|
code: string;
|
|
83
85
|
/** A short plain English sentence. */
|
|
84
86
|
message: string;
|
|
85
|
-
/** The field of your request body, e.g. `overrides.services.liveness.attempts`, `flow`, `
|
|
87
|
+
/** The field of your request body, e.g. `overrides.services.liveness.attempts`, `flow`, `person.reuse`. */
|
|
86
88
|
path?: string;
|
|
87
89
|
/** A node of your app's flow. */
|
|
88
90
|
nodeId?: string;
|
|
@@ -136,6 +138,22 @@ type SekyroFlowError<C extends SekyroFlowErrorCode = SekyroFlowErrorCode> = C ex
|
|
|
136
138
|
* @public
|
|
137
139
|
*/
|
|
138
140
|
type SekyroApiErrorCode = SekyroClientErrorCode | SekyroFlowErrorCode | (string & {});
|
|
141
|
+
/**
|
|
142
|
+
* One field the API refused, from `details.fieldErrors` of a
|
|
143
|
+
* `validation_error`. Never carries a value you sent.
|
|
144
|
+
* @public
|
|
145
|
+
*/
|
|
146
|
+
interface SekyroFieldError {
|
|
147
|
+
/**
|
|
148
|
+
* Dotted path in your request body, e.g. `person.phone`. For `unknown_field`:
|
|
149
|
+
* the object that holds the key (`?` for the top level); the key is not repeated.
|
|
150
|
+
*/
|
|
151
|
+
field: string;
|
|
152
|
+
/** The validator's issue type, e.g. `picklist` or `min_length`, or `unknown_field` for a key the API does not accept. */
|
|
153
|
+
code: string;
|
|
154
|
+
/** What the schema accepts, for a picklist or a literal, e.g. `"ar" | "fr" | "en"`. */
|
|
155
|
+
expected?: string;
|
|
156
|
+
}
|
|
139
157
|
/** Constructor input of {@link SekyroApiError}. @public */
|
|
140
158
|
interface SekyroApiErrorInit {
|
|
141
159
|
/** HTTP status; `0` when no response was received (network / timeout). */
|
|
@@ -143,19 +161,21 @@ interface SekyroApiErrorInit {
|
|
|
143
161
|
/** API error code, or `network` | `timeout` | `http_error` | `malformed_response`. */
|
|
144
162
|
code: SekyroApiErrorCode;
|
|
145
163
|
message: string;
|
|
146
|
-
/** The API's `
|
|
164
|
+
/** The API's `requestId`, when the response carried one. */
|
|
147
165
|
requestId?: string;
|
|
148
166
|
/** The API's `error.details`, when the response carried them (the flow codes: {@link SekyroFlowErrorDetailsMap}). */
|
|
149
167
|
details?: unknown;
|
|
150
168
|
/** Underlying error (network failures, abort reasons, JSON parse errors). */
|
|
151
169
|
cause?: unknown;
|
|
170
|
+
/** Seconds to wait before retrying, from the response's `Retry-After` header. */
|
|
171
|
+
retryAfterSeconds?: number;
|
|
152
172
|
}
|
|
153
173
|
/** Error codes the SDK itself produces (as opposed to codes from the API). @public */
|
|
154
174
|
type SekyroClientErrorCode = "network" | "timeout" | "http_error" | "malformed_response";
|
|
155
175
|
/**
|
|
156
176
|
* Any failed call through {@link Sekyro}: a non-2xx partner envelope
|
|
157
|
-
* `{
|
|
158
|
-
* response, a network failure or a timeout.
|
|
177
|
+
* `{ success: false, error: { code, message, requestId, details? } }`, a
|
|
178
|
+
* non-JSON response, a network failure or a timeout.
|
|
159
179
|
*
|
|
160
180
|
* `retryable` is `true` for `network`, `timeout`, HTTP 429, HTTP 5xx and the
|
|
161
181
|
* `idempotency_in_progress` code — retry with the SAME idempotency key.
|
|
@@ -172,7 +192,18 @@ declare class SekyroApiError extends Error {
|
|
|
172
192
|
* code's documented shape ({@link SekyroFlowErrorDetailsMap}).
|
|
173
193
|
*/
|
|
174
194
|
readonly details: unknown;
|
|
195
|
+
/**
|
|
196
|
+
* The fields a `validation_error` refused, from `details.fieldErrors`;
|
|
197
|
+
* `undefined` when the response names none.
|
|
198
|
+
*/
|
|
199
|
+
readonly fieldErrors: SekyroFieldError[] | undefined;
|
|
175
200
|
readonly retryable: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Seconds to wait before retrying, from the response's `Retry-After` header
|
|
203
|
+
* (a number of seconds, or an HTTP date rounded up to whole seconds from now).
|
|
204
|
+
* `undefined` when the response had no usable header.
|
|
205
|
+
*/
|
|
206
|
+
readonly retryAfterSeconds: number | undefined;
|
|
176
207
|
constructor(init: SekyroApiErrorInit);
|
|
177
208
|
}
|
|
178
209
|
/**
|
|
@@ -221,33 +252,59 @@ interface AnrptsPersonneResponse {
|
|
|
221
252
|
datePhoto?: string | undefined;
|
|
222
253
|
[key: string]: unknown;
|
|
223
254
|
}
|
|
224
|
-
/**
|
|
225
|
-
|
|
255
|
+
/**
|
|
256
|
+
* Registry answer formats Sekyro AI can map, by ISO 3166-1 alpha-2 country.
|
|
257
|
+
* @public
|
|
258
|
+
*/
|
|
259
|
+
interface NationalRegistryResponses {
|
|
260
|
+
/** Mauritania: the ANRPTS `getPersonne` answer `{ personne, photo, datePhoto? }`. */
|
|
261
|
+
MR: AnrptsPersonneResponse;
|
|
262
|
+
}
|
|
263
|
+
/** A country {@link personFromNationalRegistry} can map. @public */
|
|
264
|
+
type NationalRegistryCountry = keyof NationalRegistryResponses;
|
|
265
|
+
/** Options of {@link personFromNationalRegistry}. @public */
|
|
266
|
+
interface PersonFromRegistryOptions {
|
|
226
267
|
/**
|
|
227
|
-
* When YOUR system received this
|
|
268
|
+
* When YOUR system received this answer (not "now" when you map a cached
|
|
228
269
|
* answer). Required: records older than 24 h are refused at session create.
|
|
229
270
|
*/
|
|
230
271
|
fetchedAt: Date | string;
|
|
272
|
+
/**
|
|
273
|
+
* The person's nationality (ISO 3166-1 alpha-2) when you map the registry's
|
|
274
|
+
* nationality text yourself; it replaces the SDK's mapping. Needed when the answer
|
|
275
|
+
* states a nationality the SDK cannot map (`registry_nationality_unmapped`).
|
|
276
|
+
*/
|
|
277
|
+
nationality?: string;
|
|
231
278
|
}
|
|
232
279
|
/**
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
|
|
237
|
-
|
|
280
|
+
* The `person` keys of a reference record, ready to spread into
|
|
281
|
+
* `sessions.create({ person })`.
|
|
282
|
+
* @public
|
|
283
|
+
*/
|
|
284
|
+
type PersonRecord = Required<Pick<SessionPersonInput, "idNumber" | "birthDate" | "photo" | "fetchedAt">> & Pick<SessionPersonInput, "fullName" | "names" | "birthPlace" | "sex" | "nationalities" | "photoDate">;
|
|
285
|
+
/**
|
|
286
|
+
* Convert a national registry answer that YOUR server already received, with
|
|
287
|
+
* your own access, into the `person` reference keys of `sessions.create`. A
|
|
288
|
+
* pure, local mapping: it makes no network call, and Sekyro AI never sees,
|
|
289
|
+
* receives or stores any registry key, only the record and photo you pass.
|
|
238
290
|
*
|
|
239
291
|
* ```ts
|
|
240
|
-
* const
|
|
241
|
-
*
|
|
242
|
-
*
|
|
292
|
+
* const answer = await myRegistryClient.lookup(number); // your call, your key
|
|
293
|
+
* await sekyro.sessions.create({
|
|
294
|
+
* person: { externalRef, ...personFromNationalRegistry("MR", answer, { fetchedAt: receivedAt }) },
|
|
295
|
+
* });
|
|
243
296
|
* ```
|
|
244
297
|
*
|
|
245
|
-
* Throws {@link SekyroConfigError}
|
|
246
|
-
* field (
|
|
247
|
-
* missing
|
|
298
|
+
* Throws {@link SekyroConfigError}: `invalid_registry_record` when a required
|
|
299
|
+
* field (the number, a given and family name in at least one script, the birth
|
|
300
|
+
* date, the photo) is missing or `fetchedAt` is not a date (the message names
|
|
301
|
+
* the field, never its value); `registry_country_unsupported` for a country
|
|
302
|
+
* without an adapter; `registry_nationality_unmapped` when the answer states a
|
|
303
|
+
* nationality and none of its values maps to an ISO code (map it yourself and pass
|
|
304
|
+
* `options.nationality`; the message never carries the value).
|
|
248
305
|
* @public
|
|
249
306
|
*/
|
|
250
|
-
declare function
|
|
307
|
+
declare function personFromNationalRegistry<C extends NationalRegistryCountry>(country: C, response: NationalRegistryResponses[C], options: PersonFromRegistryOptions): PersonRecord;
|
|
251
308
|
|
|
252
309
|
/**
|
|
253
310
|
* The HTTP header carrying the webhook signature:
|
|
@@ -321,10 +378,12 @@ interface VerifyResultTokenOptions {
|
|
|
321
378
|
/** Key set URL. Default `${issuer}/.well-known/sekyro/jwks.json`. Must be `https:` (plain `http:` only on a loopback host). */
|
|
322
379
|
jwksUrl?: string;
|
|
323
380
|
/**
|
|
324
|
-
* The environment you accept
|
|
325
|
-
*
|
|
381
|
+
* The environment you accept, required: `"live"` or `"sandbox"`. A sandbox
|
|
382
|
+
* token is refused when you ask for `live` (`wrong_env`), and the reverse.
|
|
383
|
+
* Read it from your configuration, so a Sandbox token can never pass in
|
|
384
|
+
* production. A missing or other value throws `env_required`.
|
|
326
385
|
*/
|
|
327
|
-
env
|
|
386
|
+
env: SekyroEnvironment;
|
|
328
387
|
/** Custom `fetch` for the key set (tests, proxies). Default `globalThis.fetch`. */
|
|
329
388
|
fetch?: FetchLike;
|
|
330
389
|
/** Clock returning epoch milliseconds. Default `Date.now`. */
|
|
@@ -332,6 +391,24 @@ interface VerifyResultTokenOptions {
|
|
|
332
391
|
/** Allowed clock skew in seconds for `exp` / `iat`. Default 30. */
|
|
333
392
|
clockToleranceSec?: number;
|
|
334
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* The `sekyro.decision` claim, in camelCase: the human decision that settled
|
|
396
|
+
* the session (the face match's when a person decided it, else the first step
|
|
397
|
+
* a person decided). Counts and enums only, never a reviewer or a vote.
|
|
398
|
+
* @public
|
|
399
|
+
*/
|
|
400
|
+
interface ResultDecision {
|
|
401
|
+
source: "review" | "prior_review";
|
|
402
|
+
mode: "single" | "dual";
|
|
403
|
+
votes: 1 | 2 | 3;
|
|
404
|
+
/** Dual review only: whether the first two reviewers agreed. */
|
|
405
|
+
agreement?: boolean;
|
|
406
|
+
reasons: ReviewReason[];
|
|
407
|
+
/** ISO 8601. */
|
|
408
|
+
decidedAt: string;
|
|
409
|
+
/** `prior_review` only: your earlier session whose review decided this one. */
|
|
410
|
+
sessionId?: string;
|
|
411
|
+
}
|
|
335
412
|
/**
|
|
336
413
|
* The verified content of a result token, in camelCase.
|
|
337
414
|
* @public
|
|
@@ -341,9 +418,18 @@ interface VerifiedResult {
|
|
|
341
418
|
orgId: string;
|
|
342
419
|
/** The app id the token was issued for (its `aud`), one of {@link VerifyResultTokenOptions.appId}. */
|
|
343
420
|
appId: string;
|
|
344
|
-
/**
|
|
421
|
+
/**
|
|
422
|
+
* The person the session is linked to, `per_` prefixed (as `personId` on the
|
|
423
|
+
* session and on `GET /people`), once that person has passed a verification
|
|
424
|
+
* (absent before that). The token's `sub` holds the same id, bare.
|
|
425
|
+
*/
|
|
426
|
+
personId?: string;
|
|
427
|
+
/**
|
|
428
|
+
* The same person, bare (the token's `sub`).
|
|
429
|
+
* @deprecated Read {@link VerifiedResult.personId}.
|
|
430
|
+
*/
|
|
345
431
|
subjectId?: string;
|
|
346
|
-
/** Your own id for the person, from `
|
|
432
|
+
/** Your own id for the person, from `person.externalRef` at create. */
|
|
347
433
|
externalRef?: string;
|
|
348
434
|
env: SekyroEnvironment;
|
|
349
435
|
level: VerificationLevel | null;
|
|
@@ -371,6 +457,14 @@ interface VerifiedResult {
|
|
|
371
457
|
over: number;
|
|
372
458
|
method: AgeMethod;
|
|
373
459
|
};
|
|
460
|
+
/** The `sekyro.decision` claim, when a person decided a step of the session. */
|
|
461
|
+
decision?: ResultDecision;
|
|
462
|
+
/**
|
|
463
|
+
* The `sekyro.failure_identification` claim, when the setting is on and the
|
|
464
|
+
* search found a match. A signal, never a decision; `other_identity` is
|
|
465
|
+
* informational only (see {@link FailureIdentification}).
|
|
466
|
+
*/
|
|
467
|
+
failureIdentification?: FailureIdentification;
|
|
374
468
|
}
|
|
375
469
|
/**
|
|
376
470
|
* Verify a Sekyro AI result token (the `resultToken` of a terminal webhook,
|
|
@@ -379,14 +473,18 @@ interface VerifiedResult {
|
|
|
379
473
|
* Checks the ES256 signature against the public key set (fetched from
|
|
380
474
|
* `${issuer}/.well-known/sekyro/jwks.json` and cached for 10 minutes; an
|
|
381
475
|
* unknown key id fetches it again), the issuer, the audience (your app id),
|
|
382
|
-
* the expiry,
|
|
383
|
-
* (sandbox keys have ids
|
|
384
|
-
* {@link SekyroResultTokenError} otherwise; never
|
|
385
|
-
* before this resolves.
|
|
476
|
+
* the expiry, that the token is for the `env` you pass, and that its
|
|
477
|
+
* environment claim matches the key that signed it (sandbox keys have ids
|
|
478
|
+
* starting `sbx-`). Throws {@link SekyroResultTokenError} otherwise; never
|
|
479
|
+
* trust the token's content before this resolves.
|
|
386
480
|
*
|
|
387
481
|
* @example
|
|
388
482
|
* ```ts
|
|
389
|
-
*
|
|
483
|
+
* // SEKYRO_ENV is "sandbox" until go-live, then "live".
|
|
484
|
+
* const result = await verifyResultToken(token, {
|
|
485
|
+
* appId: process.env.SEKYRO_APP_ID!,
|
|
486
|
+
* env: process.env.SEKYRO_ENV as "live" | "sandbox",
|
|
487
|
+
* });
|
|
390
488
|
* if (result.outcome === "approved" && (result.level ?? 0) >= 1) {
|
|
391
489
|
* // a verified real person
|
|
392
490
|
* }
|
|
@@ -395,4 +493,4 @@ interface VerifiedResult {
|
|
|
395
493
|
*/
|
|
396
494
|
declare function verifyResultToken(token: string, opts: VerifyResultTokenOptions): Promise<VerifiedResult>;
|
|
397
495
|
|
|
398
|
-
export { AgeMethod, type AnrptsPersonneResponse, DEFAULT_RESULT_TOKEN_ISSUER, FetchLike, type FlowErrorDetails, type FlowErrorIssue, type FlowRefErrorDetails, type FlowWidensErrorDetails, LEGACY_SIGNATURE_HEADER,
|
|
496
|
+
export { AgeMethod, type AnrptsPersonneResponse, DEFAULT_RESULT_TOKEN_ISSUER, FailureIdentification, FetchLike, type FlowErrorDetails, type FlowErrorIssue, type FlowRefErrorDetails, type FlowWidensErrorDetails, LEGACY_SIGNATURE_HEADER, type NationalRegistryCountry, type NationalRegistryResponses, type PersonFromRegistryOptions, type PersonRecord, RESULT_TOKEN_JWKS_PATH, ResultCheckProofs, type ResultDecision, ResultDuplicate, ResultRisk, ReviewReason, SEKYRO_SIGNATURE_HEADER, SekyroApiError, type SekyroApiErrorCode, type SekyroApiErrorInit, type SekyroClientErrorCode, SekyroConfigError, type SekyroConfigErrorCode, SekyroEnvironment, type SekyroFieldError, type SekyroFlowError, type SekyroFlowErrorCode, type SekyroFlowErrorDetailsMap, SekyroResultTokenError, type SekyroResultTokenErrorCode, SekyroWebhookError, type SekyroWebhookErrorCode, ServiceId, SessionOutcome, SessionPersonInput, SubjectReuseMode, VerificationAssurance, VerificationLevel, VerificationUnit, type VerifiedResult, type VerifyResultTokenOptions, type VerifyWebhookOptions, WebhookEnvelope, isFlowError, personFromNationalRegistry, signatureFromHeaders, verifyResultToken, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ServiceId, b as
|
|
2
|
-
export {
|
|
1
|
+
import { a as ServiceId, b as SessionPersonInput, c as WebhookEnvelope, R as ReviewReason, d as SekyroEnvironment, V as VerificationLevel, e as VerificationAssurance, f as SessionOutcome, g as VerificationUnit, h as SubjectReuseMode, i as ResultRisk, j as ResultCheckProofs, k as ResultDuplicate, A as AgeMethod, l as FailureIdentification, F as FetchLike } from './client-sqMIpSkm.js';
|
|
2
|
+
export { m as AgeResult, n as AmlMatchFlaggedEventData, o as ApiKeyIdentity, B as Block, p as BlockCheck, q as BlockCheckInput, r as BlockDuration, s as BlockIdNumber, t as BlockKind, u as BlockReason, v as BlocksApi, w as CameraUnavailableCause, x as CheckState, y as CheckType, z as ConnectorIdentity, D as CreateBlockInput, E as CreateSessionInput, C as CreatedSession, G as DEFAULT_BASE_URL, H as DEFAULT_TIMEOUT_MS, I as DecidedBy, J as DecisionReason, K as DeepPartial, M as DeletedPerson, N as DeliverOptions, O as Device, P as DevicesApi, Q as DocumentSubstitutionSettings, T as EidResult, U as EligibilityReason, X as ExtendLinkInput, Y as FlowOverridableSettings, Z as FlowOverrides, _ as FlowServiceSettings, $ as FlowSummary, a0 as FlowsApi, a1 as IdNumberReason, a2 as Identity, a3 as IdentityBirthPlace, a4 as IdentityDocument, a5 as IdentityIdNumber, a6 as IdentityMethod, a7 as IdentityName, a8 as IdentityScalarKey, a9 as IdentitySource, aa as IdentitySources, ab as LevelTarget, ac as LiftBlockInput, ad as ListBlocksQuery, ae as ListPeopleQuery, af as ListScreeningsQuery, ag as ListSessionsQuery, L as Locale, ah as MatchReason, ai as MediaBytes, aj as MediaBytesOptions, ak as MediaItem, al as MediaKind, am as MediaList, an as NameForm, ao as Page, ap as PeopleApi, aq as Person, ar as PersonBirthPlaceInput, as as PersonDeletedEventData, at as PersonDocumentInput, au as PersonEnrolledEventData, av as PersonSession, aw as PersonSessionInput, ax as PersonSessionTarget, ay as PersonSuspiciousActivityEventData, az as PersonUpdatedEventData, aA as PolicyFailureReason, aB as PortraitReportEntry, aC as PriorReviewReason, aD as ProbeBindingReason, aE as ProbeQuality, aF as ProfileDocumentType, aG as RequestOptions, aH as ResultTokenResponse, aI as ReviewOutcomeReason, aJ as RevokePersonInput, aK as ScreenPersonInput, aL as Screening, aM as ScreeningHit, aN as ScreeningHitSummary, aO as ScreeningList, aP as ScreeningStatus, aQ as ScreeningTrigger, aR as ScreeningUnavailableReason, S as Sekyro, aS as SekyroOptions, aT as Session, aU as SessionDevice, aV as SessionDeviceSignal, aW as SessionFailureReason, aX as SessionFlowRef, aY as SessionLifecycleEventData, aZ as SessionLinkDelivery, a_ as SessionLinkExpiry, a$ as SessionLinkInput, b0 as SessionNetwork, b1 as SessionNetworkEvent, b2 as SessionScreening, b3 as SessionStatus, b4 as SessionStep, b5 as SessionStepDecision, b6 as SessionSupersededEventData, b7 as SessionsApi, b8 as SimulateSessionInput, b9 as SubjectAssurance, ba as SubjectIdNumber, bb as SubjectName, bc as SubjectReferenceSource, bd as SubjectReuseTarget, be as SubjectStatus, bf as UsageThresholdReachedEventData, bg as VerifiedContacts, bh as WebhookEnvelopeOf, bi as WebhookEventDataMap, W as WebhookEventType } from './client-sqMIpSkm.js';
|
|
3
3
|
|
|
4
4
|
/** Why {@link verifyWebhook} rejected a delivery. @public */
|
|
5
5
|
type SekyroWebhookErrorCode = "invalid_signature" | "stale" | "malformed";
|
|
@@ -21,12 +21,13 @@ declare class SekyroWebhookError extends Error {
|
|
|
21
21
|
* - `wrong_audience`: issued for another app;
|
|
22
22
|
* - `wrong_issuer`: not issued by the expected issuer;
|
|
23
23
|
* - `wrong_env`: a sandbox token when you asked for live, or the reverse;
|
|
24
|
+
* - `env_required`: `env` is missing or is not `"live"` or `"sandbox"`;
|
|
24
25
|
* - `key_env_mismatch`: the environment claim does not match the key that signed it;
|
|
25
26
|
* - `jwks_unavailable`: the public key set could not be fetched;
|
|
26
27
|
* - `invalid_options`: a missing `appId` or an unsafe `jwksUrl`.
|
|
27
28
|
* @public
|
|
28
29
|
*/
|
|
29
|
-
type SekyroResultTokenErrorCode = "invalid_token" | "expired" | "wrong_audience" | "wrong_issuer" | "wrong_env" | "key_env_mismatch" | "jwks_unavailable" | "invalid_options";
|
|
30
|
+
type SekyroResultTokenErrorCode = "invalid_token" | "expired" | "wrong_audience" | "wrong_issuer" | "wrong_env" | "env_required" | "key_env_mismatch" | "jwks_unavailable" | "invalid_options";
|
|
30
31
|
/**
|
|
31
32
|
* Thrown by {@link verifyResultToken}. Do not use the token's content.
|
|
32
33
|
* @public
|
|
@@ -37,9 +38,10 @@ declare class SekyroResultTokenError extends Error {
|
|
|
37
38
|
constructor(code: SekyroResultTokenErrorCode, message?: string, cause?: unknown);
|
|
38
39
|
}
|
|
39
40
|
/** Why the {@link Sekyro} constructor rejected its options. @public */
|
|
40
|
-
type SekyroConfigErrorCode = "missing_api_key" | "invalid_base_url" | "invalid_registry_record";
|
|
41
|
+
type SekyroConfigErrorCode = "missing_api_key" | "invalid_base_url" | "invalid_registry_record" | "registry_country_unsupported" | "registry_nationality_unmapped";
|
|
41
42
|
/**
|
|
42
|
-
* Thrown synchronously by `new Sekyro(...)` for an unusable configuration
|
|
43
|
+
* Thrown synchronously by `new Sekyro(...)` for an unusable configuration, and by
|
|
44
|
+
* {@link personFromNationalRegistry} for an unusable registry answer:
|
|
43
45
|
* before any request is made. Extends `TypeError` so existing
|
|
44
46
|
* `instanceof TypeError` guards keep working.
|
|
45
47
|
* @public
|
|
@@ -60,7 +62,7 @@ declare class SekyroConfigError extends TypeError {
|
|
|
60
62
|
* result that is not a valid flow;
|
|
61
63
|
* - `override_widens_flow` (403): the override makes the flow less strict
|
|
62
64
|
* (e.g. a service turned `'off'`) and the flow does not allow widening;
|
|
63
|
-
* - `reuse_disabled` (409): `
|
|
65
|
+
* - `reuse_disabled` (409): `person.reuse` on a flow whose returning-user
|
|
64
66
|
* sessions are turned off.
|
|
65
67
|
*
|
|
66
68
|
* On `sessions.selectMethod` (a flow session's identity-method choice):
|
|
@@ -82,7 +84,7 @@ interface FlowErrorIssue {
|
|
|
82
84
|
code: string;
|
|
83
85
|
/** A short plain English sentence. */
|
|
84
86
|
message: string;
|
|
85
|
-
/** The field of your request body, e.g. `overrides.services.liveness.attempts`, `flow`, `
|
|
87
|
+
/** The field of your request body, e.g. `overrides.services.liveness.attempts`, `flow`, `person.reuse`. */
|
|
86
88
|
path?: string;
|
|
87
89
|
/** A node of your app's flow. */
|
|
88
90
|
nodeId?: string;
|
|
@@ -136,6 +138,22 @@ type SekyroFlowError<C extends SekyroFlowErrorCode = SekyroFlowErrorCode> = C ex
|
|
|
136
138
|
* @public
|
|
137
139
|
*/
|
|
138
140
|
type SekyroApiErrorCode = SekyroClientErrorCode | SekyroFlowErrorCode | (string & {});
|
|
141
|
+
/**
|
|
142
|
+
* One field the API refused, from `details.fieldErrors` of a
|
|
143
|
+
* `validation_error`. Never carries a value you sent.
|
|
144
|
+
* @public
|
|
145
|
+
*/
|
|
146
|
+
interface SekyroFieldError {
|
|
147
|
+
/**
|
|
148
|
+
* Dotted path in your request body, e.g. `person.phone`. For `unknown_field`:
|
|
149
|
+
* the object that holds the key (`?` for the top level); the key is not repeated.
|
|
150
|
+
*/
|
|
151
|
+
field: string;
|
|
152
|
+
/** The validator's issue type, e.g. `picklist` or `min_length`, or `unknown_field` for a key the API does not accept. */
|
|
153
|
+
code: string;
|
|
154
|
+
/** What the schema accepts, for a picklist or a literal, e.g. `"ar" | "fr" | "en"`. */
|
|
155
|
+
expected?: string;
|
|
156
|
+
}
|
|
139
157
|
/** Constructor input of {@link SekyroApiError}. @public */
|
|
140
158
|
interface SekyroApiErrorInit {
|
|
141
159
|
/** HTTP status; `0` when no response was received (network / timeout). */
|
|
@@ -143,19 +161,21 @@ interface SekyroApiErrorInit {
|
|
|
143
161
|
/** API error code, or `network` | `timeout` | `http_error` | `malformed_response`. */
|
|
144
162
|
code: SekyroApiErrorCode;
|
|
145
163
|
message: string;
|
|
146
|
-
/** The API's `
|
|
164
|
+
/** The API's `requestId`, when the response carried one. */
|
|
147
165
|
requestId?: string;
|
|
148
166
|
/** The API's `error.details`, when the response carried them (the flow codes: {@link SekyroFlowErrorDetailsMap}). */
|
|
149
167
|
details?: unknown;
|
|
150
168
|
/** Underlying error (network failures, abort reasons, JSON parse errors). */
|
|
151
169
|
cause?: unknown;
|
|
170
|
+
/** Seconds to wait before retrying, from the response's `Retry-After` header. */
|
|
171
|
+
retryAfterSeconds?: number;
|
|
152
172
|
}
|
|
153
173
|
/** Error codes the SDK itself produces (as opposed to codes from the API). @public */
|
|
154
174
|
type SekyroClientErrorCode = "network" | "timeout" | "http_error" | "malformed_response";
|
|
155
175
|
/**
|
|
156
176
|
* Any failed call through {@link Sekyro}: a non-2xx partner envelope
|
|
157
|
-
* `{
|
|
158
|
-
* response, a network failure or a timeout.
|
|
177
|
+
* `{ success: false, error: { code, message, requestId, details? } }`, a
|
|
178
|
+
* non-JSON response, a network failure or a timeout.
|
|
159
179
|
*
|
|
160
180
|
* `retryable` is `true` for `network`, `timeout`, HTTP 429, HTTP 5xx and the
|
|
161
181
|
* `idempotency_in_progress` code — retry with the SAME idempotency key.
|
|
@@ -172,7 +192,18 @@ declare class SekyroApiError extends Error {
|
|
|
172
192
|
* code's documented shape ({@link SekyroFlowErrorDetailsMap}).
|
|
173
193
|
*/
|
|
174
194
|
readonly details: unknown;
|
|
195
|
+
/**
|
|
196
|
+
* The fields a `validation_error` refused, from `details.fieldErrors`;
|
|
197
|
+
* `undefined` when the response names none.
|
|
198
|
+
*/
|
|
199
|
+
readonly fieldErrors: SekyroFieldError[] | undefined;
|
|
175
200
|
readonly retryable: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Seconds to wait before retrying, from the response's `Retry-After` header
|
|
203
|
+
* (a number of seconds, or an HTTP date rounded up to whole seconds from now).
|
|
204
|
+
* `undefined` when the response had no usable header.
|
|
205
|
+
*/
|
|
206
|
+
readonly retryAfterSeconds: number | undefined;
|
|
176
207
|
constructor(init: SekyroApiErrorInit);
|
|
177
208
|
}
|
|
178
209
|
/**
|
|
@@ -221,33 +252,59 @@ interface AnrptsPersonneResponse {
|
|
|
221
252
|
datePhoto?: string | undefined;
|
|
222
253
|
[key: string]: unknown;
|
|
223
254
|
}
|
|
224
|
-
/**
|
|
225
|
-
|
|
255
|
+
/**
|
|
256
|
+
* Registry answer formats Sekyro AI can map, by ISO 3166-1 alpha-2 country.
|
|
257
|
+
* @public
|
|
258
|
+
*/
|
|
259
|
+
interface NationalRegistryResponses {
|
|
260
|
+
/** Mauritania: the ANRPTS `getPersonne` answer `{ personne, photo, datePhoto? }`. */
|
|
261
|
+
MR: AnrptsPersonneResponse;
|
|
262
|
+
}
|
|
263
|
+
/** A country {@link personFromNationalRegistry} can map. @public */
|
|
264
|
+
type NationalRegistryCountry = keyof NationalRegistryResponses;
|
|
265
|
+
/** Options of {@link personFromNationalRegistry}. @public */
|
|
266
|
+
interface PersonFromRegistryOptions {
|
|
226
267
|
/**
|
|
227
|
-
* When YOUR system received this
|
|
268
|
+
* When YOUR system received this answer (not "now" when you map a cached
|
|
228
269
|
* answer). Required: records older than 24 h are refused at session create.
|
|
229
270
|
*/
|
|
230
271
|
fetchedAt: Date | string;
|
|
272
|
+
/**
|
|
273
|
+
* The person's nationality (ISO 3166-1 alpha-2) when you map the registry's
|
|
274
|
+
* nationality text yourself; it replaces the SDK's mapping. Needed when the answer
|
|
275
|
+
* states a nationality the SDK cannot map (`registry_nationality_unmapped`).
|
|
276
|
+
*/
|
|
277
|
+
nationality?: string;
|
|
231
278
|
}
|
|
232
279
|
/**
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
|
|
237
|
-
|
|
280
|
+
* The `person` keys of a reference record, ready to spread into
|
|
281
|
+
* `sessions.create({ person })`.
|
|
282
|
+
* @public
|
|
283
|
+
*/
|
|
284
|
+
type PersonRecord = Required<Pick<SessionPersonInput, "idNumber" | "birthDate" | "photo" | "fetchedAt">> & Pick<SessionPersonInput, "fullName" | "names" | "birthPlace" | "sex" | "nationalities" | "photoDate">;
|
|
285
|
+
/**
|
|
286
|
+
* Convert a national registry answer that YOUR server already received, with
|
|
287
|
+
* your own access, into the `person` reference keys of `sessions.create`. A
|
|
288
|
+
* pure, local mapping: it makes no network call, and Sekyro AI never sees,
|
|
289
|
+
* receives or stores any registry key, only the record and photo you pass.
|
|
238
290
|
*
|
|
239
291
|
* ```ts
|
|
240
|
-
* const
|
|
241
|
-
*
|
|
242
|
-
*
|
|
292
|
+
* const answer = await myRegistryClient.lookup(number); // your call, your key
|
|
293
|
+
* await sekyro.sessions.create({
|
|
294
|
+
* person: { externalRef, ...personFromNationalRegistry("MR", answer, { fetchedAt: receivedAt }) },
|
|
295
|
+
* });
|
|
243
296
|
* ```
|
|
244
297
|
*
|
|
245
|
-
* Throws {@link SekyroConfigError}
|
|
246
|
-
* field (
|
|
247
|
-
* missing
|
|
298
|
+
* Throws {@link SekyroConfigError}: `invalid_registry_record` when a required
|
|
299
|
+
* field (the number, a given and family name in at least one script, the birth
|
|
300
|
+
* date, the photo) is missing or `fetchedAt` is not a date (the message names
|
|
301
|
+
* the field, never its value); `registry_country_unsupported` for a country
|
|
302
|
+
* without an adapter; `registry_nationality_unmapped` when the answer states a
|
|
303
|
+
* nationality and none of its values maps to an ISO code (map it yourself and pass
|
|
304
|
+
* `options.nationality`; the message never carries the value).
|
|
248
305
|
* @public
|
|
249
306
|
*/
|
|
250
|
-
declare function
|
|
307
|
+
declare function personFromNationalRegistry<C extends NationalRegistryCountry>(country: C, response: NationalRegistryResponses[C], options: PersonFromRegistryOptions): PersonRecord;
|
|
251
308
|
|
|
252
309
|
/**
|
|
253
310
|
* The HTTP header carrying the webhook signature:
|
|
@@ -321,10 +378,12 @@ interface VerifyResultTokenOptions {
|
|
|
321
378
|
/** Key set URL. Default `${issuer}/.well-known/sekyro/jwks.json`. Must be `https:` (plain `http:` only on a loopback host). */
|
|
322
379
|
jwksUrl?: string;
|
|
323
380
|
/**
|
|
324
|
-
* The environment you accept
|
|
325
|
-
*
|
|
381
|
+
* The environment you accept, required: `"live"` or `"sandbox"`. A sandbox
|
|
382
|
+
* token is refused when you ask for `live` (`wrong_env`), and the reverse.
|
|
383
|
+
* Read it from your configuration, so a Sandbox token can never pass in
|
|
384
|
+
* production. A missing or other value throws `env_required`.
|
|
326
385
|
*/
|
|
327
|
-
env
|
|
386
|
+
env: SekyroEnvironment;
|
|
328
387
|
/** Custom `fetch` for the key set (tests, proxies). Default `globalThis.fetch`. */
|
|
329
388
|
fetch?: FetchLike;
|
|
330
389
|
/** Clock returning epoch milliseconds. Default `Date.now`. */
|
|
@@ -332,6 +391,24 @@ interface VerifyResultTokenOptions {
|
|
|
332
391
|
/** Allowed clock skew in seconds for `exp` / `iat`. Default 30. */
|
|
333
392
|
clockToleranceSec?: number;
|
|
334
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* The `sekyro.decision` claim, in camelCase: the human decision that settled
|
|
396
|
+
* the session (the face match's when a person decided it, else the first step
|
|
397
|
+
* a person decided). Counts and enums only, never a reviewer or a vote.
|
|
398
|
+
* @public
|
|
399
|
+
*/
|
|
400
|
+
interface ResultDecision {
|
|
401
|
+
source: "review" | "prior_review";
|
|
402
|
+
mode: "single" | "dual";
|
|
403
|
+
votes: 1 | 2 | 3;
|
|
404
|
+
/** Dual review only: whether the first two reviewers agreed. */
|
|
405
|
+
agreement?: boolean;
|
|
406
|
+
reasons: ReviewReason[];
|
|
407
|
+
/** ISO 8601. */
|
|
408
|
+
decidedAt: string;
|
|
409
|
+
/** `prior_review` only: your earlier session whose review decided this one. */
|
|
410
|
+
sessionId?: string;
|
|
411
|
+
}
|
|
335
412
|
/**
|
|
336
413
|
* The verified content of a result token, in camelCase.
|
|
337
414
|
* @public
|
|
@@ -341,9 +418,18 @@ interface VerifiedResult {
|
|
|
341
418
|
orgId: string;
|
|
342
419
|
/** The app id the token was issued for (its `aud`), one of {@link VerifyResultTokenOptions.appId}. */
|
|
343
420
|
appId: string;
|
|
344
|
-
/**
|
|
421
|
+
/**
|
|
422
|
+
* The person the session is linked to, `per_` prefixed (as `personId` on the
|
|
423
|
+
* session and on `GET /people`), once that person has passed a verification
|
|
424
|
+
* (absent before that). The token's `sub` holds the same id, bare.
|
|
425
|
+
*/
|
|
426
|
+
personId?: string;
|
|
427
|
+
/**
|
|
428
|
+
* The same person, bare (the token's `sub`).
|
|
429
|
+
* @deprecated Read {@link VerifiedResult.personId}.
|
|
430
|
+
*/
|
|
345
431
|
subjectId?: string;
|
|
346
|
-
/** Your own id for the person, from `
|
|
432
|
+
/** Your own id for the person, from `person.externalRef` at create. */
|
|
347
433
|
externalRef?: string;
|
|
348
434
|
env: SekyroEnvironment;
|
|
349
435
|
level: VerificationLevel | null;
|
|
@@ -371,6 +457,14 @@ interface VerifiedResult {
|
|
|
371
457
|
over: number;
|
|
372
458
|
method: AgeMethod;
|
|
373
459
|
};
|
|
460
|
+
/** The `sekyro.decision` claim, when a person decided a step of the session. */
|
|
461
|
+
decision?: ResultDecision;
|
|
462
|
+
/**
|
|
463
|
+
* The `sekyro.failure_identification` claim, when the setting is on and the
|
|
464
|
+
* search found a match. A signal, never a decision; `other_identity` is
|
|
465
|
+
* informational only (see {@link FailureIdentification}).
|
|
466
|
+
*/
|
|
467
|
+
failureIdentification?: FailureIdentification;
|
|
374
468
|
}
|
|
375
469
|
/**
|
|
376
470
|
* Verify a Sekyro AI result token (the `resultToken` of a terminal webhook,
|
|
@@ -379,14 +473,18 @@ interface VerifiedResult {
|
|
|
379
473
|
* Checks the ES256 signature against the public key set (fetched from
|
|
380
474
|
* `${issuer}/.well-known/sekyro/jwks.json` and cached for 10 minutes; an
|
|
381
475
|
* unknown key id fetches it again), the issuer, the audience (your app id),
|
|
382
|
-
* the expiry,
|
|
383
|
-
* (sandbox keys have ids
|
|
384
|
-
* {@link SekyroResultTokenError} otherwise; never
|
|
385
|
-
* before this resolves.
|
|
476
|
+
* the expiry, that the token is for the `env` you pass, and that its
|
|
477
|
+
* environment claim matches the key that signed it (sandbox keys have ids
|
|
478
|
+
* starting `sbx-`). Throws {@link SekyroResultTokenError} otherwise; never
|
|
479
|
+
* trust the token's content before this resolves.
|
|
386
480
|
*
|
|
387
481
|
* @example
|
|
388
482
|
* ```ts
|
|
389
|
-
*
|
|
483
|
+
* // SEKYRO_ENV is "sandbox" until go-live, then "live".
|
|
484
|
+
* const result = await verifyResultToken(token, {
|
|
485
|
+
* appId: process.env.SEKYRO_APP_ID!,
|
|
486
|
+
* env: process.env.SEKYRO_ENV as "live" | "sandbox",
|
|
487
|
+
* });
|
|
390
488
|
* if (result.outcome === "approved" && (result.level ?? 0) >= 1) {
|
|
391
489
|
* // a verified real person
|
|
392
490
|
* }
|
|
@@ -395,4 +493,4 @@ interface VerifiedResult {
|
|
|
395
493
|
*/
|
|
396
494
|
declare function verifyResultToken(token: string, opts: VerifyResultTokenOptions): Promise<VerifiedResult>;
|
|
397
495
|
|
|
398
|
-
export { AgeMethod, type AnrptsPersonneResponse, DEFAULT_RESULT_TOKEN_ISSUER, FetchLike, type FlowErrorDetails, type FlowErrorIssue, type FlowRefErrorDetails, type FlowWidensErrorDetails, LEGACY_SIGNATURE_HEADER,
|
|
496
|
+
export { AgeMethod, type AnrptsPersonneResponse, DEFAULT_RESULT_TOKEN_ISSUER, FailureIdentification, FetchLike, type FlowErrorDetails, type FlowErrorIssue, type FlowRefErrorDetails, type FlowWidensErrorDetails, LEGACY_SIGNATURE_HEADER, type NationalRegistryCountry, type NationalRegistryResponses, type PersonFromRegistryOptions, type PersonRecord, RESULT_TOKEN_JWKS_PATH, ResultCheckProofs, type ResultDecision, ResultDuplicate, ResultRisk, ReviewReason, SEKYRO_SIGNATURE_HEADER, SekyroApiError, type SekyroApiErrorCode, type SekyroApiErrorInit, type SekyroClientErrorCode, SekyroConfigError, type SekyroConfigErrorCode, SekyroEnvironment, type SekyroFieldError, type SekyroFlowError, type SekyroFlowErrorCode, type SekyroFlowErrorDetailsMap, SekyroResultTokenError, type SekyroResultTokenErrorCode, SekyroWebhookError, type SekyroWebhookErrorCode, ServiceId, SessionOutcome, SessionPersonInput, SubjectReuseMode, VerificationAssurance, VerificationLevel, VerificationUnit, type VerifiedResult, type VerifyResultTokenOptions, type VerifyWebhookOptions, WebhookEnvelope, isFlowError, personFromNationalRegistry, signatureFromHeaders, verifyResultToken, verifyWebhook };
|