in features/awses_message_encryption_utils.py [0:0]
def _split_on_decryptable(keys, filter_function, key_builder):
"""Filter keys manifest keys of specified type into two groups: those that can both encrypt
and decrypt and those that can only encrypt.
:param dict keys: Parsed keys manifest
:param callable filter_function: Callable that will filter keys
:param key_builder: Function that returns a properly formed master key configuration given
a key name and configuration from the keys manifest
:returns: list of cyclable master key configurations and list of encrypt only master key configurations
"""
encrypt_only = []
cyclable = []
for name, key in filter_function(keys):
if key["encrypt"]:
if key["decrypt"]:
cyclable.append(key_builder(name, key))
else:
encrypt_only.append(key_builder(name, key))
return cyclable, encrypt_only