Exemple #1
0
    def transform_attrib_for_ledger(txn):
        """
        Creating copy of result so that `RAW`, `ENC` or `HASH` can be
        replaced by their hashes. We do not insert actual attribute data
        in the ledger but only the hash of it.
        """
        txn = deepcopy(txn)
        attr_type, _, value = domain.parse_attr_txn(txn)
        if attr_type in [RAW, ENC]:
            txn[attr_type] = domain.hash_of(value) if value else ''

        return txn
    def transform_attrib_for_ledger(txn):
        """
        Creating copy of result so that `RAW`, `ENC` or `HASH` can be
        replaced by their hashes. We do not insert actual attribute data
        in the ledger but only the hash of it.
        """
        txn = deepcopy(txn)
        attr_type, _, value = domain.parse_attr_txn(txn)
        if attr_type in [RAW, ENC]:
            txn[attr_type] = domain.hash_of(value) if value else ''

        return txn
    def transform_attrib_for_ledger(txn):
        """
        Creating copy of result so that `RAW`, `ENC` or `HASH` can be
        replaced by their hashes. We do not insert actual attribute data
        in the ledger but only the hash of it.
        """
        txn = deepcopy(txn)
        attr_key, value = domain.parse_attr_txn(txn)
        hashed_val = domain.hash_of(value) if value else ''

        if RAW in txn:
            txn[RAW] = hashed_val
        elif ENC in txn:
            txn[ENC] = hashed_val
        elif HASH in txn:
            txn[HASH] = txn[HASH]
        return txn