finish method
Seals the final chunk. totalLength is the full plaintext length.
Implementation
Future<void> finish(int totalLength) async {
if (_endOffset == null) await _sealFinal(totalLength);
// A resumed file may hold stale bytes past the new end from an earlier, longer attempt.
await _sink.truncate(_endOffset!);
}