MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / get_crypt_key

Function get_crypt_key

web/pgadmin/utils/master_password.py:25–51  ·  view source on GitHub ↗

Returns the crypt key :return: the key

()

Source from the content-addressed store, hash-verified

23
24
25def get_crypt_key():
26 """
27 Returns the crypt key
28 :return: the key
29 """
30 enc_key = current_app.keyManager.get()
31 if enc_key is None:
32 if config.SERVER_MODE:
33 if config.MASTER_PASSWORD_REQUIRED:
34 return False, None
35 # Use the session key if available
36 if 'pass_enc_key' in session:
37 return True, session['pass_enc_key']
38
39 else:
40 # if desktop mode and master pass and
41 # local os secret is disabled then use the password hash
42 if not config.MASTER_PASSWORD_REQUIRED and\
43 not config.USE_OS_SECRET_STORAGE:
44 return True, current_user.password
45
46 # If master pass or local os secret enabled but enc_key is still None
47 # or pass_enc_key not in session
48 return False, None
49
50 # If enc_key is available, return True with the enc_key
51 return True, enc_key
52
53
54def get_master_password_key_from_os_secret():

Callers 15

check_master_passwordFunction · 0.90
reset_master_passwordFunction · 0.90
set_master_passwordFunction · 0.90
change_passwordFunction · 0.90
_set_valid_attr_valueMethod · 0.90
createMethod · 0.90
connectMethod · 0.90
change_passwordMethod · 0.90
connectMethod · 0.90
__cursorMethod · 0.90
_decrypt_passwordMethod · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected