IsEncryptedParent returns true if the path points at a parent directory of encrypted data, i.e. is not a "real" directory. This is determined by checking for a sentinel string in the path.
(pathComponents []string)
| 658 | // encrypted data, i.e. is not a "real" directory. This is determined by |
| 659 | // checking for a sentinel string in the path. |
| 660 | func IsEncryptedParent(pathComponents []string) bool { |
| 661 | l := len(pathComponents) |
| 662 | if l == 2 && len(pathComponents[1]) != 2 { |
| 663 | return false |
| 664 | } else if l == 0 { |
| 665 | return false |
| 666 | } |
| 667 | if pathComponents[0] == "" { |
| 668 | return false |
| 669 | } |
| 670 | if pathComponents[0][1:] != encryptedDirExtension { |
| 671 | return false |
| 672 | } |
| 673 | if l < 2 { |
| 674 | return true |
| 675 | } |
| 676 | for _, comp := range pathComponents[2:] { |
| 677 | if len(comp) != maxPathComponent { |
| 678 | return false |
| 679 | } |
| 680 | } |
| 681 | return true |
| 682 | } |
| 683 | |
| 684 | type folderKeyRegistry struct { |
| 685 | keys map[string]*[keySize]byte // folder ID -> key |
no outgoing calls