From 0c6be9dee32b7a8e08208d537df95a220ec010e3 Mon Sep 17 00:00:00 2001 From: Negezor Date: Sun, 25 Feb 2024 17:04:51 +1100 Subject: [PATCH] fix: captcha sid is now string --- packages/authorization/src/providers/direct.ts | 4 ++-- packages/vk-io/src/errors/api.ts | 6 +++--- packages/vk-io/src/utils/callback-service.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/authorization/src/providers/direct.ts b/packages/authorization/src/providers/direct.ts index 1853ba976..1dfc4ab9c 100644 --- a/packages/authorization/src/providers/direct.ts +++ b/packages/authorization/src/providers/direct.ts @@ -264,7 +264,7 @@ export class DirectAuthorization { if (text.error === 'need_captcha') { response = await this.processCaptcha(text as { - captcha_sid: number; + captcha_sid: string; captcha_img: string; }); @@ -332,7 +332,7 @@ export class DirectAuthorization { */ protected async processCaptcha( { captcha_sid: sid, captcha_img: src }: { - captcha_sid: number; + captcha_sid: string; captcha_img: string; }, ): Promise { diff --git a/packages/vk-io/src/errors/api.ts b/packages/vk-io/src/errors/api.ts index 11c08624e..8de1c4ff7 100644 --- a/packages/vk-io/src/errors/api.ts +++ b/packages/vk-io/src/errors/api.ts @@ -11,7 +11,7 @@ export interface IAPIErrorOptions { error_msg: string; request_params: IAPIErrorParam[]; - captcha_sid?: number; + captcha_sid?: string; captcha_img?: string; redirect_uri?: string; confirmation_text?: string; @@ -26,7 +26,7 @@ export class APIError extends VKError { /** * Session identifier captcha */ - public captchaSid?: number; + public captchaSid?: string; /** * Image of captcha @@ -56,7 +56,7 @@ export class APIError extends VKError { // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison if (code === APIErrorCode.CAPTCHA) { - this.captchaSid = Number(payload.captcha_sid); + this.captchaSid = payload.captcha_sid; this.captchaImg = payload.captcha_img; // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison } else if (code === APIErrorCode.AUTH_VALIDATION) { diff --git a/packages/vk-io/src/utils/callback-service.ts b/packages/vk-io/src/utils/callback-service.ts index 2077204c6..198bbafcc 100644 --- a/packages/vk-io/src/utils/callback-service.ts +++ b/packages/vk-io/src/utils/callback-service.ts @@ -10,7 +10,7 @@ const { export interface ICallbackServiceCaptchaPayload { type: CaptchaType; - sid: string | number; + sid: string; src: string; request?: APIRequest; }