Beispiel #1
0
def save_keyring_credentials(api_key, user_id, ring=_KEYRING):
    '''Saves the user's credentials.'''
    if sys.platform.startswith('win'):
        keyring.set_keyring(WinVaultKeyring())
    if sys.platform.startswith('darwin'):
        keyring.set_keyring(Keyring())
    value = _encoded(api_key, user_id)
    if __debug__: log(f'storing "{value}" to keyring {_KEYRING}')
    keyring.set_password(ring, getpass.getuser(), value)
Beispiel #2
0
def keyring_credentials(ring=_KEYRING):
    '''Looks up the user's credentials.'''
    if sys.platform.startswith('win'):
        keyring.set_keyring(WinVaultKeyring())
    if sys.platform.startswith('darwin'):
        keyring.set_keyring(Keyring())
    value = keyring.get_password(ring, getpass.getuser())
    if __debug__: log(f'got "{value}" from keyring {_KEYRING}')
    return _decoded(value) if value else (None, None)
Beispiel #3
0
def save_keyring_credentials(service, user, pswd, host=None, port=None):
    '''Saves the user, password, host and port info for 'service'.'''
    user = user if user else ''
    pswd = pswd if pswd else ''
    host = host if host else ''
    port = port if port else ''
    if sys.platform.startswith('win'):
        keyring.set_keyring(WinVaultKeyring())
    if sys.platform.startswith('darwin'):
        keyring.set_keyring(Keyring())
    keyring.set_password(service, 'credentials',
                         _encoded(user, pswd, host, port))
Beispiel #4
0
def keyring_credentials(service, user=None):
    '''Looks up the user's credentials for the given 'service' using the
    keyring/keychain facility on this computer.  If 'user' is None, this uses
    the fake user named "credentials".  The latter makes it possible to access a
    service with a different user login name than the user's current login
    name without having to ask the user for the alternative name every time.
    '''
    if sys.platform.startswith('win'):
        keyring.set_keyring(WinVaultKeyring())
    if sys.platform.startswith('darwin'):
        keyring.set_keyring(Keyring())
    value = keyring.get_password(service, user if user else 'credentials')
    return _decoded(value) if value else (None, None, None, None)
Beispiel #5
0
def get_keychain_password(username: str) -> str:
    if platform != MACOS:
        return
    # try to extract from keychain
    try:
        print("Getting password from keychain")
        keyring.set_keyring(Keyring())
        return keyring.get_password(PASS_KEY, username)
    except (InitError, KeyringError) as exc:
        print(
            f"Error: unable to get keychain password, skipping, exception={exc}"
        )
        return ''
Beispiel #6
0
def set_keychain_password(username: str, password: str) -> None:
    if platform != MACOS:
        return
    if password:
        # save to keychain
        try:
            print("Setting password in keychain")
            keyring.set_keyring(Keyring())
            keyring.set_password(PASS_KEY, username, password)
        except (PasswordSetError, InitError) as exc:
            print(
                f"Error: unable to set keychain password, skipping, exception={exc}"
            )
Beispiel #7
0
}

UPGRADE = 'Please download the latest version of the Node Launcher: ' \
                    '<a href="https://github.com/PierreRochard/node-launcher/releases/">' \
                    'https://github.com/PierreRochard/node-launcher/releases' \
                    '</a>'

GIGABYTE = 1000000000

if IS_WINDOWS:
    from keyring.backends.Windows import WinVaultKeyring
    keyring = WinVaultKeyring()

if IS_MACOS:
    from keyring.backends.OS_X import Keyring
    keyring = Keyring()

if IS_LINUX:
    from keyring.backends.SecretService import Keyring
    keyring = Keyring()

# How many megabytes to keep
# Total Bitcoin (mainnet) data directory size minus blocks is ~3 GB
# We are targeting 10 GB, so 10 - 3 = 7
MAINNET_PRUNE = 7000

TESTNET_PRUNE = 1000

BITCOIN_TESTNET_PEER_PORT = 18333
BITCOIN_MAINNET_PEER_PORT = 8333