def setup(*args, **kwargs):
    master_password, signing_password = generate_password()
    password_data = dict( encryption_key=make_key(master_password), signing_key=make_key(signing_password) )
    container_name, api_token = make_dccfile(master_password, signing_password)
    save_passwd(api_token, container_name, password_data, signing_password)
    save_vfs(api_token, container_name, VFS(), get_key(master_password, password_data['encryption_key']), get_key(signing_password, password_data['signing_key']))
    return 0
def add_file(*args, **kwargs):
    if len(args) == 0 or '--help' in ''.join(args):
        map(print, [
            'About: This command adds a file to Dropbox by encrypting and signing the file using your private key.',
            '',
            'Usage: $ dcc add <path,...>',
            '',
            'Specify one or more paths delimited by spaces. Paths to files can be absolute or relative but must',
            'point to a file. Paths can refer to files outside of this directory.',
        ])
        return 1
    encryption_key, signing_key, api_token, human_container_name, container_name = prompt_userinfo(
    )
    vfs = load_vfs(api_token, container_name, encryption_key, signing_key)
    for arg in args:
        if len(arg) > 0:
            full_path = normpath(join(getcwd(), arg))
            if isfile(full_path):
                with open(full_path, 'r') as source_file:
                    file_uuid = vfs.add_file(full_path)
                    upload_file(
                        api_token, container_name,
                        encrypt(source_file.read(), encryption_key,
                                signing_key), file_uuid)
                    print('[DONE] `%s` ~> `%s`' % (full_path, file_uuid))
    save_vfs(api_token, container_name, vfs, encryption_key, signing_key)
    return 0
def setup(*args, **kwargs):
    master_password, signing_password = generate_password()
    password_data = dict(encryption_key=make_key(master_password),
                         signing_key=make_key(signing_password))
    container_name, api_token = make_dccfile(master_password, signing_password)
    save_passwd(api_token, container_name, password_data, signing_password)
    save_vfs(api_token, container_name, VFS(),
             get_key(master_password, password_data['encryption_key']),
             get_key(signing_password, password_data['signing_key']))
    return 0
def add_file(*args, **kwargs):
    if len(args) == 0 or '--help' in ''.join(args):
        map(print, [
            'About: This command adds a file to Dropbox by encrypting and signing the file using your private key.',
            '',
            'Usage: $ dcc add <path,...>',
            '',
            'Specify one or more paths delimited by spaces. Paths to files can be absolute or relative but must',
            'point to a file. Paths can refer to files outside of this directory.',
        ])
        return 1
    encryption_key, signing_key, api_token, human_container_name, container_name = prompt_userinfo()
    vfs = load_vfs(api_token, container_name, encryption_key, signing_key)
    for arg in args:
        if len(arg) > 0:
            full_path = normpath(join(getcwd(), arg))
            if isfile(full_path):
                with open(full_path, 'r') as source_file:
                    file_uuid = vfs.add_file(full_path)
                    upload_file(api_token, container_name, encrypt(source_file.read(), encryption_key, signing_key), file_uuid)
                    print('[DONE] `%s` ~> `%s`' % (full_path, file_uuid))
    save_vfs(api_token, container_name, vfs, encryption_key, signing_key)
    return 0