|
|
|
@ -16,6 +16,7 @@ NSString *const kOWSBackup_ManifestKey_AttachmentFiles = @"attachment_files";
|
|
|
|
|
NSString *const kOWSBackup_ManifestKey_RecordName = @"record_name";
|
|
|
|
|
NSString *const kOWSBackup_ManifestKey_EncryptionKey = @"encryption_key";
|
|
|
|
|
NSString *const kOWSBackup_ManifestKey_RelativeFilePath = @"relative_file_path";
|
|
|
|
|
NSString *const kOWSBackup_ManifestKey_AttachmentId = @"attachment_id";
|
|
|
|
|
NSString *const kOWSBackup_ManifestKey_DataSize = @"data_size";
|
|
|
|
|
|
|
|
|
|
NSString *const kOWSBackup_KeychainService = @"kOWSBackup_KeychainService";
|
|
|
|
@ -257,6 +258,7 @@ NSString *const kOWSBackup_KeychainService = @"kOWSBackup_KeychainService";
|
|
|
|
|
NSString *_Nullable recordName = itemMap[kOWSBackup_ManifestKey_RecordName];
|
|
|
|
|
NSString *_Nullable encryptionKeyString = itemMap[kOWSBackup_ManifestKey_EncryptionKey];
|
|
|
|
|
NSString *_Nullable relativeFilePath = itemMap[kOWSBackup_ManifestKey_RelativeFilePath];
|
|
|
|
|
NSString *_Nullable attachmentId = itemMap[kOWSBackup_ManifestKey_AttachmentId];
|
|
|
|
|
NSNumber *_Nullable uncompressedDataLength = itemMap[kOWSBackup_ManifestKey_DataSize];
|
|
|
|
|
if (![recordName isKindOfClass:[NSString class]]) {
|
|
|
|
|
OWSProdLogAndFail(@"%@ manifest has invalid recordName: %@.", self.logTag, key);
|
|
|
|
@ -271,6 +273,11 @@ NSString *const kOWSBackup_KeychainService = @"kOWSBackup_KeychainService";
|
|
|
|
|
OWSProdLogAndFail(@"%@ manifest has invalid relativeFilePath: %@.", self.logTag, key);
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
// attachmentId is an optional field.
|
|
|
|
|
if (attachmentId && ![attachmentId isKindOfClass:[NSString class]]) {
|
|
|
|
|
OWSProdLogAndFail(@"%@ manifest has invalid attachmentId: %@.", self.logTag, key);
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
NSData *_Nullable encryptionKey = [NSData dataFromBase64String:encryptionKeyString];
|
|
|
|
|
if (!encryptionKey) {
|
|
|
|
|
OWSProdLogAndFail(@"%@ manifest has corrupt encryptionKey: %@.", self.logTag, key);
|
|
|
|
@ -286,6 +293,7 @@ NSString *const kOWSBackup_KeychainService = @"kOWSBackup_KeychainService";
|
|
|
|
|
item.recordName = recordName;
|
|
|
|
|
item.encryptionKey = encryptionKey;
|
|
|
|
|
item.relativeFilePath = relativeFilePath;
|
|
|
|
|
item.attachmentId = attachmentId;
|
|
|
|
|
item.uncompressedDataLength = uncompressedDataLength;
|
|
|
|
|
[items addObject:item];
|
|
|
|
|
}
|
|
|
|
|