@kyciris/core 1.0.0 → 1.1.1

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/README.md CHANGED
@@ -114,7 +114,7 @@ This is the part worth getting right.
114
114
  | Scope | The whole project — every identity in it | One end user's verification |
115
115
  | Lives | On your server | In the app or page |
116
116
  | Header | `X-API-Key` | `x-verification-token` |
117
- | Lifetime | Until revoked | 8h by default; the gateway decides |
117
+ | Lifetime | Until revoked | 10m by default; the gateway decides |
118
118
 
119
119
  Constructing a client with `apiKey` inside a browser or React Native app
120
120
  **throws** (`CREDENTIAL_MISUSE`). A key in a shipped bundle is a key the end
package/dist/index.d.mts CHANGED
@@ -343,6 +343,66 @@ interface OcrData {
343
343
  maritalStatus?: string | null;
344
344
  [field: string]: unknown;
345
345
  }
346
+ /**
347
+ * What an applicant still owes, and the verdict about the person.
348
+ *
349
+ * A level may require more than one document, which makes "this document is
350
+ * approved" and "this person is verified" different statements. Only the second
351
+ * one is what an integration actually wants to act on.
352
+ */
353
+ type ApplicantAnswer = 'GREEN' | 'RED';
354
+ /**
355
+ * Whether presenting the document again could change the answer.
356
+ *
357
+ * `RETRY` is a bad photo, or a failure on the gateway's side -- ask the user to
358
+ * try again. `FINAL` is a decision the rules would reach again, so asking them
359
+ * to retry only wastes their time.
360
+ */
361
+ type ApplicantRejectType = 'RETRY' | 'FINAL';
362
+ type RequirementStatus = 'APPROVED' | 'REVIEW' | 'REJECTED' | 'PENDING';
363
+ interface ApplicantRequirement {
364
+ /** One of the document types the level asks for. */
365
+ documentType: string;
366
+ status: RequirementStatus;
367
+ /** The verification that settled it, when one has. */
368
+ verificationId: string | null;
369
+ rejectionType: string | null;
370
+ }
371
+ interface ApplicantStatus {
372
+ identityId: string;
373
+ externalId: string;
374
+ /** Decides which of the level's document lists applies. */
375
+ country: string | null;
376
+ levelName: string;
377
+ /** Every required document approved. */
378
+ complete: boolean;
379
+ /** Null while nothing has been decided, which must not read as a refusal. */
380
+ answer: ApplicantAnswer | null;
381
+ rejectType: ApplicantRejectType | null;
382
+ rejectLabels: string[];
383
+ requirements: ApplicantRequirement[];
384
+ /** Document types with nothing approved yet: what to ask the user for next. */
385
+ outstanding: string[];
386
+ selfie: {
387
+ required: boolean;
388
+ /** Captured once per applicant and reused for every document. */
389
+ captured: boolean;
390
+ capturedAt: string | null;
391
+ };
392
+ }
393
+ interface GetApplicantParams {
394
+ /**
395
+ * The applicant's id in your own system. Required when the client holds an
396
+ * API key; ignored when it holds a verification token, which already names
397
+ * one end-user.
398
+ */
399
+ externalId?: string;
400
+ /**
401
+ * Only needed before the applicant's first verification exists, when there is
402
+ * no level to read from their history.
403
+ */
404
+ levelName?: string;
405
+ }
346
406
  interface VerificationStatusResponse {
347
407
  verificationId: string;
348
408
  status: VerificationStatus;
@@ -1018,6 +1078,20 @@ declare class VerificationsResource {
1018
1078
  getStatus(verificationId: string, options?: {
1019
1079
  signal?: AbortSignal;
1020
1080
  }): Promise<VerificationStatusResponse>;
1081
+ /**
1082
+ * What the applicant still owes, and the verdict about the person.
1083
+ *
1084
+ * `getStatus` answers for one document. On a level asking for two, its
1085
+ * APPROVED is not the answer an integration wants -- the applicant may still
1086
+ * owe the other. This is the call that says which, through `outstanding`.
1087
+ *
1088
+ * Works with a verification token, which reports that token's own end-user
1089
+ * and ignores `externalId`, so an app needs no API key to drive a multi-
1090
+ * document flow.
1091
+ */
1092
+ applicant(params?: GetApplicantParams, options?: {
1093
+ signal?: AbortSignal;
1094
+ }): Promise<ApplicantStatus>;
1021
1095
  /**
1022
1096
  * Which files exist for a verification.
1023
1097
  *
@@ -1449,4 +1523,4 @@ declare class VerificationFlow {
1449
1523
  private patch;
1450
1524
  }
1451
1525
 
1452
- export { ALL_WEBHOOK_EVENTS, type Analytics, AnalyticsResource, type AnalyticsSeries, type ApiMeta, type ApiResult, type AuthMode, type AvailableMedia, type CatalogCountry, type CreateLevelParams, type CreateWebhookParams, DOCUMENT_CATALOG, DUPLICATE_FIELDS, type DocumentCatalogEntry, type DocumentSide, type DocumentType, type DownloadToken, type DuplicateField, type DuplicateGroup, type DuplicatesByField, type DuplicatesByFields, type FaceCheck, type FetchLike, type FileInput, type FlowOptions, type FlowPhase, type FlowState, GATEWAY_ERROR_CODES, type GatewayErrorCode, HttpClient, type HttpClientConfig, IdentitiesResource, type Identity, type IdentityDocumentStep, type IdentityFields, type IdentitySummary, type ImageMimeType, KycirisClient, type KycirisClientConfig, KycirisError, type KycirisErrorCode, type KycirisErrorInit, type KycirisStorage, LevelsResource, type ListIdentitiesParams, type ListVerificationsParams, MAX_IMAGE_FILE_SIZE, type MediaResource, MediaResourceApi, type NormalizedFile, type OcrData, type OcrProcess, type OcrProcessStatus, type OcrProcessStatusResponse, OcrResource, PIPELINE_EVENT_KINDS, type Page, type PaginationMeta, type PipelineEvent, type PipelineEventKind, type PollCallbacks, type PollOptions, type ProgressOptions, type RequestOptions, type ReviewDecision, type RunOcrParams, SDK_ERROR_CODES, SESSION_STORAGE_KEY, type SdkErrorCode, type SelfieStep, SessionStore, type StartVerificationParams, type StoredSession, TERMINAL_VERIFICATION_STATUSES, type UpdateLevelParams, type UpdateWebhookParams, type UploadOptions, type UploadResult, type UploadStepParams, type UploadStepResult, VERIFICATION_OUTCOMES, VERIFICATION_STATUSES, VerificationFlow, type VerificationLevel, type VerificationLevelDefinition, type VerificationLevelStep, type VerificationListItem, type VerificationOutcome, type VerificationProgress, type VerificationSession, type VerificationStatus, type VerificationStatusResponse, type VerificationStep, type VerificationSummary, type VerificationToken, type VerificationTokenProvider, VerificationsResource, WEBHOOK_EVENT_TYPES, type WaitForResultOptions, type Webhook, type WebhookEventType, type WebhookLogEntry, type WebhookResendResult, type WebhookSubscription, WebhooksResource, createKycirisClient, createMemoryStorage, decodeBase64, detectImageMimeType, encodeBase64, isKycirisError, isNormalizedFile, isReactNative, isRetryableStatus, isSupportedDocumentPair, isTerminalStatus, isUntrustedClient, normalizeFile, pollUntil, prepareFile, supportedCountries, supportedDocumentTypes, toPage };
1526
+ export { ALL_WEBHOOK_EVENTS, type Analytics, AnalyticsResource, type AnalyticsSeries, type ApiMeta, type ApiResult, type ApplicantAnswer, type ApplicantRejectType, type ApplicantRequirement, type ApplicantStatus, type AuthMode, type AvailableMedia, type CatalogCountry, type CreateLevelParams, type CreateWebhookParams, DOCUMENT_CATALOG, DUPLICATE_FIELDS, type DocumentCatalogEntry, type DocumentSide, type DocumentType, type DownloadToken, type DuplicateField, type DuplicateGroup, type DuplicatesByField, type DuplicatesByFields, type FaceCheck, type FetchLike, type FileInput, type FlowOptions, type FlowPhase, type FlowState, GATEWAY_ERROR_CODES, type GatewayErrorCode, type GetApplicantParams, HttpClient, type HttpClientConfig, IdentitiesResource, type Identity, type IdentityDocumentStep, type IdentityFields, type IdentitySummary, type ImageMimeType, KycirisClient, type KycirisClientConfig, KycirisError, type KycirisErrorCode, type KycirisErrorInit, type KycirisStorage, LevelsResource, type ListIdentitiesParams, type ListVerificationsParams, MAX_IMAGE_FILE_SIZE, type MediaResource, MediaResourceApi, type NormalizedFile, type OcrData, type OcrProcess, type OcrProcessStatus, type OcrProcessStatusResponse, OcrResource, PIPELINE_EVENT_KINDS, type Page, type PaginationMeta, type PipelineEvent, type PipelineEventKind, type PollCallbacks, type PollOptions, type ProgressOptions, type RequestOptions, type RequirementStatus, type ReviewDecision, type RunOcrParams, SDK_ERROR_CODES, SESSION_STORAGE_KEY, type SdkErrorCode, type SelfieStep, SessionStore, type StartVerificationParams, type StoredSession, TERMINAL_VERIFICATION_STATUSES, type UpdateLevelParams, type UpdateWebhookParams, type UploadOptions, type UploadResult, type UploadStepParams, type UploadStepResult, VERIFICATION_OUTCOMES, VERIFICATION_STATUSES, VerificationFlow, type VerificationLevel, type VerificationLevelDefinition, type VerificationLevelStep, type VerificationListItem, type VerificationOutcome, type VerificationProgress, type VerificationSession, type VerificationStatus, type VerificationStatusResponse, type VerificationStep, type VerificationSummary, type VerificationToken, type VerificationTokenProvider, VerificationsResource, WEBHOOK_EVENT_TYPES, type WaitForResultOptions, type Webhook, type WebhookEventType, type WebhookLogEntry, type WebhookResendResult, type WebhookSubscription, WebhooksResource, createKycirisClient, createMemoryStorage, decodeBase64, detectImageMimeType, encodeBase64, isKycirisError, isNormalizedFile, isReactNative, isRetryableStatus, isSupportedDocumentPair, isTerminalStatus, isUntrustedClient, normalizeFile, pollUntil, prepareFile, supportedCountries, supportedDocumentTypes, toPage };
package/dist/index.d.ts CHANGED
@@ -343,6 +343,66 @@ interface OcrData {
343
343
  maritalStatus?: string | null;
344
344
  [field: string]: unknown;
345
345
  }
346
+ /**
347
+ * What an applicant still owes, and the verdict about the person.
348
+ *
349
+ * A level may require more than one document, which makes "this document is
350
+ * approved" and "this person is verified" different statements. Only the second
351
+ * one is what an integration actually wants to act on.
352
+ */
353
+ type ApplicantAnswer = 'GREEN' | 'RED';
354
+ /**
355
+ * Whether presenting the document again could change the answer.
356
+ *
357
+ * `RETRY` is a bad photo, or a failure on the gateway's side -- ask the user to
358
+ * try again. `FINAL` is a decision the rules would reach again, so asking them
359
+ * to retry only wastes their time.
360
+ */
361
+ type ApplicantRejectType = 'RETRY' | 'FINAL';
362
+ type RequirementStatus = 'APPROVED' | 'REVIEW' | 'REJECTED' | 'PENDING';
363
+ interface ApplicantRequirement {
364
+ /** One of the document types the level asks for. */
365
+ documentType: string;
366
+ status: RequirementStatus;
367
+ /** The verification that settled it, when one has. */
368
+ verificationId: string | null;
369
+ rejectionType: string | null;
370
+ }
371
+ interface ApplicantStatus {
372
+ identityId: string;
373
+ externalId: string;
374
+ /** Decides which of the level's document lists applies. */
375
+ country: string | null;
376
+ levelName: string;
377
+ /** Every required document approved. */
378
+ complete: boolean;
379
+ /** Null while nothing has been decided, which must not read as a refusal. */
380
+ answer: ApplicantAnswer | null;
381
+ rejectType: ApplicantRejectType | null;
382
+ rejectLabels: string[];
383
+ requirements: ApplicantRequirement[];
384
+ /** Document types with nothing approved yet: what to ask the user for next. */
385
+ outstanding: string[];
386
+ selfie: {
387
+ required: boolean;
388
+ /** Captured once per applicant and reused for every document. */
389
+ captured: boolean;
390
+ capturedAt: string | null;
391
+ };
392
+ }
393
+ interface GetApplicantParams {
394
+ /**
395
+ * The applicant's id in your own system. Required when the client holds an
396
+ * API key; ignored when it holds a verification token, which already names
397
+ * one end-user.
398
+ */
399
+ externalId?: string;
400
+ /**
401
+ * Only needed before the applicant's first verification exists, when there is
402
+ * no level to read from their history.
403
+ */
404
+ levelName?: string;
405
+ }
346
406
  interface VerificationStatusResponse {
347
407
  verificationId: string;
348
408
  status: VerificationStatus;
@@ -1018,6 +1078,20 @@ declare class VerificationsResource {
1018
1078
  getStatus(verificationId: string, options?: {
1019
1079
  signal?: AbortSignal;
1020
1080
  }): Promise<VerificationStatusResponse>;
1081
+ /**
1082
+ * What the applicant still owes, and the verdict about the person.
1083
+ *
1084
+ * `getStatus` answers for one document. On a level asking for two, its
1085
+ * APPROVED is not the answer an integration wants -- the applicant may still
1086
+ * owe the other. This is the call that says which, through `outstanding`.
1087
+ *
1088
+ * Works with a verification token, which reports that token's own end-user
1089
+ * and ignores `externalId`, so an app needs no API key to drive a multi-
1090
+ * document flow.
1091
+ */
1092
+ applicant(params?: GetApplicantParams, options?: {
1093
+ signal?: AbortSignal;
1094
+ }): Promise<ApplicantStatus>;
1021
1095
  /**
1022
1096
  * Which files exist for a verification.
1023
1097
  *
@@ -1449,4 +1523,4 @@ declare class VerificationFlow {
1449
1523
  private patch;
1450
1524
  }
1451
1525
 
1452
- export { ALL_WEBHOOK_EVENTS, type Analytics, AnalyticsResource, type AnalyticsSeries, type ApiMeta, type ApiResult, type AuthMode, type AvailableMedia, type CatalogCountry, type CreateLevelParams, type CreateWebhookParams, DOCUMENT_CATALOG, DUPLICATE_FIELDS, type DocumentCatalogEntry, type DocumentSide, type DocumentType, type DownloadToken, type DuplicateField, type DuplicateGroup, type DuplicatesByField, type DuplicatesByFields, type FaceCheck, type FetchLike, type FileInput, type FlowOptions, type FlowPhase, type FlowState, GATEWAY_ERROR_CODES, type GatewayErrorCode, HttpClient, type HttpClientConfig, IdentitiesResource, type Identity, type IdentityDocumentStep, type IdentityFields, type IdentitySummary, type ImageMimeType, KycirisClient, type KycirisClientConfig, KycirisError, type KycirisErrorCode, type KycirisErrorInit, type KycirisStorage, LevelsResource, type ListIdentitiesParams, type ListVerificationsParams, MAX_IMAGE_FILE_SIZE, type MediaResource, MediaResourceApi, type NormalizedFile, type OcrData, type OcrProcess, type OcrProcessStatus, type OcrProcessStatusResponse, OcrResource, PIPELINE_EVENT_KINDS, type Page, type PaginationMeta, type PipelineEvent, type PipelineEventKind, type PollCallbacks, type PollOptions, type ProgressOptions, type RequestOptions, type ReviewDecision, type RunOcrParams, SDK_ERROR_CODES, SESSION_STORAGE_KEY, type SdkErrorCode, type SelfieStep, SessionStore, type StartVerificationParams, type StoredSession, TERMINAL_VERIFICATION_STATUSES, type UpdateLevelParams, type UpdateWebhookParams, type UploadOptions, type UploadResult, type UploadStepParams, type UploadStepResult, VERIFICATION_OUTCOMES, VERIFICATION_STATUSES, VerificationFlow, type VerificationLevel, type VerificationLevelDefinition, type VerificationLevelStep, type VerificationListItem, type VerificationOutcome, type VerificationProgress, type VerificationSession, type VerificationStatus, type VerificationStatusResponse, type VerificationStep, type VerificationSummary, type VerificationToken, type VerificationTokenProvider, VerificationsResource, WEBHOOK_EVENT_TYPES, type WaitForResultOptions, type Webhook, type WebhookEventType, type WebhookLogEntry, type WebhookResendResult, type WebhookSubscription, WebhooksResource, createKycirisClient, createMemoryStorage, decodeBase64, detectImageMimeType, encodeBase64, isKycirisError, isNormalizedFile, isReactNative, isRetryableStatus, isSupportedDocumentPair, isTerminalStatus, isUntrustedClient, normalizeFile, pollUntil, prepareFile, supportedCountries, supportedDocumentTypes, toPage };
1526
+ export { ALL_WEBHOOK_EVENTS, type Analytics, AnalyticsResource, type AnalyticsSeries, type ApiMeta, type ApiResult, type ApplicantAnswer, type ApplicantRejectType, type ApplicantRequirement, type ApplicantStatus, type AuthMode, type AvailableMedia, type CatalogCountry, type CreateLevelParams, type CreateWebhookParams, DOCUMENT_CATALOG, DUPLICATE_FIELDS, type DocumentCatalogEntry, type DocumentSide, type DocumentType, type DownloadToken, type DuplicateField, type DuplicateGroup, type DuplicatesByField, type DuplicatesByFields, type FaceCheck, type FetchLike, type FileInput, type FlowOptions, type FlowPhase, type FlowState, GATEWAY_ERROR_CODES, type GatewayErrorCode, type GetApplicantParams, HttpClient, type HttpClientConfig, IdentitiesResource, type Identity, type IdentityDocumentStep, type IdentityFields, type IdentitySummary, type ImageMimeType, KycirisClient, type KycirisClientConfig, KycirisError, type KycirisErrorCode, type KycirisErrorInit, type KycirisStorage, LevelsResource, type ListIdentitiesParams, type ListVerificationsParams, MAX_IMAGE_FILE_SIZE, type MediaResource, MediaResourceApi, type NormalizedFile, type OcrData, type OcrProcess, type OcrProcessStatus, type OcrProcessStatusResponse, OcrResource, PIPELINE_EVENT_KINDS, type Page, type PaginationMeta, type PipelineEvent, type PipelineEventKind, type PollCallbacks, type PollOptions, type ProgressOptions, type RequestOptions, type RequirementStatus, type ReviewDecision, type RunOcrParams, SDK_ERROR_CODES, SESSION_STORAGE_KEY, type SdkErrorCode, type SelfieStep, SessionStore, type StartVerificationParams, type StoredSession, TERMINAL_VERIFICATION_STATUSES, type UpdateLevelParams, type UpdateWebhookParams, type UploadOptions, type UploadResult, type UploadStepParams, type UploadStepResult, VERIFICATION_OUTCOMES, VERIFICATION_STATUSES, VerificationFlow, type VerificationLevel, type VerificationLevelDefinition, type VerificationLevelStep, type VerificationListItem, type VerificationOutcome, type VerificationProgress, type VerificationSession, type VerificationStatus, type VerificationStatusResponse, type VerificationStep, type VerificationSummary, type VerificationToken, type VerificationTokenProvider, VerificationsResource, WEBHOOK_EVENT_TYPES, type WaitForResultOptions, type Webhook, type WebhookEventType, type WebhookLogEntry, type WebhookResendResult, type WebhookSubscription, WebhooksResource, createKycirisClient, createMemoryStorage, decodeBase64, detectImageMimeType, encodeBase64, isKycirisError, isNormalizedFile, isReactNative, isRetryableStatus, isSupportedDocumentPair, isTerminalStatus, isUntrustedClient, normalizeFile, pollUntil, prepareFile, supportedCountries, supportedDocumentTypes, toPage };
package/dist/index.js CHANGED
@@ -1323,6 +1323,25 @@ var VerificationsResource = class {
1323
1323
  });
1324
1324
  return result.data;
1325
1325
  }
1326
+ /**
1327
+ * What the applicant still owes, and the verdict about the person.
1328
+ *
1329
+ * `getStatus` answers for one document. On a level asking for two, its
1330
+ * APPROVED is not the answer an integration wants -- the applicant may still
1331
+ * owe the other. This is the call that says which, through `outstanding`.
1332
+ *
1333
+ * Works with a verification token, which reports that token's own end-user
1334
+ * and ignores `externalId`, so an app needs no API key to drive a multi-
1335
+ * document flow.
1336
+ */
1337
+ async applicant(params = {}, options = {}) {
1338
+ const result = await this.http.request({
1339
+ path: "/verification/applicant",
1340
+ query: { ...params },
1341
+ signal: options.signal
1342
+ });
1343
+ return result.data;
1344
+ }
1326
1345
  /**
1327
1346
  * Which files exist for a verification.
1328
1347
  *