Retrieve the unencrypted folder key from nested_share_folders or subfolder_cache.
(params, folder_uid: str, raise_on_missing: bool = True)
| 29 | # ═══════════════════════════════════════════════════════════════════════════ |
| 30 | |
| 31 | def get_folder_key(params, folder_uid: str, raise_on_missing: bool = True) -> Optional[bytes]: |
| 32 | """Retrieve the unencrypted folder key from nested_share_folders or subfolder_cache.""" |
| 33 | for cache in (getattr(params, 'nested_share_folders', {}), |
| 34 | getattr(params, 'subfolder_cache', {})): |
| 35 | obj = cache.get(folder_uid) |
| 36 | if obj and 'folder_key_unencrypted' in obj: |
| 37 | return obj['folder_key_unencrypted'] |
| 38 | if raise_on_missing: |
| 39 | raise ValueError( |
| 40 | f"Folder key not found for folder {folder_uid}. " |
| 41 | f"Try running 'sync-down' first.") |
| 42 | return None |
| 43 | |
| 44 | |
| 45 | def get_record_key(params, record_uid: str, raise_on_missing: bool = True) -> Optional[bytes]: |
no test coverage detected