@nodescript/stdlib
Version:
Standard Node Definitions
28 lines (27 loc) • 675 B
JavaScript
import { stringToBase64 } from '@nodescript/binary-utils';
export const module = {
version: '1.1.4',
moduleName: 'Web / Basic Auth',
description: `
Creates a basic HTTP authorization header given a username and a password.
`,
params: {
username: {
schema: {
type: 'string'
},
},
password: {
schema: {
type: 'string'
},
},
},
result: {
schema: { type: 'string' },
},
};
export const compute = params => {
const { username, password } = params;
return `Basic ${stringToBase64(`${username}:${password}`)}`;
};