import * as Hapi from 'hapi'; import { PluginOptions } from './plugin'; import { Profile } from './profile'; export declare type Scopes = string[] | ((provider: string, req: Hapi.Request) => string[]); export interface AccessTokens { access_token: string; refresh_token: string; } export declare abstract class Provider { name: string; clientId: string; clientSecret: string; tokenUrl: string; authUrl: string; scopes: Scopes; query: { [index: string]: any; }; encoding: string; serialiseScopes(req: Hapi.Request): string; getScopes(req: Hapi.Request): string[]; compileAuthUrl(req: Hapi.Request, options: PluginOptions, redirectUri: string): Promise; requestToken(code: string, redirect_uri: string): Promise; refreshToken(refresh_token: string): Promise<{ access_token: string; refresh_token?: string; }>; sendTokenRequest(payload: object): Promise; handleCode(h: Hapi.ResponseToolkit, options: PluginOptions, redirectUri: string): Promise; extractCode(req: Hapi.Request): any; getCodeError(req: Hapi.Request): CodeError | null; getProfile(tokens: AccessTokens): Promise; } export declare function registerProvider(server: Hapi.Server, options: PluginOptions, provider: Provider): void; export declare class CodeError extends Error { kind: CodeError.Kind; constructor(kind: CodeError.Kind); } export declare namespace CodeError { enum Kind { Denied = "Request denied by user", Missing = "Code not found in request", Unknown = "Unknown error returned from provider", } }