validateOmniBundle function
Future<void>
validateOmniBundle(
- String directory,
- List<
RemoteFile> sources, - String mmproj, {
- void check()?,
Full installed payload verification, cancellable between file chunks.
Implementation
Future<void> validateOmniBundle(
String directory,
List<RemoteFile> sources,
String mmproj, {
void Function()? check,
}) async {
final files = _manifest(directory, sources, mmproj);
for (final name in files.keys.cast<String>()) {
final chunks = File('$directory/$name').openRead().map((chunk) {
check?.call();
return chunk;
});
if ((await sha256.bind(chunks).first).toString() != files[name]['sha256']) {
throw FormatException('Omni bundle hash differs: $name');
}
}
check?.call();
}