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

Function refetch_server_key

keepercommander/rest_api.py:379–393  ·  view source on GitHub ↗

After the server rejected a key: look for its key again, unless the user set it. Returns the new key, or None when there is no other key to try.

(context)

Source from the content-addressed store, hash-verified

377
378
379def refetch_server_key(context): # type: (RestApiContext) -> Optional[SelfManagedServerKey]
380 """After the server rejected a key: look for its key again, unless the user set it.
381 Returns the new key, or None when there is no other key to try."""
382 host = server_host(context.server_base)
383 old_key = _resolved_server_keys.get(host)
384 if old_key is not None and not old_key.fetched:
385 return None
386 _resolved_server_keys.pop(host, None)
387 _server_key_errors.pop(host, None)
388 new_key = get_self_managed_server_key(context)
389 if new_key is None:
390 return None
391 if old_key is not None and (new_key.key_id, new_key.public_key) == (old_key.key_id, old_key.public_key):
392 return None
393 return new_key
394
395
396def get_server_public_key(context): # type: (RestApiContext) -> Union[rsa.RSAPublicKey, ec.EllipticCurvePublicKey]

Callers 1

execute_restFunction · 0.85

Calls 3

server_hostFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected