# checkAffixElements function

bool checkAffixElements(

1. XMLNode envelope,
2. String sender,
3. JID ourJid

)

Checks the OMEMO affix elements. `envelope` refers to the <envelope> element we get after decrypting the payload. `sender` refers to the "to" attribute of the stanza. `ourJid` is our current full Jid.</envelope>

Returns true if the affix elements are all valid and as expected. Returns false if not.

## Implementation

    bool checkAffixElements(XMLNode envelope, String sender, JID ourJid) {
      final from = envelope.firstTag('from')?.attributes['jid'] as String?;
      if (from == null) return false;
      final encSender = JID.fromString(from);

      final to = envelope.firstTag('to')?.attributes['jid'] as String?;
      if (to == null) return false;
      final encReceiver = JID.fromString(to);

      return encSender.toBare().toString() ==
              JID.fromString(sender).toBare().toString() &&
          encReceiver.toBare().toString() == ourJid.toBare().toString();
    }