import { getLogger } from '../logging/logger.js';
export class BasicAuthStrategy {
    encoded;
    constructor(user, pass) {
        this.encoded = Buffer.from(`${user}:${pass}`).toString('base64');
        const logger = getLogger();
        logger.debug({ username: user }, `[Auth] Using Basic authentication for user: ${user}`);
    }
    async fetch(url, init = {}) {
        const headers = new Headers(init.headers);
        headers.set('Authorization', `Basic ${this.encoded}`);
        // Pass through dispatcher for TLS/mTLS support
        // Node.js fetch accepts dispatcher as an undocumented option
        return fetch(url, { ...init, headers });
    }
    async getAuthorizationHeader() {
        return `Basic ${this.encoded}`;
    }
}
//# sourceMappingURL=basic.js.map