Skip to content

Commit

Permalink
fix: captcha sid is now string
Browse files Browse the repository at this point in the history
  • Loading branch information
negezor committed Feb 25, 2024
1 parent a77ec04 commit 0c6be9d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/authorization/src/providers/direct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

Expand Down Expand Up @@ -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<Response> {
Expand Down
6 changes: 3 additions & 3 deletions packages/vk-io/src/errors/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,7 +26,7 @@ export class APIError extends VKError {
/**
* Session identifier captcha
*/
public captchaSid?: number;
public captchaSid?: string;

/**
* Image of captcha
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/vk-io/src/utils/callback-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {

export interface ICallbackServiceCaptchaPayload {
type: CaptchaType;
sid: string | number;
sid: string;
src: string;
request?: APIRequest;
}
Expand Down

0 comments on commit 0c6be9d

Please sign in to comment.