MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / get_folder_key

Function get_folder_key

keepercommander/nested_share_folder/common.py:31–42  ·  view source on GitHub ↗

Retrieve the unencrypted folder key from nested_share_folders or subfolder_cache.

(params, folder_uid: str, raise_on_missing: bool = True)

Source from the content-addressed store, hash-verified

29# ═══════════════════════════════════════════════════════════════════════════
30
31def 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
45def get_record_key(params, record_uid: str, raise_on_missing: bool = True) -> Optional[bytes]:

Callers 15

build_nsf_record_addFunction · 0.85
classify_secretMethod · 0.85
_send_nsf_batchesMethod · 0.85
_create_recordsMethod · 0.85
_build_record_metadataFunction · 0.85
move_record_v3Function · 0.85
_build_update_dataFunction · 0.85
grant_folder_access_v3Function · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected