Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(device=None):
if not device:
raise ValueError("device")
expected = {
"ATECC508A": b'\x07\x00\x00P\x00\x03\x91',
"ATECC608A": b'\x07\x00\x00`\x02\x808'
}
packet = device.atcab_info()
assert packet.response_data == expected[device.device], hexlify(packet.response_data)
log.debug("atcab_info: %s", hexlify(packet.response_data))
packet = device.atcab_info_base(INFO_MODE_REVISION)
assert packet.response_data == expected[device.device], hexlify(packet.response_data)
log.debug("atcab_info_base - revision: %s", hexlify(packet.response_data))
expected = b'\x07\x00\x00\x00\x00\x03\xad'
packet = device.atcab_info_base(INFO_MODE_STATE)
assert expected == packet.response_data, hexlify(packet.response_data)
log.debug("atcab_info_base - state: %s", hexlify(packet.response_data))
def run(atecc508a=None):
if not atecc508a:
atecc508a = ATECC508A()
expected = b'\x07\x00\x00P\x00\x03\x91'
packet = atecc508a.atcab_info()
assert expected == packet.response_data
log.debug("atcab_info: %s", hexlify(packet.response_data))
packet = atecc508a.atcab_info_base(INFO_MODE_REVISION)
assert expected == packet.response_data
log.debug("atcab_info_base - revision: %s", hexlify(packet.response_data))
expected = b'\x07\x00\x00\x00\x00\x03\xad'
packet = atecc508a.atcab_info_base(INFO_MODE_STATE)
assert expected == packet.response_data
log.debug("atcab_info_base - state: %s", hexlify(packet.response_data))
def atcab_info(self):
return self.atcab_info_base(ATCA_CONSTANTS.INFO_MODE_REVISION)