tiny-essentials
Version:
Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.
20 lines • 937 B
text/typescript
/**
* Generates a Base64-encoded string for HTTP Basic Authentication using the provided `client_id` and `client_secret`.
* The string is formatted as `client_id:client_secret`, then encoded in Base64 for use in Authorization headers.
*
* @function
* @param {Object} tinyAuth - The object containing authentication credentials.
* @param {string} tinyAuth.client_id - The client ID for the authentication process.
* @param {string} tinyAuth.client_secret - The client secret associated with the client ID.
*
* @returns {string} The Base64-encoded string in the format `client_id:client_secret`.
*
* @example
* const authHeader = credentials({ client_id: 'myClientId', client_secret: 'mySecret' });
* console.log(authHeader); // Outputs: 'bXlDbGllZW50SWQ6bXlTZWNyZXQ='
*/
export default function credentials(tinyAuth: {
client_id: string;
client_secret: string;
}): string;
//# sourceMappingURL=credentials.d.mts.map