MCPcopy Index your code
hub / github.com/syncthing/syncthing / finalizeEncrypted

Method finalizeEncrypted

lib/model/sharedpullerstate.go:374–382  ·  view source on GitHub ↗

finalizeEncrypted adds a trailer to the encrypted file containing the serialized FileInfo and the length of that FileInfo. When initializing a folder from encrypted data we can extract this FileInfo from the end of the file and regain the original metadata.

()

Source from the content-addressed store, hash-verified

372// folder from encrypted data we can extract this FileInfo from the end of
373// the file and regain the original metadata.
374func (s *sharedPullerState) finalizeEncrypted() error {
375 trailerSize, err := writeEncryptionTrailer(s.file, s.writer)
376 if err != nil {
377 return err
378 }
379 s.file.Size += trailerSize
380 s.file.EncryptionTrailerSize = int(trailerSize)
381 return nil
382}
383
384// Returns the size of the written trailer.
385func writeEncryptionTrailer(file protocol.FileInfo, writer io.WriterAt) (int64, error) {

Callers 1

finalCloseMethod · 0.95

Calls 1

writeEncryptionTrailerFunction · 0.85

Tested by

no test coverage detected