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

Return nullables rather than throwing errors #71

Closed abhay-s-rawat closed 1 year ago

abhay-s-rawat commented 1 year ago
abstract class PreKeyStore {
  Future<PreKeyRecord> loadPreKey(int preKeyId); //  throws InvalidKeyIdException; <=== cant we change this to nullable return value rather than throwing error ?

  Future<void> storePreKey(int preKeyId, PreKeyRecord record);

  Future<bool> containsPreKey(int preKeyId);

  Future<void> removePreKey(int preKeyId);
}

It is present in stores, if you allow I can submit a pull request with new version as this might be bad for previous code users.

crossle commented 1 year ago

Welcome PR, Thanks

abhay-s-rawat commented 1 year ago

Actually I when I made them nullables entire library needed changes as it was expecting changes to be made where it was expecting things to be non nullable. I was showcked when I was building session and I was not able to because I made changes like return null if variable is null but in sessionstore when session is not present it was returning empty session it was not expecting null. If I broke 1 part with just as null check I think I made mistaes in many other parts too. Lets keep it like it is normally. A try catch can handle things better.

1 more request can you make this library depend on collection ^1.17.1 as latest stable sdk is dependent on it but this lib is depends on collection ^1.17.2 and using dependency overrides does not make it a better , itmay break code.

If you allow shall I update pubspec and submit PR ?

crossle commented 1 year ago

DONE https://github.com/MixinNetwork/libsignal_protocol_dart/commit/965b5bbaf81a9c578711dd04cf162dae6846b2fd

abhay-s-rawat commented 1 year ago

DONE 965b5bb

When we can expect that to be in pub.dev ?

crossle commented 1 year ago

DONE 965b5bb

When we can expect that to be in pub.dev ?

https://pub.dev/packages/libsignal_protocol_dart

abhay-s-rawat commented 1 year ago

Thanks a lot.