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

requestSMS throws FetchError "self signed certificate in certificate chain" #46

Open machinaeXlasse opened 2 years ago

machinaeXlasse commented 2 years ago

I get an error when I try to get started with the example files.

Set the storage to a local directory and run the requestSMS command: node ./client.js requestSMS +491****** arbitrarystring

The request to get the verification sms code at whispersystems.org fails with:

'FetchError: request to https://textsecure-service-staging.whispersystems.org/v1/accounts/sms/code/+491********* failed, reason: self signed certitificate in certificate chain'

Running on ubuntu server with node v16.13.1 (I retried on a local windows 10 with the same outcome)

I use a german sim card phone number that is registered with the signal android and desktop app.

Here is the full error stack:

Error [HTTPError]: promiseAjax catch; code: -1
    at HTTPError (/home/machina/sketchbook/signal-adaptor/node_modules/@throneless/libsignal-service/src/WebAPI.js:389:13)
    at /home/machina/sketchbook/signal-adaptor/node_modules/@throneless/libsignal-service/src/WebAPI.js:361:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
Original stack:
FetchError: request to https://textsecure-service-staging.whispersystems.org/v1/accounts/sms/code/+491********** failed, reason: self signed certificate in certificate chain
    at ClientRequest.<anonymous> (/home/machina/sketchbook/signal-adaptor/node_modules/node-fetch/lib/index.js:1491:11)
    at ClientRequest.emit (events.js:315:20)
    at TLSSocket.socketErrorListener (_http_client.js:426:9)
    at TLSSocket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Initial stack:
Error
    at _outerAjax (/home/machina/sketchbook/signal-adaptor/node_modules/@throneless/libsignal-service/src/WebAPI.js:383:19)
    at _ajax (/home/machina/sketchbook/signal-adaptor/node_modules/@throneless/libsignal-service/src/WebAPI.js:502:14)
    at Object.requestVerificationSMS (/home/machina/sketchbook/signal-adaptor/node_modules/@throneless/libsignal-service/src/WebAPI.js:620:14)
    at AccountManager.requestSMSVerification (/home/machina/sketchbook/signal-adaptor/node_modules/@throneless/libsignal-service/src/AccountManager.js:49:24)
    at Object.<anonymous> (/home/machina/sketchbook/signal-adaptor/index.js:79:8)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
  code: -1,
  response: 'FetchError: request to https://textsecure-service-staging.whispersystems.org/v1/accounts/sms/code/+491********** failed, reason: self signed certificate in certificate chain'
}