How do you connect to AWS IoT and pub/sub MQTT messages using Toit?
I was able to follow the MQTT tutorial on the Toit Docs site (https://docs.toit.io/tutorials/mqtt/#tls), which worked great for non-TLS between my ESP32 running Toit and a Raspberry Pi running mosquitto.
However, I am now trying to to pub/sub messages with AWS IoT Core. As instructed in the TLS section of the Toit MQTT tutorial I have installed the Toit root certs package:
jag pkg install github.com/toitware/toit-cert-roots@v1
I changed --root_certificates=[certificate_roots.ISRG_ROOT_X1]
to --root_certificates=[certificate_roots.AMAZON_ROOT_CA_1]
when creating the transport
. However, it is not clear how or where to specify the device certificate and the private key.
In the Toit MQTT Library documentation (https://pkg.toit.io/github.com/toitware/mqtt@2.2.0/docs/mqtt/class-TcpTransport), it shows how you can specify a parameter called --certificate
of type Certificate
.
tls network/Interface --host/string --port/int= --root_certificates/List= --server_name/string= --certificate/Certificate= -> TcpTransport
- Is this where you specify the device cert and private key?
- If so, how do you create a
Certificate
object?
- If so, how do you create a
- Do you specify
--certificate
two times?