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

Some implementation doubts #39

Closed PaoloP98 closed 3 years ago

PaoloP98 commented 3 years ago

From the example code, I see that this function generates a random number: var registerationId = KeyHelper.generateRegistrationId(false); Should I save this number in the database to retrieve it later? Must it be unique? I saw that the deviceid on PreKeyBundle is an integer, in my database I save it as uuid. can I leave "1" as the value?

crossle commented 3 years ago

Yes, you save it to database or other persist location. and upload to server, wait other part request your signal keys.

rlch commented 3 years ago

@PaoloP98 I use 1 as I'm not planning on supporting accounts with multiple devices. If you are, then you should consider saving a hash of the user's device ID for instance

PaoloP98 commented 3 years ago

Yes, you save it to database or other persist location. and upload to server, wait other part request your signal keys.

must have uniqueness as a constraint?

crossle commented 3 years ago

must have uniqueness as a constraint?

Recommend unique

PaoloP98 commented 3 years ago

must have uniqueness as a constraint?

Recommend unique

What if the random generation generates the same number? What should I do?

rlch commented 3 years ago

must have uniqueness as a constraint?

Recommend unique

What if the random generation generates the same number? What should I do?

This is addressed by hashing the user's device ID, see my comment above

PaoloP98 commented 3 years ago

must have uniqueness as a constraint?

Recommend unique

What if the random generation generates the same number? What should I do?

This is addressed by hashing the user's device ID, see my comment above

I didn't understand why to hash the device id. Can you give me some clarification or a source? Do you mean that even if the registerationId is not unique paired with the device id (unique) it is fine?