0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-02-03 23:09:17 -05:00
verdaccio/packages/signature/src/token.ts

19 lines
376 B
TypeScript
Raw Normal View History

import { BasicPayload } from './types';
/**
*
* @param credentials
* @returns
*/
export function parseBasicPayload(credentials: string): BasicPayload {
const index = credentials.indexOf(':');
if (index < 0) {
return;
}
const user: string = credentials.slice(0, index);
const password: string = credentials.slice(index + 1);
return { user, password };
}