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 call close() 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!
    
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      void addFrame(Array<byte> frame) Processes a single Frame protobuf message.
      void close() 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.