@smileid/usesmileid-nodejs 12.0.0 → 12.1.0

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
@@ -144,6 +144,22 @@ const accepted = await smile.documents.verifyEnhanced({
144
144
  });
145
145
  ```
146
146
 
147
+ ### Residency document verification
148
+
149
+ Verifies a passport and the visa endorsed in it. `idType` is optional and defaults to `PASSPORT`, the only value the API accepts. `visa` is the visa page itself. Results take longer than document verification, so rely on the callback rather than polling. The callback adds an `additional_documents` array with the visa details.
150
+
151
+ ```ts
152
+ const accepted = await smile.documents.verifyResidency({
153
+ country: 'NG',
154
+ selfieImage: './selfie.jpg',
155
+ livenessImages: ['./live1.jpg', './live2.jpg', './live3.jpg', './live4.jpg', './live5.jpg', './live6.jpg'],
156
+ document: './passport.jpg',
157
+ visa: './visa.jpg',
158
+ userDetails,
159
+ consent,
160
+ });
161
+ ```
162
+
147
163
  ### Biometric KYC
148
164
 
149
165
  ```ts
@@ -6,7 +6,7 @@
6
6
  * clearFraud convenience wrappers.
7
7
  */
8
8
  import { type SmileIDConfig } from './config.js';
9
- import type { AcceptedResponse, AuthenticationParams, BankCodesParams, BankCodesResponse, BiometricKycParams, ClearFraudParams, CompareParams, DocumentVerificationParams, EnhancedDocumentVerificationParams, EnhancedKycParams, FlagFraudParams, IdStatusParams, IdStatusResponse, JobStatus, RegistrationParams, ReplayParams, ReportFraudParams, RequestOptions, SupportedDocumentsParams, SupportedDocumentsResponse, SupportedIdTypesParams, SupportedIdTypesResponse, WaitOptions } from '../generated/models/index.js';
9
+ import type { AcceptedResponse, AuthenticationParams, BankCodesParams, BankCodesResponse, BiometricKycParams, ClearFraudParams, CompareParams, DocumentVerificationParams, EnhancedDocumentVerificationParams, ResidencyDocumentVerificationParams, EnhancedKycParams, FlagFraudParams, IdStatusParams, IdStatusResponse, JobStatus, RegistrationParams, ReplayParams, ReportFraudParams, RequestOptions, SupportedDocumentsParams, SupportedDocumentsResponse, SupportedIdTypesParams, SupportedIdTypesResponse, WaitOptions } from '../generated/models/index.js';
10
10
  /** The Smile ID V3 server-side client. */
11
11
  export declare class SmileID {
12
12
  private readonly transport;
@@ -18,6 +18,7 @@ export declare class SmileID {
18
18
  readonly documents: {
19
19
  verify(params: DocumentVerificationParams, options?: RequestOptions): Promise<AcceptedResponse>;
20
20
  verifyEnhanced(params: EnhancedDocumentVerificationParams, options?: RequestOptions): Promise<AcceptedResponse>;
21
+ verifyResidency(params: ResidencyDocumentVerificationParams, options?: RequestOptions): Promise<AcceptedResponse>;
21
22
  };
22
23
  /** Biometric KYC (spec §6.4). */
23
24
  readonly biometricKyc: {
@@ -89,6 +89,22 @@ class SmileID {
89
89
  }
90
90
  return ops.enhancedDocumentVerification(t, params, options);
91
91
  },
92
+ verifyResidency: (params, options) => {
93
+ (0, validation_js_1.validateUserDetails)(params.userDetails);
94
+ // idType defaults to PASSPORT, the only value the API accepts; it also requires the visa image; enforced at
95
+ // runtime for plain-JavaScript callers too.
96
+ if (params.idType !== undefined && params.idType !== 'PASSPORT') {
97
+ throw new index_js_1.ValidationError({
98
+ message: 'idType must be PASSPORT for residency document verification.',
99
+ });
100
+ }
101
+ if (!params.visa) {
102
+ throw new index_js_1.ValidationError({
103
+ message: 'visa is required for residency document verification.',
104
+ });
105
+ }
106
+ return ops.residencyDocumentVerification(t, params, options);
107
+ },
92
108
  };
93
109
  this.biometricKyc = {
94
110
  verify: (params, options) => {
@@ -94,6 +94,23 @@ export interface EnhancedDocumentVerificationParams extends EntryParamsBase {
94
94
  /** Sent as the User-ID header. */
95
95
  userId?: string;
96
96
  }
97
+ /**
98
+ * documents.verifyResidency → POST /v3/residency_document_verification.
99
+ * Same as §6.3 plus the visa endorsed in the passport; idType must be PASSPORT.
100
+ */
101
+ export interface ResidencyDocumentVerificationParams extends EntryParamsBase {
102
+ selfieImage: BinaryInput;
103
+ livenessImages: BinaryInput[];
104
+ document: BinaryInput;
105
+ documentBack?: BinaryInput;
106
+ /** The visa page itself (JPEG or PNG), not the passport's biographical page. */
107
+ visa: BinaryInput;
108
+ country: string;
109
+ /** Optional; defaults to PASSPORT, the only value the API accepts. */
110
+ idType?: 'PASSPORT';
111
+ /** Sent as the User-ID header. */
112
+ userId?: string;
113
+ }
97
114
  /** biometricKyc.verify (spec §6.4). */
98
115
  export interface BiometricKycParams extends EntryParamsBase {
99
116
  selfieImage: BinaryInput;
@@ -7,10 +7,11 @@
7
7
  * field names are snake_case; the mapping boundary lives here.
8
8
  */
9
9
  import type { Transport } from '../../client/transport.js';
10
- import { AcceptedResponse, JobStatus, type AuthenticationParams, type BankCodesParams, type BankCodesResponse, type BiometricKycParams, type CompareParams, type DocumentVerificationParams, type EnhancedDocumentVerificationParams, type EnhancedKycParams, type IdStatusParams, type IdStatusResponse, type RegistrationParams, type ReportFraudParams, type RequestOptions, type SupportedDocumentsParams, type SupportedDocumentsResponse, type SupportedIdTypesParams, type SupportedIdTypesResponse } from '../models/index.js';
10
+ import { AcceptedResponse, JobStatus, type AuthenticationParams, type BankCodesParams, type BankCodesResponse, type BiometricKycParams, type CompareParams, type DocumentVerificationParams, type EnhancedDocumentVerificationParams, type ResidencyDocumentVerificationParams, type EnhancedKycParams, type IdStatusParams, type IdStatusResponse, type RegistrationParams, type ReportFraudParams, type RequestOptions, type SupportedDocumentsParams, type SupportedDocumentsResponse, type SupportedIdTypesParams, type SupportedIdTypesResponse } from '../models/index.js';
11
11
  export declare function enhancedKyc(transport: Transport, params: EnhancedKycParams, opts?: RequestOptions): Promise<AcceptedResponse>;
12
12
  export declare function documentVerification(transport: Transport, params: DocumentVerificationParams, opts?: RequestOptions): Promise<AcceptedResponse>;
13
13
  export declare function enhancedDocumentVerification(transport: Transport, params: EnhancedDocumentVerificationParams, opts?: RequestOptions): Promise<AcceptedResponse>;
14
+ export declare function residencyDocumentVerification(transport: Transport, params: ResidencyDocumentVerificationParams, opts?: RequestOptions): Promise<AcceptedResponse>;
14
15
  export declare function biometricKyc(transport: Transport, params: BiometricKycParams, opts?: RequestOptions): Promise<AcceptedResponse>;
15
16
  export declare function registration(transport: Transport, params: RegistrationParams, opts?: RequestOptions): Promise<AcceptedResponse>;
16
17
  export declare function authentication(transport: Transport, params: AuthenticationParams, opts?: RequestOptions): Promise<AcceptedResponse>;
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.enhancedKyc = enhancedKyc;
12
12
  exports.documentVerification = documentVerification;
13
13
  exports.enhancedDocumentVerification = enhancedDocumentVerification;
14
+ exports.residencyDocumentVerification = residencyDocumentVerification;
14
15
  exports.biometricKyc = biometricKyc;
15
16
  exports.registration = registration;
16
17
  exports.authentication = authentication;
@@ -214,6 +215,35 @@ async function enhancedDocumentVerification(transport, params, opts) {
214
215
  });
215
216
  return toAccepted(result.json);
216
217
  }
218
+ async function residencyDocumentVerification(transport, params, opts) {
219
+ const parts = [
220
+ ...scalar('country', params.country),
221
+ ...scalar('id_type', params.idType ?? 'PASSPORT'),
222
+ ...scalar('callback_url', effectiveCallback(params.callbackUrl, opts, transport)),
223
+ await jpegPart('selfie_image', params.selfieImage, 'selfie.jpg'),
224
+ ...(await livenessParts(params.livenessImages)),
225
+ await documentPart('document', params.document, 'document.jpg'),
226
+ ...(params.documentBack
227
+ ? [await documentPart('document_back', params.documentBack, 'document_back.jpg')]
228
+ : []),
229
+ await documentPart('visa', params.visa, 'visa.jpg'),
230
+ ...jsonPart('user_details', userDetailsJson(params.userDetails)),
231
+ ...jsonPart('consent', consentJson(params.consent)),
232
+ ...optionalJson('partner_params', params.partnerParams),
233
+ ...optionalJson('metadata', params.metadata),
234
+ ];
235
+ const result = await transport.execute({
236
+ method: 'POST',
237
+ path: '/v3/residency_document_verification',
238
+ authenticated: true,
239
+ needsPartnerIdHeader: true,
240
+ idempotent: false,
241
+ headers: { 'User-ID': params.userId },
242
+ multipart: (0, multipart_js_1.buildMultipart)(parts),
243
+ ...planExtras(opts),
244
+ });
245
+ return toAccepted(result.json);
246
+ }
217
247
  async function biometricKyc(transport, params, opts) {
218
248
  const parts = [
219
249
  ...scalar('country', params.country),
package/dist/index.d.ts CHANGED
@@ -11,6 +11,6 @@ export type { SmileIDConfig, FetchLike } from './client/config.js';
11
11
  export { Consent } from './helpers/consent.js';
12
12
  export type { ConsentGrantedArgs } from './helpers/consent.js';
13
13
  export { AcceptedResponse, JobStatus } from './generated/models/index.js';
14
- export type { Environment, BinaryInput, RequestOptions, WaitOptions, Consent as ConsentType, UserDetails, PartnerParams, MetadataItem, EnhancedKycParams, DocumentVerificationParams, EnhancedDocumentVerificationParams, BiometricKycParams, RegistrationParams, AuthenticationParams, CompareParams, ComparisonImageType, ReplayParams, FraudReason, ReportFraudParams, FlagFraudParams, ClearFraudParams, BankCodesParams, BankCodesResponse, SupportedIdTypesParams, SupportedIdTypesResponse, SupportedDocumentsParams, SupportedDocumentsResponse, IdStatusParams, IdStatusResponse, } from './generated/models/index.js';
14
+ export type { Environment, BinaryInput, RequestOptions, WaitOptions, Consent as ConsentType, UserDetails, PartnerParams, MetadataItem, EnhancedKycParams, DocumentVerificationParams, EnhancedDocumentVerificationParams, ResidencyDocumentVerificationParams, BiometricKycParams, RegistrationParams, AuthenticationParams, CompareParams, ComparisonImageType, ReplayParams, FraudReason, ReportFraudParams, FlagFraudParams, ClearFraudParams, BankCodesParams, BankCodesResponse, SupportedIdTypesParams, SupportedIdTypesResponse, SupportedDocumentsParams, SupportedDocumentsResponse, IdStatusParams, IdStatusResponse, } from './generated/models/index.js';
15
15
  export { SmileIDError, InvalidRequestError, AuthenticationError, PaymentRequiredError, PermissionError, NotFoundError, ConflictError, PayloadTooLargeError, RateLimitError, APIError, ConnectionError, UnexpectedResponseError, TimeoutError, ValidationError, } from './errors/index.js';
16
16
  export type { SmileIDErrorFields } from './errors/index.js';
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "12.0.0";
1
+ export declare const VERSION = "12.1.0";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '12.0.0';
4
+ exports.VERSION = '12.1.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smileid/usesmileid-nodejs",
3
- "version": "12.0.0",
3
+ "version": "12.1.0",
4
4
  "description": "Official Smile ID server-side SDK for JavaScript/TypeScript — V3 APIs.",
5
5
  "private": false,
6
6
  "type": "commonjs",