Class OnlineBackupValidator
-
- All Implemented Interfaces:
-
java.lang.AutoCloseable,org.signal.libsignal.internal.NativeHandleGuard.Owner
public class OnlineBackupValidator extends NativeHandleGuard.SimpleOwner implements AutoCloseable
An alternative to validate that validates a backup frame-by-frame.
This is much faster than using
MessageBackup.validate()because it bypasses the decryption and decompression steps, but that also means it's validating less. Don't forget to callclose()or use try-with-resources syntax!Unlike
MessageBackup.validate(), unknown fields are treated as "soft" errors and logged, rather than collected and returned to the app for processing.const validator = new OnlineBackupValidator( backupInfoProto.serialize(), MessageBackup.Purpose.DEVICE_TRANSFER) repeat { // ...generate Frames... validator.addFrame(frameProto.serialize()) } validator.finalize() // don't forget this!
-
-
Constructor Summary
Constructors Constructor Description OnlineBackupValidator(Array<byte> backupInfo, MessageBackup.Purpose purpose)Initializes an OnlineBackupValidator from the given BackupInfo protobuf message.
-
Method Summary
Modifier and Type Method Description voidaddFrame(Array<byte> frame)Processes a single Frame protobuf message. voidclose()Marks that a backup is complete, and does any final checks that require whole-file knowledge. -
Methods inherited from class org.signal.libsignal.internal.NativeHandleGuard.SimpleOwner
unsafeNativeHandleWithoutGuard -
Methods inherited from class org.signal.libsignal.internal.NativeHandleGuard.Owner
guard, guardedMap, guardedMapChecked, guardedRun, guardedRunChecked -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
OnlineBackupValidator
OnlineBackupValidator(Array<byte> backupInfo, MessageBackup.Purpose purpose)
Initializes an OnlineBackupValidator from the given BackupInfo protobuf message.
-
-
Method Detail
-
addFrame
void addFrame(Array<byte> frame)
Processes a single Frame protobuf message.
"Soft" errors will be logged, including unrecognized fields in the protobuf.
-
close
void close()
Marks that a backup is complete, and does any final checks that require whole-file knowledge.
"Soft" errors will be logged.
-
-
-
-