@sinch/verification 1.2.0 → 1.3.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.
Files changed (25) hide show
  1. package/dist/index.js +17 -7
  2. package/dist/index.js.map +1 -1
  3. package/dist/models/v1/mod-callbacks/index.d.ts +1 -0
  4. package/dist/models/v1/mod-callbacks/index.js +2 -0
  5. package/dist/models/v1/mod-callbacks/index.js.map +1 -1
  6. package/dist/models/v1/mod-callbacks/sms-request-event-response/sms-request-event-response.d.ts +1 -1
  7. package/dist/models/v1/mod-callbacks/verification-callback-event.d.ts +2 -1
  8. package/dist/models/v1/mod-callbacks/verification-request-event/index.d.ts +1 -1
  9. package/dist/models/v1/mod-callbacks/verification-request-event/verification-request-event.d.ts +3 -1
  10. package/dist/models/v1/mod-callbacks/verification-result-event/index.d.ts +1 -1
  11. package/dist/models/v1/mod-callbacks/verification-result-event/verification-result-event.d.ts +2 -2
  12. package/dist/models/v1/mod-callbacks/verification-sms-delivered-event/index.d.ts +1 -0
  13. package/dist/models/v1/mod-callbacks/verification-sms-delivered-event/index.js +3 -0
  14. package/dist/models/v1/mod-callbacks/verification-sms-delivered-event/index.js.map +1 -0
  15. package/dist/models/v1/mod-callbacks/verification-sms-delivered-event/verification-sms-delivered-event.d.ts +17 -0
  16. package/dist/models/v1/mod-callbacks/verification-sms-delivered-event/verification-sms-delivered-event.js +3 -0
  17. package/dist/models/v1/mod-callbacks/verification-sms-delivered-event/verification-sms-delivered-event.js.map +1 -0
  18. package/dist/models/v1/start-verification-request/start-verification-request.d.ts +1 -1
  19. package/dist/models/v1/verification-report-request/verification-report-request.d.ts +1 -1
  20. package/dist/rest/v1/callbacks/callbacks-webhook.d.ts +1 -2
  21. package/dist/rest/v1/callbacks/callbacks-webhook.js +5 -0
  22. package/dist/rest/v1/callbacks/callbacks-webhook.js.map +1 -1
  23. package/dist/rest/v1/verification-status/verification-status-api.jest.fixture.d.ts +0 -1
  24. package/dist/rest/v1/verifications/verifications-api.jest.fixture.d.ts +0 -1
  25. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
37
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAyC;AACzC,yCAAuB;AACvB,oDAAkC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAyC;AACzC,yCAAuB;AACvB,oDAAkC"}
@@ -6,3 +6,4 @@ export * from './sms-request-event-response';
6
6
  export * from './verification-request-event-response';
7
7
  export * from './verification-result-event';
8
8
  export * from './verification-result-event-response';
9
+ export * from './verification-sms-delivered-event';
@@ -25,4 +25,6 @@ __exportStar(require("./verification-request-event-response"), exports);
25
25
  // 'Verification Result Event' received from Sinch server (no response data needed)
26
26
  __exportStar(require("./verification-result-event"), exports);
27
27
  __exportStar(require("./verification-result-event-response"), exports);
28
+ // 'Verification Sms Delivered Event' received from Sinch server
29
+ __exportStar(require("./verification-sms-delivered-event"), exports);
28
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/mod-callbacks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C;AAC9C,0DAA0D;AAC1D,+DAA6C;AAC7C,sEAAsE;AACtE,qEAAmD;AACnD,qEAAmD;AACnD,+DAA6C;AAC7C,wEAAsD;AACtD,mFAAmF;AACnF,8DAA4C;AAC5C,uEAAqD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/mod-callbacks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C;AAC9C,0DAA0D;AAC1D,+DAA6C;AAC7C,sEAAsE;AACtE,qEAAmD;AACnD,qEAAmD;AACnD,+DAA6C;AAC7C,wEAAsD;AACtD,mFAAmF;AACnF,8DAA4C;AAC5C,uEAAqD;AACrD,gEAAgE;AAChE,qEAAmD"}
@@ -6,7 +6,7 @@ export interface SmsRequestEventResponse {
6
6
  sms?: SmsProperties;
7
7
  }
8
8
  export interface SmsProperties {
9
- /** The SMS PIN that should be used. By default, the Sinch dashboard will automatically generate PIN codes for SMS verification. If you want to set your own PIN, you can specify it in the response to the Verification Request Event. */
9
+ /** The SMS OTP that should be used. By default, the Sinch dashboard will automatically generate OTP codes for SMS verification. If you want to set your own OTP, you can specify it in the response to the Verification Request Event. */
10
10
  code?: string;
11
11
  /** List of strings */
12
12
  acceptLanguage?: string[];
@@ -1,3 +1,4 @@
1
1
  import { VerificationRequestEvent } from './verification-request-event';
2
2
  import { VerificationResultEvent } from './verification-result-event';
3
- export type VerificationCallbackEvent = VerificationRequestEvent | VerificationResultEvent;
3
+ import { VerificationSmsDeliveredEvent } from './verification-sms-delivered-event';
4
+ export type VerificationCallbackEvent = VerificationRequestEvent | VerificationResultEvent | VerificationSmsDeliveredEvent;
@@ -1 +1 @@
1
- export type { VerificationRequestEvent, MethodEnum } from './verification-request-event';
1
+ export type { VerificationRequestEvent, VerificationRequestMethod, MethodEnum } from './verification-request-event';
@@ -6,7 +6,7 @@ export interface VerificationRequestEvent {
6
6
  /** The type of the event. */
7
7
  event: 'VerificationRequestEvent';
8
8
  /** The verification method. */
9
- method: MethodEnum;
9
+ method: VerificationRequestMethod;
10
10
  /** @see Identity */
11
11
  identity: Identity;
12
12
  /** The amount of money and currency of the verification request. */
@@ -20,4 +20,6 @@ export interface VerificationRequestEvent {
20
20
  /** List of strings */
21
21
  acceptLanguage?: string[];
22
22
  }
23
+ /** @deprecated Use VerificationRequestMethod instead */
23
24
  export type MethodEnum = 'sms' | 'flashcall' | 'callout';
25
+ export type VerificationRequestMethod = 'sms' | 'flashcall' | 'callout';
@@ -1 +1 @@
1
- export type { VerificationResultEvent } from './verification-result-event';
1
+ export type { VerificationResultEvent, VerificationResultMethod } from './verification-result-event';
@@ -6,7 +6,7 @@ export interface VerificationResultEvent {
6
6
  /** The type of the event. */
7
7
  event: 'VerificationResultEvent';
8
8
  /** The verification method. */
9
- method: MethodEnum;
9
+ method: VerificationResultMethod;
10
10
  /** @see Identity */
11
11
  identity: Identity;
12
12
  /** The status of the verification request. */
@@ -20,4 +20,4 @@ export interface VerificationResultEvent {
20
20
  /** A custom string that can be provided during a verification request. */
21
21
  custom?: string;
22
22
  }
23
- export type MethodEnum = 'sms' | 'flashcall' | 'callout' | 'seamless';
23
+ export type VerificationResultMethod = 'sms' | 'flashcall' | 'callout' | 'seamless';
@@ -0,0 +1 @@
1
+ export type { VerificationSmsDeliveredEvent } from './verification-sms-delivered-event';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/models/v1/mod-callbacks/verification-sms-delivered-event/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { Identity } from '../../identity';
2
+ export interface VerificationSmsDeliveredEvent {
3
+ /** The ID of the verification request. */
4
+ id: string;
5
+ /** The type of the event. */
6
+ event: 'VerificationSmsDeliveredEvent';
7
+ /** The verification method. */
8
+ method: 'sms' | string;
9
+ /** @see Identity */
10
+ identity: Identity;
11
+ /** The result of the SMS delivery. Possible values can be extended in the future. */
12
+ smsResult: 'Successful' | 'Failed' | string;
13
+ /** Used to pass your own reference in the request for tracking purposes. */
14
+ reference?: string;
15
+ /** Can be used to pass custom data in the request. */
16
+ custom?: string;
17
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=verification-sms-delivered-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verification-sms-delivered-event.js","sourceRoot":"","sources":["../../../../../src/models/v1/mod-callbacks/verification-sms-delivered-event/verification-sms-delivered-event.ts"],"names":[],"mappings":""}
@@ -47,7 +47,7 @@ export interface SmsOptions {
47
47
  }
48
48
  export type CodeType = 'Numeric' | 'Alpha' | 'Alphanumeric';
49
49
  /**
50
- * An optional object for flashCall verifications. It allows you to specify dial time out parameter for flashCall. FlashCallOptions object can be specified optionally, and only if the verification request was triggered from your backend (no SDK client) through an [Application signed request](/docs/voice/api-reference/authentication/signed-request).
50
+ * An optional object for Flash Call Verification, considered only when the verification request originates from your backend (not an SDK client) via an [Application signed request](https://developers.sinch.com/docs/voice/api-reference/authentication/signed-request).
51
51
  */
52
52
  export interface FlashCallOptions {
53
53
  /** The dial timeout in seconds. */
@@ -13,7 +13,7 @@ export interface FlashCallVerificationReportRequest {
13
13
  flashCall: FlashCallContent;
14
14
  }
15
15
  interface FlashCallContent {
16
- /** The caller ID of the FlashCall. */
16
+ /** The caller ID of the flash call. Caller ID in flash call verification refers to the phone number from which the call was made to the user's device. The verification system uses this incoming number as One Time Password (OTP) */
17
17
  cli: string;
18
18
  }
19
19
  export interface PhoneCallVerificationReportRequest {
@@ -1,8 +1,7 @@
1
- /// <reference types="node" />
2
1
  import { VerificationCallbackEvent, VerificationRequestEvent, VerificationResultEvent } from '../../../models';
3
2
  import { CallbackProcessor, SinchClientParameters } from '@sinch/sdk-client';
4
3
  import { IncomingHttpHeaders } from 'http';
5
- /** @deprecated Use Verification.VerificationCallback instead */
4
+ /** @deprecated Use Verification.VerificationCallbackEvent instead */
6
5
  export type VerificationCallback = VerificationRequestEvent | VerificationResultEvent;
7
6
  export declare class VerificationCallbackWebhooks implements CallbackProcessor<VerificationCallbackEvent> {
8
7
  private readonly sinchClientParameters;
@@ -27,12 +27,17 @@ class VerificationCallbackWebhooks {
27
27
  * @return {VerificationCallbackEvent} - The parsed verification event object.
28
28
  */
29
29
  parseEvent(eventBody) {
30
+ if (typeof eventBody === 'string') {
31
+ eventBody = JSON.parse(eventBody);
32
+ }
30
33
  if (eventBody.event) {
31
34
  switch (eventBody.event) {
32
35
  case 'VerificationRequestEvent':
33
36
  return eventBody;
34
37
  case 'VerificationResultEvent':
35
38
  return eventBody;
39
+ case 'VerificationSmsDeliveredEvent':
40
+ return eventBody;
36
41
  default:
37
42
  throw new Error(`Unknown Verification event type: ${eventBody.event}`);
38
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"callbacks-webhook.js","sourceRoot":"","sources":["../../../../src/rest/v1/callbacks/callbacks-webhook.ts"],"names":[],"mappings":";;;AACA,kDAA2G;AAM3G,MAAa,4BAA4B;IAIvC,YAAY,qBAA4C;QACtD,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;IACrD,CAAC;IA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QAEd,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,cAAc,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,EAAE,CAAC;YAChG,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACpE,CAAC;QACD,OAAO,IAAA,yCAA4B,EACjC,IAAI,CAAC,qBAAqB,CAAC,cAAc,EACzC,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,EAC5C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,UAAU,CAAC,SAAc;QAC9B,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YAClC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;QACD,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;YACpB,QAAQ,SAAS,CAAC,KAAK,EAAE,CAAC;gBAC1B,KAAK,0BAA0B;oBAC7B,OAAO,SAAqC,CAAC;gBAC/C,KAAK,yBAAyB;oBAC5B,OAAO,SAAoC,CAAC;gBAC9C,KAAK,+BAA+B;oBAClC,OAAO,SAA0C,CAAC;gBACpD;oBACE,MAAM,IAAI,KAAK,CAAC,oCAAoC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,0CAA0C,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACnF,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAChD,CAAC;CAEF;AAzDD,oEAyDC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  import { VerificationStatusApi } from './verification-status-api';
3
2
  import { VerificationStatusResponse, VerificationStatusByIdRequestData, VerificationStatusByIdentityRequestData, VerificationStatusByReferenceRequestData } from '../../../models';
4
3
  export declare class VerificationStatusApiFixture implements Partial<Readonly<VerificationStatusApi>> {
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  import { VerificationsApi } from './verifications-api';
3
2
  import { StartCalloutVerificationResponse, CalloutVerificationReportResponse, StartSeamlessVerificationResponse, StartFlashCallVerificationResponse, FlashCallVerificationReportResponse, StartSmsVerificationResponse, SmsVerificationReportResponse, StartSmsVerificationRequestData, StartFlashCallVerificationRequestData, StartCalloutVerificationRequestData, StartSeamlessVerificationRequestData, ReportSmsVerificationByIdRequestData, ReportCalloutVerificationByIdRequestData, ReportFlashCallVerificationByIdRequestData, ReportSmsVerificationByIdentityRequestData, ReportFlashCallVerificationByIdentityRequestData, ReportCalloutVerificationByIdentityRequestData, StartDataVerificationRequestData, StartPhoneCallVerificationResponse, StartPhoneCallVerificationRequestData, StartDataVerificationResponse, ReportPhoneCallVerificationByIdRequestData, ReportPhoneCallVerificationByIdentityRequestData, PhoneCallVerificationReportResponse } from '../../../models';
4
3
  export declare class VerificationsApiFixture implements Partial<Readonly<VerificationsApi>> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinch/verification",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Sinch Verification API",
5
5
  "homepage": "",
6
6
  "repository": {
@@ -29,7 +29,7 @@
29
29
  "test:e2e": "cucumber-js"
30
30
  },
31
31
  "dependencies": {
32
- "@sinch/sdk-client": "^1.2.0"
32
+ "@sinch/sdk-client": "^1.3.0"
33
33
  },
34
34
  "devDependencies": {},
35
35
  "publishConfig": {