Skip to content

Commit

Permalink
Update data_bundler.dart
Browse files Browse the repository at this point in the history
- add the cipher tag
  • Loading branch information
thiagocarvalhodev committed Sep 26, 2023
1 parent fadec09 commit 580608e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/ardrive_uploader/lib/src/data_bundler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ class ARFSDataBundlerStable implements DataBundler<ARFSUploadMetadata> {

metadata.entityMetadataTags
.add(Tag(EntityTag.cipherIv, encodeBytesToBase64(metadataCipherIv)));
metadata.entityMetadataTags.add(Tag(EntityTag.cipher, Cipher.aes256ctr));
} else {
print('DriveKey is null. Skipping metadata encryption.');
metadataGenerator = () => Stream.fromIterable(metadataBytes);
Expand Down Expand Up @@ -349,8 +350,11 @@ class ARFSDataBundlerStable implements DataBundler<ARFSUploadMetadata> {

metadataStreamGenerator = encryptMetadataStreamResult.streamGenerator;

// TODO: REVIEW
metadata.entityMetadataTags.add(
Tag(EntityTag.cipherIv, encodeBytesToBase64(metadataCipherIv)));
metadata.entityMetadataTags
.add(Tag(EntityTag.cipher, Cipher.aes256ctr));
} else {
print('DriveKey is null. Skipping metadata encryption.');
metadataStreamGenerator = () => Stream.fromIterable(metadataBytes);
Expand Down Expand Up @@ -517,6 +521,7 @@ class ARFSDataBundlerStable implements DataBundler<ARFSUploadMetadata> {

metadata.entityMetadataTags
.add(Tag(EntityTag.cipherIv, encodeBytesToBase64(metadataCipherIv)));
metadata.entityMetadataTags.add(Tag(EntityTag.cipher, Cipher.aes256ctr));
} else {
print('DriveKey is null. Skipping metadata encryption.');
metadataStreamGenerator = () => Stream.fromIterable(metadataBytes);
Expand Down Expand Up @@ -630,7 +635,9 @@ class ARFSDataBundlerStable implements DataBundler<ARFSUploadMetadata> {
final tags = metadata.dataItemTags;

if (cipherIv != null) {
// TODO: REVIEW THIS
tags.add(Tag(EntityTag.cipher, encodeBytesToBase64(cipherIv)));
tags.add(Tag(EntityTag.cipherIv, Cipher.aes256ctr));
}

final dataItemFile = DataItemFile(
Expand Down

0 comments on commit 580608e

Please sign in to comment.