Closed FrederikP closed 4 years ago
The number of parameters don't match up as far as I can tell (with my limited js/ts/node skills).
textsecure.MessageReceiver = function MessageReceiverWrapper(
username,
uuid,
password,
signalingKey,
options
)
The above takes 5 parameters. Code is taken directly from node_modules/signal-desktop/js/libtextsecure.js
on my machine. This is probably the actual source code: https://github.com/signalapp/Signal-Desktop/blob/c1dfe3e5b46d864667b4be19846503ce6e699ecd/ts/textsecure/MessageReceiver.ts#L1808
node-signal-client
only passes 4 parameters:
// initialize the socket and start listening for messages
messageReceiver = new textsecure.MessageReceiver(
USERNAME, PASSWORD, undefined, options
);
Source Code: https://github.com/matrix-hacks/node-signal-client/blob/a16db14e273852969cdd2e41c0154148ad119f7d/index.js#L838
So the options
object actually ends up in the signalingKey
parameter of the constructor. And options
in the constructor is then undefined, and empty object in the layer below.
Edit:
changing the last snippet to the following helps to get rid of the original error:
messageReceiver = new textsecure.MessageReceiver(
USERNAME, undefined, PASSWORD, undefined, options
);
There is a followup error though. window.normalizeUuids
function is defined in signal-desktops preload.js, but that code doesn't run (at least for me). So the function cannot be called. I just copied it to the client code and it worked.
window.normalizeUuids = (obj, paths, context) => {
if (!obj) {
return;
}
paths.forEach(path => {
const val = _.get(obj, path);
if (val) {
if (!window.isValidGuid(val)) {
window.log.warn(
`Normalizing invalid uuid: ${val} at path ${path} in context "${context}"`
);
}
_.set(obj, path, val.toLowerCase());
}
});
};
And there is another error (I don't know if related): getDescriptorForSent is not defined
Solved that one by adding: signalRequire("js/background");
Also leads to some more errors. Probably due to ordering of requires.
I guess background.js is kind of frontend-heavy, so we need to mock it away?
I'll try to figure that one out as well. Overall I think the issues are mostly version incompatibilities? But I just called npm install
so I don't know why no one else is facing these issues.
It's probably because not many people are using it. I have been rewriting the client in the last few weeks as I wanted to use it and found the same problems and I am still in the process of finishing it (fixing bugs, quotes etc). If you want to experiment you can try it with my experimental repo: https://github.com/witchent/matrix-puppet-signal Otherwise you should probably wait a few more days before I deem it stable enough and can put up a pull request.
Okay thanks for letting me know. I have tried to iron out some of the issues I found.
If you are interested I opened up a PR here: https://github.com/matrix-hacks/node-signal-client/pull/13
If you are not, just close it. I just didn't want to throw it away.
I think it fixes most of the issues I have seen with incompatibilities. But even with these changes I am now running into segmentation faults. EBUSY: resource busy or locked, rename 'room-store.db~' -> 'room-store.db'
Might be related to my docker setup though.
I'm just gonna listen to your advice and try again later. Thanks for your work!
I cannot merge pull request myself, but as I already implemented those changes I think it is not really that important. Thank you very much anyway, I hope to see you around after it's working again to fix any outstanding bugs.
Thank you very much for your contribution @FrederikP ! As @witchent already picked your changes, I will leave this open until they are merged in this repository.
No more issues with https://github.com/witchent/matrix-puppet-signal Thanks!
This is the error I'm getting when running
node index.js
after I've linked with signal successfully (and created the registration yaml):This is probably it: https://github.com/signalapp/Signal-Desktop/blob/c1dfe3e5b46d864667b4be19846503ce6e699ecd/ts/textsecure/MessageReceiver.ts#L139
But why is this option not set for me? I wasn't able to find any information regarding such an error.
Thanks for your help!
Edit: Some research from my uninformed side:
I added a log line to print options here: https://github.com/matrix-hacks/node-signal-client/blob/a16db14e273852969cdd2e41c0154148ad119f7d/index.js#L838 It shows that
serverTrustRoot
is set. So weird. I also added such a log line to the MessageReceiver constructor. There theoptions
object is empty (default I guess). Why doesn't the correct options object end up there? I also added such a log line to the MessageReceiverWrapper constructor. There theoptions
variable isundefined