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

Function add_record_audit_data

keepercommander/api.py:1184–1215  ·  view source on GitHub ↗
(params, record_uids)

Source from the content-addressed store, hash-verified

1182
1183
1184def add_record_audit_data(params, record_uids): # type: (KeeperParams, Iterable[str]) -> None
1185 if not params.enterprise_ec_key:
1186 return
1187
1188 uids = set((x for x in record_uids if x in params.record_cache))
1189 audit_data = [] # type: List[record_pb2.RecordAddAuditData]
1190 for record_uid in uids:
1191 record = get_record(params, record_uid)
1192 if record:
1193 if record.title:
1194 title = record.title
1195 if len(title) > 900:
1196 title = title[:900]
1197 audit = record_pb2.RecordAddAuditData()
1198 audit.record_uid = utils.base64_url_decode(record_uid)
1199 audit.revision = record.revision
1200 data = {
1201 'title': title,
1202 'record_type': record.record_type,
1203 }
1204 if record.login_url:
1205 data['url'] = utils.url_strip(record.login_url)
1206 audit.data = crypto.encrypt_ec(json.dumps(data).encode('utf-8'), params.enterprise_ec_key)
1207 audit_data.append(audit)
1208
1209 if audit_data:
1210 rq = record_pb2.AddAuditDataRequest()
1211 rq.records.extend(audit_data)
1212 try:
1213 communicate_rest(params, rq, 'vault/record_add_audit_data')
1214 except Exception as e:
1215 logging.info('Failed to store audit data: %s', str(e))
1216
1217
1218def add_record_v3(params, record, **kwargs): # type: (KeeperParams, dict, ...) -> Optional[bool]

Callers 1

update_recordFunction · 0.70

Calls 4

communicate_restFunction · 0.85
get_recordFunction · 0.70
encodeMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected