unprotectRequest

abstract suspend fun unprotectRequest(request: CoapMessage, peer: Endpoint): UnprotectedRequest?(source)

Verifies and decrypts request from peer. Returns null when the request does not use this kind of protection, so the stack processes it as a plain request, which only resources whose AccessPolicy (kcoap-coap's server) permits it reach (with message security configured, the default policy refuses it, ADR 0008).

Throws

when the request is protected but invalid; the stack answers with MessageSecurityException.responseCode, unprotected, as RFC 8613 §8.2 requires.