import { Jwk } from './jwt/jwk'; import { JwtClaims } from './jwt/jwt-claims'; import { JsonObject } from './utils/json'; /** * The main service class to be used by a plug-in to establish a safe and secure * communication to the COYO front end bridge. It acts as a unified interaction * interface to all other plug-in handlers. */ export declare class PluginAdapter { private static readonly CONFIG_SRC_SUFFIX; private jwkStore; private initAdapter; private initConfigAdapter; private heightAdapter; private heightConfigAdapter; private configAdapter; readonly srcId: string; /** * Creates a new instance of this class. * * @param srcId the plug-in source ID to use for requests * @returns the new instance */ constructor(srcId?: string); /** * Registers a new set of JSON Web Keys in the store. It is possible to * register multiple keys for a single environment in order to account for * key renewals with a transition period. * * @param test a regular expression to check if this key is applicable * @param jwk the JSON Web Key(s) to register */ addJwk(test: RegExp, ...jwk: Jwk[]): void; /** * Register a new trustworthy URL to retrieve JSON Web Keys from. * * @param url the URL to register */ addJwkHost(url: string): void; /** * Sends an initialization message to the parent window (i.e. COYO) * and retrieves the decoded (and possibly validated) response as well as the * raw token response. * * @param config a flag indicating if the plugin configuration view should be initialized * @param timeout a maximum time to wait for the response * @param validate a flag indicating if the JWT response should be validated * @returns a promise holding the response data */ init(config?: boolean, timeout?: number, validate?: boolean): Promise<{ claims: JwtClaims; token: string; validated: boolean; }>; /** * Starts to listen to COYO requests to save the current configuration. * Provides a `respond` callback that is used to respond to the received * message. The response can be `true` to indicate success without providing * any data, `false` to indicate failure (e.g. an invalid configuration state) * or a JSON object holding the configuration values to be stored on COYO * side. * * @param cb a callback that is executed every time a save request is received * @param validate a flag indicating if the JWT response should be validated * @returns a disconnect handler to stop listening to save events */ onSave(cb: (respond: (data: boolean | JsonObject) => void, token: string) => void, validate?: boolean): () => void; /** * Starts to observe the HTML element that matches the given selectors and * sends throttled update messages to COYO. * * @param config a flag indicating if the plugin configuration view should be observed * @param selectors the selectors to target the HTML element * @returns a disconnect handler to stop observing the HTML element */ observeHeight(config?: boolean, selectors?: string): () => void; }