load static method
Loads a remote attachment by fetching, decrypting, and parsing it
This method handles the complete flow of:
- Fetching the encrypted payload from the remote URL
- Verifying the content digest (SHA-256)
- Decrypting the payload using AES-GCM
- Parsing the decrypted bytes as an AttachmentContent
Note: This method does NOT handle caching. The caller is responsible for checking cache before calling this method and storing the result afterward.
Implementation
static Future<AttachmentContent> load(RemoteAttachmentContent content) async {
try {
print('RemoteAttachment: Fetching from network');
final attachment = await _fetchDecryptAndParse(content);
return attachment;
} catch (e) {
print('Error loading remote attachment: $e');
rethrow; // Rethrow to preserve stack trace
}
}