From 9064136d959b5825f69b32344bbe165f12a10949 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Fri, 23 Apr 2021 11:31:44 +0200 Subject: [PATCH] fix(typescript): add types for 4.6.0 additions --- types/index.d.ts | 12 ++++++++++++ types/openid-client-tests.ts | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index 1e26758c..d544c50c 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -325,6 +325,10 @@ export interface DeviceAuthorizationExtras { DPoP?: DPoPInput; } +export interface PushedAuthorizationRequestExtras { + clientAssertionPayload?: object; +} + export type Address = Override< { formatted?: string; @@ -553,6 +557,14 @@ export class Client { parameters?: DeviceAuthorizationParameters, extras?: DeviceAuthorizationExtras ): Promise>; + pushedAuthorizationRequest( + parameters?: AuthorizationParameters, + extras?: PushedAuthorizationRequestExtras, + ): Promise<{ + request_uri: string; + expires_in: number; + [key: string]: unknown; + }>; static register( metadata: object, other?: RegisterOther & ClientOptions diff --git a/types/openid-client-tests.ts b/types/openid-client-tests.ts index 3fd504a8..27b8babc 100644 --- a/types/openid-client-tests.ts +++ b/types/openid-client-tests.ts @@ -70,6 +70,18 @@ async (req: IncomingMessage) => { client.requestResource('https://rs.example.com/resource', 'token', { DPoP: keyobject }) client.requestResource('https://rs.example.com/resource', 'token', { DPoP: jwk }) + client.pushedAuthorizationRequest() + client.pushedAuthorizationRequest({}) + client.pushedAuthorizationRequest({ foo: 'bar' }) + client.pushedAuthorizationRequest({ foo: 'bar' }, { clientAssertionPayload: {} }) + + { + const { request_uri, expires_in } = await client.pushedAuthorizationRequest() + request_uri.substring(0) + expires_in.toFixed() + } + + client.deviceAuthorization({}, { DPoP: keyobject }) const handle = await client.deviceAuthorization({}, { DPoP: jwk })