@sneekin/sdk 1.1.1 → 1.1.2

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.
@@ -916,6 +916,7 @@ export type ListInvoicesResponse = {
916
916
  quantity: number;
917
917
  unitPriceMicroInr: number;
918
918
  amountMicroInr: number;
919
+ priceRevisionId?: string;
919
920
  }>;
920
921
  }>;
921
922
  };
@@ -949,6 +950,7 @@ export type InvoiceResponse = {
949
950
  quantity: number;
950
951
  unitPriceMicroInr: number;
951
952
  amountMicroInr: number;
953
+ priceRevisionId?: string;
952
954
  }>;
953
955
  };
954
956
  export type WalletResponse = {
@@ -1055,6 +1057,42 @@ export type WebsiteSettlementsResponse = {
1055
1057
  settlement: Settlement;
1056
1058
  }>;
1057
1059
  };
1060
+ export type PriceRevision = {
1061
+ id: string;
1062
+ channel: 'SMS_OTP' | 'SMS_MSG' | 'WHATSAPP_OTP' | 'WHATSAPP_MSG' | 'EMAIL_OTP' | 'EMAIL_MSG' | 'PUSH' | 'QR_SCAN' | 'PASSKEY';
1063
+ unitPriceMicroInr: number;
1064
+ currency: 'INR';
1065
+ effectiveFrom: string;
1066
+ reason: string;
1067
+ createdByUserId?: string | null;
1068
+ createdAt: string;
1069
+ };
1070
+ export type ChannelPricing = {
1071
+ channel: 'SMS_OTP' | 'SMS_MSG' | 'WHATSAPP_OTP' | 'WHATSAPP_MSG' | 'EMAIL_OTP' | 'EMAIL_MSG' | 'PUSH' | 'QR_SCAN' | 'PASSKEY';
1072
+ currentPrice: PriceRevision;
1073
+ scheduledChange: PriceRevision & ({
1074
+ [key: string]: unknown;
1075
+ } | null);
1076
+ };
1077
+ export type GetPricingResponse = {
1078
+ channels: Array<ChannelPricing>;
1079
+ noticeDays: number;
1080
+ };
1081
+ export type GetPriceRevisionsQuery = {
1082
+ channel?: 'SMS_OTP' | 'SMS_MSG' | 'WHATSAPP_OTP' | 'WHATSAPP_MSG' | 'EMAIL_OTP' | 'EMAIL_MSG' | 'PUSH' | 'QR_SCAN' | 'PASSKEY';
1083
+ };
1084
+ export type GetPriceRevisionsResponse = {
1085
+ revisions: Array<PriceRevision>;
1086
+ };
1087
+ export type CreatePriceRevision = {
1088
+ channel: 'SMS_OTP' | 'SMS_MSG' | 'WHATSAPP_OTP' | 'WHATSAPP_MSG' | 'EMAIL_OTP' | 'EMAIL_MSG' | 'PUSH' | 'QR_SCAN' | 'PASSKEY';
1089
+ unitPriceMicroInr: number;
1090
+ effectiveFrom?: string;
1091
+ reason: string;
1092
+ };
1093
+ export type CreatePriceRevisionResponse = {
1094
+ revision: PriceRevision;
1095
+ };
1058
1096
  export type MatchPushApprovalNumber = {
1059
1097
  trustedDeviceId: string;
1060
1098
  selectedNumber: string;
@@ -3411,6 +3449,52 @@ export type ConsoleListUsersResponses = {
3411
3449
  200: ListConsoleUsersResponse;
3412
3450
  };
3413
3451
  export type ConsoleListUsersResponse = ConsoleListUsersResponses[keyof ConsoleListUsersResponses];
3452
+ export type ConsoleGetPricingData = {
3453
+ body?: never;
3454
+ path?: never;
3455
+ query?: never;
3456
+ url: '/api/console/pricing';
3457
+ };
3458
+ export type ConsoleGetPricingErrors = {
3459
+ 401: ErrorEnvelope;
3460
+ };
3461
+ export type ConsoleGetPricingError = ConsoleGetPricingErrors[keyof ConsoleGetPricingErrors];
3462
+ export type ConsoleGetPricingResponses = {
3463
+ 200: GetPricingResponse;
3464
+ };
3465
+ export type ConsoleGetPricingResponse = ConsoleGetPricingResponses[keyof ConsoleGetPricingResponses];
3466
+ export type ConsoleGetPriceRevisionsData = {
3467
+ body?: never;
3468
+ path?: never;
3469
+ query?: {
3470
+ channel?: 'SMS_OTP' | 'SMS_MSG' | 'WHATSAPP_OTP' | 'WHATSAPP_MSG' | 'EMAIL_OTP' | 'EMAIL_MSG' | 'PUSH' | 'QR_SCAN' | 'PASSKEY';
3471
+ };
3472
+ url: '/api/console/pricing/revisions';
3473
+ };
3474
+ export type ConsoleGetPriceRevisionsErrors = {
3475
+ 400: ErrorEnvelope;
3476
+ 401: ErrorEnvelope;
3477
+ };
3478
+ export type ConsoleGetPriceRevisionsError = ConsoleGetPriceRevisionsErrors[keyof ConsoleGetPriceRevisionsErrors];
3479
+ export type ConsoleGetPriceRevisionsResponses = {
3480
+ 200: GetPriceRevisionsResponse;
3481
+ };
3482
+ export type ConsoleGetPriceRevisionsResponse = ConsoleGetPriceRevisionsResponses[keyof ConsoleGetPriceRevisionsResponses];
3483
+ export type ConsoleCreatePriceRevisionData = {
3484
+ body: CreatePriceRevision;
3485
+ path?: never;
3486
+ query?: never;
3487
+ url: '/api/console/pricing/revisions';
3488
+ };
3489
+ export type ConsoleCreatePriceRevisionErrors = {
3490
+ 400: ErrorEnvelope;
3491
+ 401: ErrorEnvelope;
3492
+ };
3493
+ export type ConsoleCreatePriceRevisionError = ConsoleCreatePriceRevisionErrors[keyof ConsoleCreatePriceRevisionErrors];
3494
+ export type ConsoleCreatePriceRevisionResponses = {
3495
+ 201: CreatePriceRevisionResponse;
3496
+ };
3497
+ export type ConsoleCreatePriceRevisionResponse = ConsoleCreatePriceRevisionResponses[keyof ConsoleCreatePriceRevisionResponses];
3414
3498
  export type WhatsappVerifyWebhookData = {
3415
3499
  body?: never;
3416
3500
  path?: never;
@@ -340,8 +340,16 @@ var SneekVerifyHandler = class {
340
340
  const partner = await this.client.request("GET", "/api/verify/qr/partner-config");
341
341
  let payload;
342
342
  try {
343
- const jwks = this.jwksByIssuer.get(partner.issuer) ?? (0, import_jose.createRemoteJWKSet)(new URL("/oauth/jwks", partner.issuer));
344
- this.jwksByIssuer.set(partner.issuer, jwks);
343
+ let jwks = this.jwksByIssuer.get(partner.issuer);
344
+ if (!jwks) {
345
+ try {
346
+ const localJwksData = await this.client.request("GET", "/oauth/jwks");
347
+ jwks = (0, import_jose.createLocalJWKSet)(localJwksData);
348
+ } catch {
349
+ jwks = (0, import_jose.createRemoteJWKSet)(new URL("/oauth/jwks", partner.issuer));
350
+ }
351
+ this.jwksByIssuer.set(partner.issuer, jwks);
352
+ }
345
353
  ({ payload } = await (0, import_jose.jwtVerify)(result.idToken, jwks, {
346
354
  issuer: partner.issuer,
347
355
  audience: partner.clientId
@@ -122,7 +122,7 @@ function asProblem(value) {
122
122
 
123
123
  // src/verify/handler.ts
124
124
  import { createHash, createHmac, randomBytes, timingSafeEqual } from "crypto";
125
- import { createRemoteJWKSet, jwtVerify } from "jose";
125
+ import { createLocalJWKSet, createRemoteJWKSet, jwtVerify } from "jose";
126
126
 
127
127
  // src/verify/auth-schema.ts
128
128
  import { z } from "zod";
@@ -310,8 +310,16 @@ var SneekVerifyHandler = class {
310
310
  const partner = await this.client.request("GET", "/api/verify/qr/partner-config");
311
311
  let payload;
312
312
  try {
313
- const jwks = this.jwksByIssuer.get(partner.issuer) ?? createRemoteJWKSet(new URL("/oauth/jwks", partner.issuer));
314
- this.jwksByIssuer.set(partner.issuer, jwks);
313
+ let jwks = this.jwksByIssuer.get(partner.issuer);
314
+ if (!jwks) {
315
+ try {
316
+ const localJwksData = await this.client.request("GET", "/oauth/jwks");
317
+ jwks = createLocalJWKSet(localJwksData);
318
+ } catch {
319
+ jwks = createRemoteJWKSet(new URL("/oauth/jwks", partner.issuer));
320
+ }
321
+ this.jwksByIssuer.set(partner.issuer, jwks);
322
+ }
315
323
  ({ payload } = await jwtVerify(result.idToken, jwks, {
316
324
  issuer: partner.issuer,
317
325
  audience: partner.clientId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sneekin/sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -66,4 +66,4 @@
66
66
  "engines": {
67
67
  "node": ">=20"
68
68
  }
69
- }
69
+ }