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

Function load_user_public_keys

keepercommander/api.py:333–361  ·  view source on GitHub ↗
(params, emails, send_invites=False)

Source from the content-addressed store, hash-verified

331 return params.share_object_cache
332
333def load_user_public_keys(params, emails, send_invites=False): # type: (KeeperParams, List[str], bool) -> Optional[List[str]]
334 s = set((x.casefold() for x in emails))
335 s.difference_update(params.key_cache.keys())
336 if not s:
337 return
338
339 emails_to_load = list(s)
340 rq = APIRequest_pb2.GetPublicKeysRequest()
341 rq.usernames.extend(emails_to_load)
342 need_share_accept = []
343 rs = communicate_rest(params, rq, 'vault/get_public_keys', rs_type=APIRequest_pb2.GetPublicKeysResponse)
344 for pk in rs.keyResponses:
345 email = pk.username
346 if pk.errorCode in ['', 'success']:
347 rsa = pk.publicKey
348 ec = pk.publicEccKey
349 aes = params.data_key if email == params.user else None
350 params.key_cache[email] = PublicKeys(aes=aes, rsa=rsa, ec=ec)
351 elif pk.errorCode == 'no_active_share_exist':
352 need_share_accept.append(pk.username)
353 if len(need_share_accept) > 0 and send_invites:
354 for email in need_share_accept:
355 rq = APIRequest_pb2.SendShareInviteRequest()
356 rq.email = email
357 try:
358 communicate_rest(params, rq, 'vault/send_share_invite')
359 except Exception as e:
360 logging.debug('Share invite failed: %s', e)
361 return need_share_accept
362
363
364def load_team_keys(params, team_uids): # type: (KeeperParams, List[str]) -> None

Callers

nothing calls this directly

Calls 3

communicate_restFunction · 0.85
PublicKeysClass · 0.85
debugMethod · 0.45

Tested by

no test coverage detected