<commit_before>package bisq.cli;

import io.grpc.CallCredentials;
import io.grpc.Metadata;
import io.grpc.Metadata.Key;

import java.util.concurrent.Executor;

import static io.grpc.Metadata.ASCII_STRING_MARSHALLER;
import static io.grpc.Status.UNAUTHENTICATED;
import static java.lang.String.format;

/**
 * Sets the {@value PASSWORD_KEY} rpc call header to a given value.
 */
class PasswordCallCredentials extends CallCredentials {

    public static final String PASSWORD_KEY = "password";

    private final String passwordValue;

    public PasswordCallCredentials(String passwordValue) {
        if (passwordValue == null)
            throw new IllegalArgumentException(format("'%s' header value must not be null", PASSWORD_KEY));
        this.passwordValue = passwordValue;
    }

    @Override
    public void applyRequestMetadata(RequestInfo requestInfo, Executor appExecutor, MetadataApplier metadataApplier) {
        appExecutor.execute(() -> {
            try {
                var headers = new Metadata();
                var passwordKey = Key.of(PASSWORD_KEY, ASCII_STRING_MARSHALLER);
                headers.put(passwordKey, passwordValue);
                metadataApplier.apply(headers);
            } catch (Throwable ex) {
                metadataApplier.fail(UNAUTHENTICATED.withCause(ex));
            }
        });
    }

    @Override<commit_msg>Allow double-quoted multiword apiPassword<commit_after>package bisq.cli;

import io.grpc.CallCredentials;
import io.grpc.Metadata;
import io.grpc.Metadata.Key;

import java.util.concurrent.Executor;

import static io.grpc.Metadata.ASCII_STRING_MARSHALLER;
import static io.grpc.Status.UNAUTHENTICATED;
import static java.lang.String.format;

/**
 * Sets the {@value PASSWORD_KEY} rpc call header to a given value.
 */
class PasswordCallCredentials extends CallCredentials {

    public static final String PASSWORD_KEY = "password";

    private final String passwordValue;

    public PasswordCallCredentials(String passwordValue) {
        if (passwordValue == null)
            throw new IllegalArgumentException(format("'%s' header value must not be null", PASSWORD_KEY));
        this.passwordValue = passwordValue.replace("\"", "");
    }

    @Override
    public void applyRequestMetadata(RequestInfo requestInfo, Executor appExecutor, MetadataApplier metadataApplier) {
        appExecutor.execute(() -> {
            try {
                var headers = new Metadata();
                var passwordKey = Key.of(PASSWORD_KEY, ASCII_STRING_MARSHALLER);
                headers.put(passwordKey, passwordValue);
                metadataApplier.apply(headers);
            } catch (Throwable ex) {
                metadataApplier.fail(UNAUTHENTICATED.withCause(ex));
            }
        });
    }

    @Override
{'fraction_non_alphanumeric': 0.08931133428981348, 'fraction_numerical': 0.0, 'mean_word_length': 3.0303468208092488, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2365138', 'n_tokens_mistral': 764, 'n_tokens_neox': 752, 'n_words': 180}