diff --git a/index.d.ts b/index.d.ts index bf8f94ff..2f5c1129 100644 --- a/index.d.ts +++ b/index.d.ts @@ -2,6 +2,7 @@ import csrf from 'csrf'; declare class AuthResponse { constructor(params: AuthResponse.AuthResponseParams); + processResponse(response: Object): void; getToken(): Token; text(): string; status(): number; @@ -9,6 +10,10 @@ declare class AuthResponse { valid(): boolean; getJson(): Object; get_intuit_tid(): string; + isContentType(): boolean; + getContentType(): string; + isJson(): boolean; + } declare namespace AuthResponse { @@ -43,13 +48,14 @@ declare class Token implements Token.TokenData { declare namespace Token { export interface TokenData { - realmId: string; - token_type: string; - access_token: string; - refresh_token: string; + realmId?: string; + token_type?: string; + access_token?: string; + refresh_token?: string; expires_in: number; x_refresh_token_expires_in: number; - id_token: string; + id_token?: string; + latency: number; createdAt: string; } } @@ -60,10 +66,7 @@ declare class OAuthClient { authorizeUri(params: OAuthClient.AuthorizeParams): string; createError(e: Error, authResponse?: AuthResponse): OAuthClient.OAuthClientError; createToken(uri: string): Promise; - generateOauth1Sign(params: OAuthClient.GenerateOAuth1SignParams): string; getKeyFromJWKsURI(id_token: string, kid: string, request: Request): Promise; - getPublicKey(modulus: string, exponent: string): string; - getToken(): Token; getTokenRequest(request: Request): Promise; getUserInfo(params?: OAuthClient.GetUserInfoParams): Promise; isAccessTokenValid(): boolean; @@ -71,12 +74,11 @@ declare class OAuthClient { loadResponseFromJWKsURI(request: Request): Promise; log(level: string, message: string, messageData: any): void; makeApiCall(params?: OAuthClient.MakeApiCallParams): Promise; - migrate(params: OAuthClient.MigrateParams): Promise; refresh(): Promise; refreshUsingToken(refresh_token: string): Promise; revoke(params?: OAuthClient.RevokeParams): Promise; setToken(params: Token.TokenData): Token; - validateIdToken(params: OAuthClient.ValidateIdTokenParams): Promise; + validateIdToken(params?: OAuthClient.ValidateIdTokenParams): Promise; validateToken(): void; } @@ -86,6 +88,8 @@ declare namespace OAuthClient { clientSecret: string; redirectUri?: string; environment?: string; + token: Token; + logging: boolean; } export enum environment {