Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to register second device #14

Open
onlymejosh opened this issue Dec 21, 2020 · 7 comments
Open

how to register second device #14

onlymejosh opened this issue Dec 21, 2020 · 7 comments
Assignees

Comments

@onlymejosh
Copy link

Hey there I am trying to register a secondary device but have ran into problems it looks like registerSecondDevice isn't quite complete.

Ive made some changes to get the cryto working in ProvisioningCipher but I am not entirely sure its correct

getPublicKey() {
    return Promise.resolve()
      .then(() => {
        if (!this.keyPair) {
          return libsignal._curve.libsignal_Curve_async.generateKeyPair().then(keyPair => {
            this.keyPair = keyPair;
          });
        }

        return null;
      })
      .then(() => this.keyPair.pubKey);
  }

Do you happen to have a working example of registerSecondDevice working?

What I am trying to do is register a device and then send messages to a known number which is already registered with signal. Do you have any suggestions on the best way to do that?

@jheretic
Copy link
Contributor

I'm actually working on this very issue! It was not a direct need for me when I implemented the library, so it wasn't as well tested. But I have a different project that needs it, so I'm hoping to release an update with this support sometime in the next week or so (holidays permitting)

@ctzurcanu
Copy link

@jheretic should we continue to harbor any hope you would fix this?

@jheretic
Copy link
Contributor

Yes, I just didn't manage to have time to wrap things up before the holidays as it required some additional testing, and things got a little wild here in DC after the holidays so I've been somewhat occupied. This should still be fixed soon, just busy.

@onlymejosh
Copy link
Author

Thanks @jheretic if you need a hand I’m happy to help.

@ctzurcanu theres no need to speak like that. Josh is under no obligation here 👍

@jheretic jheretic self-assigned this Feb 1, 2021
@Reiszecke
Copy link

Hey jheretic, I'm working on the same stuff right now. Before the 3 of us reinvent the wheel at the same time - have you made any progress?

Currently sitting at TypeError: Cannot read property 'getRandomBytes' of undefined at Curve.js:88:35 and I'm unable to tell whether it's an issue on my side or if the crypto export is faulty in the library.

@jheretic
Copy link
Contributor

@Reiszecke I believe it's a problem with the signal-protocol library. I have a possible fix, but that dependency in general is in bad shape and I'm hesitant to push an update before I get the dependencies updated and all the tests passing again. It's a rough node port of the upstream libsignal-protocol-javascript library from Signal, which hasn't been updated in a few years. The very next version of Signal-Desktop is going to abandon it, so I'm not sure whether I'm going to fix this issue first or finish the Typescript port that will abandon that dependency altogether.

@Reiszecke
Copy link

@jheretic

Hey, I've temporarily set up a small workaround for the getRandomBytes issue (creating a dummy object that's visible to that class, JavaScript is such a mess lmao) and I'm able to generate QR codes that look correct - the problem is that after scanning I get "Device not found" on my Android when scanning.

I'm not sure whether it's due to the library not correctly introducing itself to the WebSocket or if the Signal app only accepts very specific QR codes (specific in terms of QR code generation options). I'm afraid it's the former.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants