How to use the nucypher.characters.lawful.Bob.from_public_keys 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 creat_nucid(alice, cid, enc_pubkey, sig_pubkey, label):
    powers_and_material = { DecryptingPower: enc_pubkey, SigningPower: sig_pubkey }
    doctor_strange = Bob.from_public_keys(powers_and_material=powers_and_material, federated_only=True)
    policy_end_datetime = maya.now() + datetime.timedelta(days=5)
    # m, n = 1, 2
    m, n = 2, 3
    print(doctor_strange, label, m, n, policy_end_datetime)
    print(alice)
    policy = alice.grant(bob=doctor_strange, label=label, m=m, n=n, expiration=policy_end_datetime)
    policy_info = {
        "policy_pubkey": base58.b58encode(policy.public_key.to_bytes()).decode("utf-8"),
        "alice_sig_pubkey": base58.b58encode(bytes(alice.stamp)).decode("utf-8"),
        "label": label.decode("utf-8"),
    }
    
    store_url = "%s_%s_%s_%s"%(cid,
                               base58.b58encode(policy.public_key.to_bytes()).decode("utf-8"),
                               base58.b58encode(bytes(alice.stamp)).decode("utf-8"),
                               label.decode("utf-8"))