How to use the nucypher.keystore.keypairs.SigningKeypair 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 act_as_bob(self, name):
        dirname = "accounts/" + name + "/"
        fname = dirname+"recipent.private.json"
        with open(fname) as data_file:    
            data = json.load(data_file)
        enc_privkey = UmbralPrivateKey.from_bytes(bytes.fromhex(data["enc"]))
        sig_privkey = UmbralPrivateKey.from_bytes(bytes.fromhex(data["sig"]))
        
        bob_enc_keypair = DecryptingKeypair(private_key=enc_privkey)
        bob_sig_keypair = SigningKeypair(private_key=sig_privkey)
        enc_power = DecryptingPower(keypair=bob_enc_keypair)
        sig_power = SigningPower(keypair=bob_sig_keypair)
        power_ups = [enc_power, sig_power]
        bob = Bob(
            is_me=True,
            federated_only=True,
            crypto_power_ups=power_ups,
            start_learning_now=True,
            abort_on_learning_error=True,
            known_nodes=[self.ursula],
            save_metadata=False,
            network_middleware=RestMiddleware(),
        )
        return bob