Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyen Van Nguyen <[email protected]>
  • Loading branch information
nguyennv committed Dec 11, 2024
1 parent 5017477 commit 5a1f76f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions lib/src/message/literal_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,20 @@ final class LiteralMessage extends BaseMessage
final Iterable<KeyInterface> encryptionKeys, [
final SymmetricAlgorithm defaultSymmetric = SymmetricAlgorithm.aes128,
]) {
var preferredSymmetrics = SymmetricAlgorithm.preferredSymmetrics;
for (final key in encryptionKeys) {
preferredSymmetrics = preferredSymmetrics
.where(
(symmetric) => key.preferredSymmetrics.contains(symmetric),
)
.toList();
final SymmetricAlgorithm symmetric;
if (encryptionKeys.isNotEmpty) {
var preferredSymmetrics = SymmetricAlgorithm.preferredSymmetrics;
for (final key in encryptionKeys) {
preferredSymmetrics = preferredSymmetrics
.where(
(symmetric) => key.preferredSymmetrics.contains(symmetric),
)
.toList();
}
symmetric = preferredSymmetrics.firstOrNull ?? defaultSymmetric;
} else {
symmetric = defaultSymmetric;
}
final symmetric = preferredSymmetrics.firstOrNull ?? defaultSymmetric;

var preferredAeads = [
AeadAlgorithm.ocb,
Expand Down

0 comments on commit 5a1f76f

Please sign in to comment.