throneless-tech / libsignal-service-javascript

A javascript library for basic interaction with the Signal messaging service, adapted from Signal-Desktop.
GNU General Public License v3.0
57 stars 21 forks source link

Add ability to pass captcha token when requesting SMS verification #40

Open kaskii opened 2 years ago

kaskii commented 2 years ago

Solves #35 and #23

Sometimes the Signal server requires a captcha token for registering a new account. The registration fails with a captcha required error or with 402 Payment Required error. In this case, you need to solve a CAPTCHA challenge.

This PR adds ability to pass token to the request.

You can pass the captcha token to registerSingleDevice function like so:

const captchaToken = "...";
accountManager.requestSMSVerification(captchaToken).then(result => {
  console.log("Sent verification code.");
});

Note: Captcha token is valid for only a short period of time.