Skip to content

Commit

Permalink
fix: explicit cipherKey at method params defaulting to legacy cryptor
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitpubnub committed Oct 9, 2023
1 parent fe02a01 commit 36bf022
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pubnub/lib/src/dx/files/files.dart
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ class FileDx {
/// If that fails as well, then it will throw [InvariantException].
List<int> encryptFile(List<int> bytes,
{CipherKey? cipherKey, Keyset? keyset, String? using}) {
if (cipherKey != null) {
return _core.crypto.encryptFileData(cipherKey, bytes);
}
keyset ??= _core.keysets[using];
return keyset.cipherKey == _core.keysets.defaultKeyset.cipherKey
? _core.crypto.encrypt(bytes)
Expand All @@ -306,6 +309,9 @@ class FileDx {
/// If that fails as well, then it will throw [InvariantException].
List<int> decryptFile(List<int> bytes,
{CipherKey? cipherKey, Keyset? keyset, String? using}) {
if (cipherKey != null) {
return _core.crypto.decryptFileData(cipherKey, bytes);
}
keyset ??= _core.keysets[using];
return keyset.cipherKey == _core.keysets.defaultKeyset.cipherKey
? _core.crypto.decrypt(bytes)
Expand Down

0 comments on commit 36bf022

Please sign in to comment.