Signal-Windows icon indicating copy to clipboard operation
Signal-Windows copied to clipboard

Does anyone knows how to implement Device linking?

Open LokiMidgard opened this issue 4 years ago • 2 comments
trafficstars

I try to add device linking (as master device) to this client. But I'm not sure how the API works.

I suspect that profileKey is the SignalingKey in the App.Handle.Store and that the identityKeyPair I need is the App.Handle.Store.IdentityKeyPair.

I also think I decode the uri correctly.

        public async Task AddDevice(Uri uri)
        {
            var code = await App.Handle.AccountManager.GetNewDeviceVerificationCodeAsync();

            var toAdd = DeviceProtocoll.FromUri(uri);
            // is the SignalingKey the profileKey???
            var profileKey = Base64.Decode(App.Handle.Store.SignalingKey);
            var identityKeyPair = new IdentityKeyPair(Base64.Decode(App.Handle.Store.IdentityKeyPair));

            try
            {
                // I'm not sure where which parameter goes...
                // but it failes when the QR code is to old, so the first two are propably correct...
                await App.Handle.AccountManager.AddDeviceAsync(toAdd.Uuid, toAdd.PublicKey,
                         identityKeyPair,
                        profileKey,
                         code);
            }
            catch (libsignalservice.push.exceptions.NotFoundException)
            {
                // ToDo: Handle Divice not found
            }
        }

The Android code doesn't do much more, besides enabling MultiDevice. Which I can't find anywhere...

Still nothing happens on my WindowsPhone when I scan its code. An error is also not raised (unless the QR code is to old).

You can also see the pullrequest #232

LokiMidgard avatar May 16 '21 12:05 LokiMidgard

I try to add device linking (as master device) to this client. But I'm not sure how the API works.

I suspect that profileKey is the SignalingKey in the App.Handle.Store and that the identityKeyPair I need is the App.Handle.Store.IdentityKeyPair.

I also think I decode the uri correctly.

        public async Task AddDevice(Uri uri)
        {
            var code = await App.Handle.AccountManager.GetNewDeviceVerificationCodeAsync();

            var toAdd = DeviceProtocoll.FromUri(uri);
            // is the SignalingKey the profileKey???
            var profileKey = Base64.Decode(App.Handle.Store.SignalingKey);
            var identityKeyPair = new IdentityKeyPair(Base64.Decode(App.Handle.Store.IdentityKeyPair));

            try
            {
                // I'm not sure where which parameter goes...
                // but it failes when the QR code is to old, so the first two are propably correct...
                await App.Handle.AccountManager.AddDeviceAsync(toAdd.Uuid, toAdd.PublicKey,
                         identityKeyPair,
                        profileKey,
                         code);
            }
            catch (libsignalservice.push.exceptions.NotFoundException)
            {
                // ToDo: Handle Divice not found
            }
        }

The Android code doesn't do much more, besides enabling MultiDevice. Which I can't find anywhere...

Still nothing happens on my WindowsPhone when I scan its code. An error is also not raised (unless the QR code is to old).

You can also see the pullrequest #232

I noticed that you forked this lost (but not archived yet) Signal-Sharp project/solution too (12 month ago). But why the issues disabled (on your side)? I think the whole solution "refresh" needed. I mean including the sub-projects (protocol, metadata, etc.) into your solution. The goal is some additional debugging...
Also you may to "pseudo-port" (automatically convert) Android's original solution from Java to C#.... After it, compare data models, api calls, etc...

mediaexplorer74 avatar Mar 15 '22 20:03 mediaexplorer74

I disabled it because I didn't want to maintain the project, I don't mind to makeing some pull requestes when I have time but maintaining a messenger, I just don't have the time :(

LokiMidgard avatar Mar 16 '22 10:03 LokiMidgard