How to use the nucypher.characters.lawful.Enrico function in nucypher

To help you get started, we’ve selected a few nucypher examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github drbh / ncipfs / ncipfs.py View on Github external
def add_contents(self, alicia, my_label, contents): 
        """
        cid = client.add_contents(
            policy_pubkey=policy_pub_key
        )
        """
        policy_pubkey = alicia.get_policy_pubkey_from_label(my_label)

        data_source = Enrico(policy_encrypting_key=policy_pubkey)
        data_source_public_key = bytes(data_source.stamp)
        heart_rate = 80
        now = time.time()
        kits = list()
        heart_rate = contents
        now += 3
        heart_rate_data = { 'heart_rate': heart_rate, 'timestamp': now, }
        plaintext = msgpack.dumps(heart_rate_data, use_bin_type=True)
        message_kit, _signature = data_source.encrypt_message(plaintext)
        kit_bytes = message_kit.to_bytes()
        kits.append(kit_bytes)
        data = { 'data_source': data_source_public_key, 'kits': kits, }
#         print("🚀 ADDING TO IPFS D-STORAGE NETWORK 🚀")
        d = msgpack.dumps(data, use_bin_type=True)

        ### NETWORK ERROR OUT ON FALLBACK