import type { JwtPair } from '../jwt'; import type { DestinationOptions } from './destination-accessor-types'; /** * @internal * When a destination is fetched from the SDK the user can pass different tokens. * The token determines from which tenant the destination is obtained (provider or subscriber) and if it contains user information so that user propagation flows are possible. * Possible types are: A user specific JWT issued by the XSUAA, a JWT from a custom IdP or only the `iss` property to get destinations from a different tenant. * We name these tokens "subscriber tokens", because they are related to the subscriber account in contrast to the "provider account", where the application is running. * The tenant defined in the subscriber token is the provider tenant for single tenant applications. */ export interface SubscriberToken { /** * Token that represents the user. */ userJwt?: JwtPair; /** * Destination service token. */ serviceJwt?: JwtPair; } /** * @internal * @param token - The token to check * @returns Whether the given token is a subscriber token. */ export declare function isSubscriberToken(token: any): token is SubscriberToken; /** * @internal */ export declare function getSubscriberToken(options: DestinationOptions): Promise; /** * @internal * Get a subscriber token pair with required fields. Checks that at least one of the tokens exists and sets defaults if needed. * @returns The decoded subscriber tokens. */ export declare function getRequiredSubscriberToken(token: SubscriberToken | undefined): Required; /** * @internal * Check whether the subscriber token has one of the tokens set * @param token - Subscriber token pair to check * @returns True if at least one of the tokens exist. */ export declare function hasTokens(token: SubscriberToken | undefined): boolean; /** * @internal * Retrieve the token to use for tenant identification. * * If `iss` or XSUAA user JWT was passed, this is the `serviceJwt`. * If a custom user JWT was passed, this is used. * @param token - The subscriber token for service and user. * @returns The decoded JWT to use for tenant identification. */ export declare function getJwtForTenant(token: Required): JwtPair; /** * @internal * Retrieve the token to use for user identification. * * If a user token was passed, this is used. * If only `iss` was passed try to get the user from the service token. * @param token - The subscriber token for service and user. * @returns The decoded JWT to use for user identification. */ export declare function getJwtForUser(token: Required): JwtPair;