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