Skip to content

Commit

Permalink
fix(typescript): add types for 4.6.0 additions
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Apr 23, 2021
1 parent 6281962 commit 9064136
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions types/index.d.ts
Expand Up @@ -325,6 +325,10 @@ export interface DeviceAuthorizationExtras {
DPoP?: DPoPInput;
}

export interface PushedAuthorizationRequestExtras {
clientAssertionPayload?: object;
}

export type Address<ExtendedAddress extends {} = UnknownObject> = Override<
{
formatted?: string;
Expand Down Expand Up @@ -553,6 +557,14 @@ export class Client {
parameters?: DeviceAuthorizationParameters,
extras?: DeviceAuthorizationExtras
): Promise<DeviceFlowHandle<Client>>;
pushedAuthorizationRequest(
parameters?: AuthorizationParameters,
extras?: PushedAuthorizationRequestExtras,
): Promise<{
request_uri: string;
expires_in: number;
[key: string]: unknown;
}>;
static register(
metadata: object,
other?: RegisterOther & ClientOptions
Expand Down
12 changes: 12 additions & 0 deletions types/openid-client-tests.ts
Expand Up @@ -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 })

Expand Down

0 comments on commit 9064136

Please sign in to comment.