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}`);
        return fetch(url, { ...init, headers });
    }
    async getAuthorizationHeader() {
        return `Basic ${this.encoded}`;
    }
}
//# sourceMappingURL=basic.js.map