View Source ATECC508A.Request (atecc508a v1.3.0)
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.
Functions
Calculates ECDH secret.
Create a genkey request message.
Lock a specific slot.
Create a message to lock a zone.
Request a random number.
Create a read message
Sign a SHA256 digest.
Create a write message
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
@spec ecdh(ATECC508A.Transport.t(), binary()) :: {:ok, binary()} | {:error, atom()}
Calculates ECDH secret.
@spec genkey(ATECC508A.Transport.t(), slot(), boolean()) :: {:ok, binary()} | {:error, atom()}
Create a genkey request message.
@spec lock_slot(ATECC508A.Transport.t(), slot()) :: :ok | {:error, atom()}
Lock a specific slot.
@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.
@spec read_zone(ATECC508A.Transport.t(), zone(), addr(), access_size()) :: {:ok, binary()} | {:error, atom()}
Create a read message
@spec sign_digest(ATECC508A.Transport.t(), slot(), binary()) :: {:ok, binary()} | {:error, atom()}
Sign a SHA256 digest.
@spec to_config_addr(0..127) :: addr()
@spec to_otp_addr(0..127) :: addr()
@spec write_zone(ATECC508A.Transport.t(), zone(), addr(), access_data()) :: :ok | {:error, atom()}
Create a write message