handle

suspend fun handle(payload: ByteArray, peer: Endpoint): CoapResponse(source)

Answers a POST from peer to the EDHOC resource whose body is payload (RFC 9528 Appendix A.2.1): a 2.04 with message_2 for true, message_1, a 2.04 with message_4 or without payload for C_R, message_3, and a 2.04 for C_R, error message, which ends the session.

It never throws for anything the peer sent: a malformed payload (EdhocOverCoap.parseRequest) and every failed EDHOC step become the EDHOC error response of RFC 9528 Appendix A.2.3, a 4.00, or a 5.00 for a message_1 refused over the bounds on pending sessions and for a failure of this server after message_3 (its context repository, sequence number store or listener throwing). Only cancellation passes through.