Esempio n. 1
0
def alice(ursulas, mock_policy_agent, nucypher_test_config):
    ALICE = Alice(network_middleware=MockNetworkyStuff(ursulas), policy_agent=mock_policy_agent, config=nucypher_test_config)
    ALICE.server.listen(8471)
    ALICE.__resource_id = b"some_resource_id"
    EVENT_LOOP.run_until_complete(ALICE.server.bootstrap([("127.0.0.1", u.dht_port) for u in ursulas]))
    ALICE.network_bootstrap([("127.0.0.1", u.rest_port) for u in ursulas])
    return ALICE
Esempio n. 2
0
#########
# Alice #
#########

ALICE = Alice(network_middleware=network_middleware)

# Here are our Policy details.
policy_end_datetime = maya.now() + datetime.timedelta(days=5)
m = 1
n = 1
label = b"secret/files/and/stuff"

# Alice gets on the network and, knowing about at least one Ursula,
# Is able to discover all Ursulas.
ALICE.network_bootstrap([("localhost", 3601)])

# Alice grants to Bob.
BOB = Bob()
policy = ALICE.grant(BOB, label, m=m, n=n, expiration=policy_end_datetime)

# Alice puts her public key somewhere for Bob to find later...
alices_pubkey_saved_for_posterity = bytes(ALICE.stamp)

# ...and then disappears from the internet.
del ALICE
# (this is optional of course - she may wish to remain in order to create
# new policies in the future.  The point is - she is no longer obligated.

#####################
# some time passes. #