@sap-cloud-sdk/connectivity
Version:
SAP Cloud SDK for JavaScript connectivity
13 lines (12 loc) • 707 B
TypeScript
import type { JwtPayload } from '../jsonwebtoken-type';
import type { ServiceCredentials } from './environment-accessor-types';
/**
* @internal
* Retrieves a service binding of the given type and tries to match it based on the JWT, if given.
* Returns `undefined` if no match is found.
* If no JWT is given, returns the first binding of the given service type, if available.
* @param service - The service type.
* @param token - Either an encoded or decoded JWT.
* @returns The service credentials, otherwise `undefined`.
*/
export declare function getServiceCredentials<ServiceCredentialsT extends ServiceCredentials>(service: string, token?: JwtPayload | string): ServiceCredentialsT | undefined;