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

Does anyone knows how to implement Device linking? #233

Open
LokiMidgard opened this issue May 16, 2021 · 2 comments
Open

Does anyone knows how to implement Device linking? #233

LokiMidgard opened this issue May 16, 2021 · 2 comments

Comments

@LokiMidgard
Copy link

LokiMidgard commented May 16, 2021

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

@mediaexplorer74
Copy link

mediaexplorer74 commented Mar 15, 2022

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...

@LokiMidgard
Copy link
Author

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 :(

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

2 participants