View Source ATECC508A.Request (atecc508a v1.2.1)

This module knows how to send requests to the ATECC508A.

Summary

Types

A transaction is a tuple with the binary to send, how long to wait in milliseconds for the response and the size of payload to expect to read for the response.

Types

@type access_data() :: <<_::32>> | <<_::256>>
@type access_size() :: 4 | 32
@type addr() :: 0..65535
@type block() :: 0..3
@type offset() :: 0..7
@type slot() :: 0..15
@type transaction() :: {binary(), non_neg_integer(), non_neg_integer()}

A transaction is a tuple with the binary to send, how long to wait in milliseconds for the response and the size of payload to expect to read for the response.

@type zone() :: :config | :otp | :data

Functions

Link to this function

genkey(transport, key_id, create_key?)

View Source
@spec genkey(ATECC508A.Transport.t(), slot(), boolean()) ::
  {:ok, binary()} | {:error, atom()}

Create a genkey request message.

Link to this function

lock_slot(transport, slot)

View Source
@spec lock_slot(ATECC508A.Transport.t(), slot()) :: :ok | {:error, atom()}

Lock a specific slot.

Link to this function

lock_zone(transport, zone, zone_crc)

View Source
@spec lock_zone(ATECC508A.Transport.t(), zone(), ATECC508A.crc16()) ::
  :ok | {:error, atom()}

Create a message to lock a zone.

@spec random(ATECC508A.Transport.t()) :: {:ok, binary()} | {:error, atom()}

Request a random number.

Link to this function

read_zone(transport, zone, addr, length)

View Source
@spec read_zone(ATECC508A.Transport.t(), zone(), addr(), access_size()) ::
  {:ok, binary()} | {:error, atom()}

Create a read message

Link to this function

sign_digest(transport, key_id, digest)

View Source
@spec sign_digest(ATECC508A.Transport.t(), slot(), binary()) ::
  {:ok, binary()} | {:error, atom()}

Sign a SHA256 digest.

Link to this function

to_config_addr(byte_offset)

View Source
@spec to_config_addr(0..127) :: addr()
Link to this function

to_config_addr(block, offset)

View Source
@spec to_config_addr(block(), offset()) :: addr()
Link to this function

to_data_addr(slot, byte_offset)

View Source
@spec to_data_addr(slot(), 0..416) :: addr()
Link to this function

to_data_addr(slot, block, offset)

View Source
@spec to_data_addr(slot(), block(), offset()) :: addr()
Link to this function

to_otp_addr(byte_offset)

View Source
@spec to_otp_addr(0..127) :: addr()
Link to this function

to_otp_addr(block, offset)

View Source
@spec to_otp_addr(block(), offset()) :: addr()
Link to this function

write_zone(transport, zone, addr, data)

View Source
@spec write_zone(ATECC508A.Transport.t(), zone(), addr(), access_data()) ::
  :ok | {:error, atom()}

Create a write message