addIfAbsent

open suspend override fun addIfAbsent(context: SecurityContext): Boolean(source)

Adds context unless a context with the same Recipient ID and ID Context is present, in one step that no other writer can interleave with, and returns whether it did. A writer that must never replace another's context uses this instead of add: EdhocServer adds every context it derives this way, and fails the handshake when the Recipient ID was taken meanwhile (RFC 9668 §4.1.2).