tyr-cli
Version:
A command line interface for hammer-io.
45 lines (20 loc) • 4.07 kB
JavaScript
;Object.defineProperty(exports, "__esModule", { value: true });exports.
basicAuthorization = basicAuthorization;exports.
tokenAuthorization = tokenAuthorization;exports.
bearerAuthorization = bearerAuthorization; /* eslint-disable import/prefer-default-export */ /**
* Returns the string used for the basic authorization.
*
* @param username the username
* @param password the password
* @returns {string} the basic authentication string
*/function basicAuthorization(username, password) {return `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`;} /**
* Returns the string used for the token authorization header\t
*
* @param token
* @returns {string}
*/function tokenAuthorization(token) {return `token ${token}`;} /**
* Returns the string used for the bearer authorization header\t
*
* @param token
* @returns {string}
*/function bearerAuthorization(token) {return `Bearer ${token}`;}