Retrieve the unencrypted folder key from nested_share_folders or subfolder_cache.
(params, folder_uid: str, raise_on_missing: bool = True)
| 64 | # ═══════════════════════════════════════════════════════════════════════════ |
| 65 | |
| 66 | def get_folder_key(params, folder_uid: str, raise_on_missing: bool = True) -> Optional[bytes]: |
| 67 | """Retrieve the unencrypted folder key from nested_share_folders or subfolder_cache.""" |
| 68 | for cache in (getattr(params, 'nested_share_folders', {}), |
| 69 | getattr(params, 'subfolder_cache', {})): |
| 70 | obj = cache.get(folder_uid) |
| 71 | if obj and 'folder_key_unencrypted' in obj: |
| 72 | return obj['folder_key_unencrypted'] |
| 73 | if raise_on_missing: |
| 74 | raise ValueError( |
| 75 | f"Folder key not found for folder {folder_uid}. " |
| 76 | f"Try running 'sync-down' first.") |
| 77 | return None |
| 78 | |
| 79 | |
| 80 | def get_record_key(params, record_uid: str, raise_on_missing: bool = True) -> Optional[bytes]: |
no test coverage detected