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

Function prep_score_data

keepercommander/security_audit.py:84–100  ·  view source on GitHub ↗
(record)

Source from the content-addressed store, hash-verified

82 return sd
83
84def prep_score_data(record):
85 empty_score_data = crypto.encrypt_aes_v2(json.dumps(dict()).encode('utf8'), record.record_key)
86 score = get_security_score(record)
87 if score is None:
88 return empty_score_data
89
90 try:
91 password = _get_pass(record)
92 pad_length = max(25 - len(password), 0) if password else 0
93 pad = ''.join([' ' for _ in range(pad_length)])
94 score_data = dict(version=1, password=password, score=score, padding=pad)
95 data = json.dumps(score_data).encode('utf-8')
96 sec_score_data = crypto.encrypt_aes_v2(data, record.record_key)
97 except:
98 logging.error(f'Could not calculate security score data for record')
99 sec_score_data = empty_score_data
100 return sec_score_data
101
102def prep_score_data_update(params, record): # type: (KeeperParams, KeeperRecord) -> APIRequest_pb2.SecurityScoreData
103 ssd = APIRequest_pb2.SecurityScoreData()

Callers 2

prep_score_data_updateFunction · 0.85
attach_security_dataFunction · 0.85

Calls 3

get_security_scoreFunction · 0.85
_get_passFunction · 0.85
errorMethod · 0.45

Tested by

no test coverage detected