portainer/app/react/docker/images/queries/encodeRegistryCredentials.ts

16 lines
372 B
TypeScript

import { Registry } from '@/react/portainer/registries/types/registry';
/**
* Encodes the registry credentials in base64
* @param registryId
* @returns
*/
export function encodeRegistryCredentials(registryId: Registry['Id']) {
const credentials = {
registryId,
};
const buf = Buffer.from(JSON.stringify(credentials));
return buf.toString('base64url');
}