Beispiel #1
0
    def take_action(self, parsed_args):
        vargs = vars(parsed_args)
        key = utils.locale_to_unicode(vargs["key"])
        value = utils.locale_to_unicode(vargs["value"])
        typ = vargs["type"] or T_STRING
        conversion = CONVERSIONS.get(typ)
        if conversion is None:
            print("Unrecognized type %s" % typ)

        cfg.set_value(key, conversion(value))
        print("Wrote '%s': %s in config." % (key, value))
Beispiel #2
0
def key_and_peer_wizard():
    on("KEY", common.set_key_wizard)
    client.register_crypto_client(cfg)
    name = on(
        "PEER_NAME", lambda: utils.locale_to_unicode(
            ui.ask_value("PEER_NAME", "Specify name to register as peer")))
    peer_id = on("PEER_ID", lambda: do_register_wizard(name))
    client.peer_import(peer_id)
Beispiel #3
0
def key_and_peer_wizard():
    key = on("KEY", set_key_wizard)
    client.register_crypto_client(cfg)
    name = on(
        "PEER_NAME", lambda: utils.locale_to_unicode(
            ui.ask_value("PEER_NAME", "Specify name to register as peer")))
    params = cfg.get("CRYPTO_PARAMS")
    key_data = key["PUBLIC"]
    peer_id = on("PEER_ID",
                 lambda: client.peer_create(name, params, key_data)['peer_id'])
    ui.inform("PEER_ID = %s" % peer_id)
Beispiel #4
0
    def take_action(self, parsed_args):
        client = mk_panoramix_client(cfg)
        vargs = vars(parsed_args)
        consensus_id = vargs["consensus_id"]
        negotiation_id = vargs["negotiation_id"]
        accept = vargs["accept"]
        name = vargs["name"]
        if name is None:
            name = cfg.get("NAME")
        name = utils.locale_to_unicode(name)
        owners = vargs["owners"]
        owners = owners.split(',') if owners else []

        is_contrib, d = client.peer_create(name, True, owners, consensus_id,
                                           negotiation_id, accept)
        id_key = "id" if is_contrib else "peer_id"
        print("%s" % d["data"][id_key])
Beispiel #5
0
 def take_action(self, parsed_args):
     vargs = vars(parsed_args)
     key = utils.locale_to_unicode(vargs["key"])
     cfg.pop(key)
     print("Deleted key '%s' from config." % key)
Beispiel #6
0
def get_endpoint_name():
    return utils.locale_to_unicode(
        ui.ask_value("ENDPOINT_NAME",
                     "Specify endpoint name to create on combined peer"))
Beispiel #7
0
def create_contribution_id(negotiation_id):
    name = utils.locale_to_unicode(
        ui.ask_value("name", "Choose mixnet peer name"))
    return create_provisional_peer_contrib(negotiation_id, name)