INNER CODE UNIT · Python

hasher

kejilion/sh · site_access_accounts.py:32

                 hasher=hash_password, assert_context=None) -> str:
    if action not in ('add', 'update', 'delete'):
        raise ConfigError('invalid account action')
    if action == 'add' and previous_username is not None:
        raise ConfigError('unexpected previous account')
    if action == 'update' and previous_username is None:
        raise ConfigError('previous account is required')
    if action == 'delete' and (previous_username is not None or password):
        raise ConfigError('unexpected deletion arguments')
    new_hash = None if action == 'delete' else hasher(password)
    def transform(content):
        return update_account(content, username, new_hash,
                              previous_username=previous_username,
                              must_create=action == 'add')
    # Nginx reads the password file for each request. No configuration reload
    # is necessary, and no credential is passed through a command line.
    return replace_existing(directory, name, expected_sha256, transform,
                            lambda: None, lambda: None, limit=1 << 20,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…