MixinNetwork / libsignal_protocol_dart

Signal Protocol library for Dart/Flutter
https://pub.dev/packages/libsignal_protocol_dart
GNU General Public License v3.0
159 stars 42 forks source link

Cannot import device consistency libraries. #72

Open abhay-s-rawat opened 1 year ago

abhay-s-rawat commented 1 year ago

I think by adding it to export on libsignal_protocol_dart.dart would solve this problem.

abhay-s-rawat commented 1 year ago

And DeviceConsistencyMessage also needs the export. Shall I submit PR.

And I couldn't find much about this module in signal protocol. I guess it is for user who is using multiple devices.

Eg: User has 4 device namely 1,2,3,4 He will send DeviceConsistencyMessage from 1 to 2/3/4 to verify about the devices , right ?

abhay-s-rawat commented 1 year ago

I am not sure how it works acccording to myunderstanding it is like below:

bob is using 3 devices
Bob is currently on device 1

final keyList = <IdentityKey>[
      deviceOne.getPublicKey(), // public key of current device
      deviceTwo.getPublicKey(), // public key of 2nd device
      deviceThree.getPublicKey() // public key of 3rd device
    ];
//bob creates a commitment and consistency message
final deviceOneCommitment = DeviceConsistencyCommitment(1, keyList);
final deviceOneMessage =
        DeviceConsistencyMessage(deviceOneCommitment, deviceOne);

//bob send deviceOneMessage consistency message to devices 2 and 3.
//bob send deviceTwoMessage consistency message to devices 1 and 3.
//bob send deviceThreeMessage consistency message to devices 1 and 2.

// ON device 1 below will happen and similar will happen to 2/3
final receivedDeviceTwoMessage = DeviceConsistencyMessage.fromSerialized(
        deviceOneCommitment,
        deviceTwoMessage.serialized,
        deviceTwo.getPublicKey());
    final receivedDeviceThreeMessage = DeviceConsistencyMessage.fromSerialized(
        deviceOneCommitment,
        deviceThreeMessage.serialized,
        deviceThree.getPublicKey());
final codeOne = generateCode(deviceOneCommitment, [
      deviceOneMessage,
      receivedDeviceTwoMessage,
      receivedDeviceThreeMessage
    ]);

Now this codeOne has to be same on every device , right ?
abhay-s-rawat commented 1 year ago

And 1 more thing Future<List> getSubDeviceSessions(String name) async {} in session store will always return all sessions.

If we convert it to below; Future<List> getSubDeviceSessions(String name, int exceptDeviceId) async {} It can return subsessions except specific device session according to its functions name.

I am not sure of the pupose of it, can you please clear me on this ?

abhay-s-rawat commented 1 year ago

DeviceConsistencyCommitment has serialized getter but how to create DeviceConsistencyCommitment from serialized ? Can we create it like this always DeviceConsistencyCommitment(1, keyList) ?