import { AuthInfo } from "@pie-api-gcp/shared/auth"; /** * Function to authorize that a token can be used for a particular resolver. * Throw AuthorizationError if not authorized. */ export declare type AuthorizeTokenFn = (token: AuthInfo, args?: any, context?: any) => Promise; /** * Stack authorizers. */ export declare const compose: (...authorizers: AuthorizeTokenFn[]) => AuthorizeTokenFn; /** * Token should have an admin property. */ export declare const shouldBeAdmin: (token: AuthInfo) => Promise; /** * Token should not have a scope with the given key. */ export declare const shouldNotHaveScopeKey: (...scopes: string[]) => AuthorizeTokenFn; /** * Token should have a scope with the given key. */ export declare const shouldHaveScopeKey: (...scopes: string[]) => AuthorizeTokenFn; /** * Find scope and run check function against it. */ export declare const checkScope: (scopeKey: string, fn: (scopeVal: string, args: any) => void, isScopeRequired?: boolean) => AuthorizeTokenFn; /** * Scope should exist and have given string value. */ export declare const scopeShouldHaveValue: (scopeKey: string, scopeValue: string) => AuthorizeTokenFn; /** * The scope should NOT exist. */ export declare const scopeShouldNotExist: (scopeKey: string) => AuthorizeTokenFn; /** * Scope should exist and have given boolean value. */ export declare const scopeShouldHaveBooleanValue: (scopeKey: string, scopeValue: boolean) => AuthorizeTokenFn; /** * Scope should either not exist or if exists, not have the given string value. */ export declare const scopeShouldNotHaveValue: (scopeKey: string, scopeValue: string) => AuthorizeTokenFn; /** * Scope should either not exist or if exists, not have the given boolean value. */ export declare const scopeShouldNotHaveBooleanValue: (scopeKey: string, scopeValue: boolean) => AuthorizeTokenFn; /** * Check that a passed in argument either matches a value of the scope with the provided scope key * (or by default the same key as the arg) or that there is no scope with that key provided in the token. */ export declare const argShouldMatchScope: (arg: string, scopeKey?: string) => (token: AuthInfo, args: any) => Promise; /** * Check that a passed in argument passes the validation function or that there is no scope * with that key provided in the token. The validation function is only called when both the * argument and scope val exist. */ export declare const argShouldValidate: (arg: string, scopeKey: string, validationFn: (argVal: any, scopeVal: string) => void) => (token: AuthInfo, args: any) => Promise; /** * Check that a passed in versioned id (which consists of a base id and a semver) matches with * a base id if that is provided as a scope. */ export declare const versionedBaseIdShouldMatch: (arg?: string, scopeKey?: string) => (token: AuthInfo, args: any) => Promise; /** * Token should not have a { scope: 'player' } scope. */ export declare const shouldNotHavePlayerScope: AuthorizeTokenFn; /** * Token should not have a { secure: true } scope. */ export declare const shouldNotHaveSecureScope: AuthorizeTokenFn; /** * When a contentItemId is provided as an argument, there must either be a * matching contentId scope, or no contentId scope in the token. */ export declare const contentItemIdShouldMatchScope: (token: AuthInfo, args: any) => Promise; /** * Standard token checks to guard against player access. */ export declare const playerProtections: AuthorizeTokenFn; //# sourceMappingURL=auth.d.ts.map