def _item_attributes_match()

in src/dynamodb_encryption_sdk/internal/utils.py [0:0]


def _item_attributes_match(crypto_config, plaintext_item, encrypted_item):
    # type: (CryptoConfig, Dict, Dict) -> bool
    """Determines whether the unencrypted values in the plaintext items attributes are the same as those in the
    encrypted item. Essentially this uses brute force to cover when we don't know the primary and sort
    index attribute names, since they can't be encrypted.

    :param CryptoConfig crypto_config: CryptoConfig used in encrypting the given items
    :param dict plaintext_item: The plaintext item
    :param dict encrypted_item: The encrypted item
    :return: Bool response, True if the unencrypted attributes in the plaintext item match those in
    the encrypted item
    :rtype: bool
    """

    for name, value in plaintext_item.items():
        if crypto_config.attribute_actions.action(name) == CryptoAction.ENCRYPT_AND_SIGN:
            continue

        if encrypted_item.get(name) != value:
            return False

    return True