1 | import * as stream from 'stream';
|
2 | import { JWTInput } from './credentials';
|
3 | import { Headers } from './oauth2client';
|
4 | export interface Claims {
|
5 | [index: string]: string;
|
6 | }
|
7 | export declare class JWTAccess {
|
8 | email?: string | null;
|
9 | key?: string | null;
|
10 | keyId?: string | null;
|
11 | projectId?: string;
|
12 | eagerRefreshThresholdMillis: number;
|
13 | private cache;
|
14 | |
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | constructor(email?: string | null, key?: string | null, keyId?: string | null, eagerRefreshThresholdMillis?: number);
|
25 | /**
|
26 | * Ensures that we're caching a key appropriately, giving precedence to scopes vs. url
|
27 | *
|
28 | * @param url The URI being authorized.
|
29 | * @param scopes The scope or scopes being authorized
|
30 | * @returns A string that returns the cached key.
|
31 | */
|
32 | getCachedKey(url?: string, scopes?: string | string[]): string;
|
33 | /**
|
34 | * Get a non-expired access token, after refreshing if necessary.
|
35 | *
|
36 | * @param url The URI being authorized.
|
37 | * @param additionalClaims An object with a set of additional claims to
|
38 | * include in the payload.
|
39 | * @returns An object that includes the authorization header.
|
40 | */
|
41 | getRequestHeaders(url?: string, additionalClaims?: Claims, scopes?: string | string[]): Headers;
|
42 | /**
|
43 | * Returns an expiration time for the JWT token.
|
44 | *
|
45 | * @param iat The issued at time for the JWT.
|
46 | * @returns An expiration time for the JWT.
|
47 | */
|
48 | private static getExpirationTime;
|
49 | /**
|
50 | * Create a JWTAccess credentials instance using the given input options.
|
51 | * @param json The input object.
|
52 | */
|
53 | fromJSON(json: JWTInput): void;
|
54 | /**
|
55 | * Create a JWTAccess credentials instance using the given input stream.
|
56 | * @param inputStream The input stream.
|
57 | * @param callback Optional callback.
|
58 | */
|
59 | fromStream(inputStream: stream.Readable): Promise<void>;
|
60 | fromStream(inputStream: stream.Readable, callback: (err?: Error) => void): void;
|
61 | private fromStreamAsync;
|
62 | }
|