oauth4webapi 2.2.4 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -39,7 +39,7 @@ import * as oauth2 from 'oauth4webapi'
39
39
  **`example`** Deno import
40
40
 
41
41
  ```js
42
- import * as oauth2 from 'https://deno.land/x/oauth4webapi@v2.2.4/mod.ts'
42
+ import * as oauth2 from 'https://deno.land/x/oauth4webapi@v2.3.0/mod.ts'
43
43
  ```
44
44
 
45
45
  - Authorization Code Flow - OpenID Connect [source](examples/code.ts), or plain OAuth 2 [source](examples/oauth.ts)
package/build/index.d.ts CHANGED
@@ -613,7 +613,7 @@ export interface PushedAuthorizationRequestOptions extends HttpRequestOptions, A
613
613
  *
614
614
  * @see [RFC 9101 - The OAuth 2.0 Authorization Framework: JWT-Secured Authorization Request (JAR)](https://www.rfc-editor.org/rfc/rfc9101.html#name-request-object-2)
615
615
  */
616
- export declare function issueRequestObject(as: AuthorizationServer, client: Client, parameters: URLSearchParams, privateKey: CryptoKey | PrivateKey): Promise<string>;
616
+ export declare function issueRequestObject(as: AuthorizationServer, client: Client, parameters: URLSearchParams | Record<string, string> | string[][], privateKey: CryptoKey | PrivateKey): Promise<string>;
617
617
  /**
618
618
  * Performs a Pushed Authorization Request at the
619
619
  * {@link AuthorizationServer.pushed_authorization_request_endpoint `as.pushed_authorization_request_endpoint`}.
@@ -625,7 +625,7 @@ export declare function issueRequestObject(as: AuthorizationServer, client: Clie
625
625
  * @see [RFC 9126 - OAuth 2.0 Pushed Authorization Requests](https://www.rfc-editor.org/rfc/rfc9126.html#name-pushed-authorization-reques)
626
626
  * @see [draft-ietf-oauth-dpop-16 - OAuth 2.0 Demonstrating Proof-of-Possession at the Application Layer (DPoP)](https://www.ietf.org/archive/id/draft-ietf-oauth-dpop-16.html#name-dpop-with-pushed-authorizat)
627
627
  */
628
- export declare function pushedAuthorizationRequest(as: AuthorizationServer, client: Client, parameters: URLSearchParams, options?: PushedAuthorizationRequestOptions): Promise<Response>;
628
+ export declare function pushedAuthorizationRequest(as: AuthorizationServer, client: Client, parameters: URLSearchParams | Record<string, string> | string[][], options?: PushedAuthorizationRequestOptions): Promise<Response>;
629
629
  export interface PushedAuthorizationResponse {
630
630
  readonly request_uri: string;
631
631
  readonly expires_in: number;
@@ -779,7 +779,7 @@ export declare const skipSubjectCheck: unique symbol;
779
779
  export declare function processUserInfoResponse(as: AuthorizationServer, client: Client, expectedSubject: string | typeof skipSubjectCheck, response: Response): Promise<UserInfoResponse>;
780
780
  export interface TokenEndpointRequestOptions extends HttpRequestOptions, AuthenticatedRequestOptions, DPoPRequestOptions {
781
781
  /** Any additional parameters to send. This cannot override existing parameter values. */
782
- additionalParameters?: URLSearchParams;
782
+ additionalParameters?: URLSearchParams | Record<string, string> | string[][];
783
783
  }
784
784
  /**
785
785
  * Performs a Refresh Token Grant request at the
@@ -960,7 +960,7 @@ export interface ClientCredentialsGrantRequestOptions extends HttpRequestOptions
960
960
  * @see [RFC 6749 - The OAuth 2.0 Authorization Framework](https://www.rfc-editor.org/rfc/rfc6749.html#section-4.4)
961
961
  * @see [draft-ietf-oauth-dpop-16 - OAuth 2.0 Demonstrating Proof-of-Possession at the Application Layer (DPoP)](https://www.ietf.org/archive/id/draft-ietf-oauth-dpop-16.html#name-dpop-access-token-request)
962
962
  */
963
- export declare function clientCredentialsGrantRequest(as: AuthorizationServer, client: Client, parameters: URLSearchParams, options?: ClientCredentialsGrantRequestOptions): Promise<Response>;
963
+ export declare function clientCredentialsGrantRequest(as: AuthorizationServer, client: Client, parameters: URLSearchParams | Record<string, string> | string[][], options?: ClientCredentialsGrantRequestOptions): Promise<Response>;
964
964
  /**
965
965
  * Validates Client Credentials Grant Response instance to be one coming from the
966
966
  * {@link AuthorizationServer.token_endpoint `as.token_endpoint`}.
@@ -977,7 +977,7 @@ export declare function clientCredentialsGrantRequest(as: AuthorizationServer, c
977
977
  export declare function processClientCredentialsResponse(as: AuthorizationServer, client: Client, response: Response): Promise<ClientCredentialsGrantResponse | OAuth2Error>;
978
978
  export interface RevocationRequestOptions extends HttpRequestOptions, AuthenticatedRequestOptions {
979
979
  /** Any additional parameters to send. This cannot override existing parameter values. */
980
- additionalParameters?: URLSearchParams;
980
+ additionalParameters?: URLSearchParams | Record<string, string> | string[][];
981
981
  }
982
982
  /**
983
983
  * Performs a Revocation Request at the
@@ -1003,7 +1003,7 @@ export declare function revocationRequest(as: AuthorizationServer, client: Clien
1003
1003
  export declare function processRevocationResponse(response: Response): Promise<undefined | OAuth2Error>;
1004
1004
  export interface IntrospectionRequestOptions extends HttpRequestOptions, AuthenticatedRequestOptions {
1005
1005
  /** Any additional parameters to send. This cannot override existing parameter values. */
1006
- additionalParameters?: URLSearchParams;
1006
+ additionalParameters?: URLSearchParams | Record<string, string> | string[][];
1007
1007
  /**
1008
1008
  * Request a JWT Response from the
1009
1009
  * {@link AuthorizationServer.introspection_endpoint `as.introspection_endpoint`}. Default is
@@ -1123,7 +1123,7 @@ export interface DeviceAuthorizationRequestOptions extends HttpRequestOptions, A
1123
1123
  *
1124
1124
  * @see [RFC 8628 - OAuth 2.0 Device Authorization Grant](https://www.rfc-editor.org/rfc/rfc8628.html#section-3.1)
1125
1125
  */
1126
- export declare function deviceAuthorizationRequest(as: AuthorizationServer, client: Client, parameters: URLSearchParams, options?: DeviceAuthorizationRequestOptions): Promise<Response>;
1126
+ export declare function deviceAuthorizationRequest(as: AuthorizationServer, client: Client, parameters: URLSearchParams | Record<string, string> | string[][], options?: DeviceAuthorizationRequestOptions): Promise<Response>;
1127
1127
  export interface DeviceAuthorizationResponse {
1128
1128
  readonly device_code: string;
1129
1129
  readonly user_code: string;
package/build/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  let USER_AGENT;
2
2
  if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
3
3
  const NAME = 'oauth4webapi';
4
- const VERSION = 'v2.2.4';
4
+ const VERSION = 'v2.3.0';
5
5
  USER_AGENT = `${NAME}/${VERSION}`;
6
6
  }
7
7
  export const clockSkew = Symbol();
@@ -443,9 +443,6 @@ async function jwt(header, claimsSet, key) {
443
443
  export async function issueRequestObject(as, client, parameters, privateKey) {
444
444
  assertAs(as);
445
445
  assertClient(client);
446
- if (!(parameters instanceof URLSearchParams)) {
447
- throw new TypeError('"parameters" must be an instance of URLSearchParams');
448
- }
449
446
  parameters = new URLSearchParams(parameters);
450
447
  const { key, kid } = getKeyAndKid(privateKey);
451
448
  if (!isPrivateKey(key)) {
@@ -534,9 +531,6 @@ async function publicJwk(key) {
534
531
  export async function pushedAuthorizationRequest(as, client, parameters, options) {
535
532
  assertAs(as);
536
533
  assertClient(client);
537
- if (!(parameters instanceof URLSearchParams)) {
538
- throw new TypeError('"parameters" must be an instance of URLSearchParams');
539
- }
540
534
  if (typeof as.pushed_authorization_request_endpoint !== 'string') {
541
535
  throw new TypeError('"as.pushed_authorization_request_endpoint" must be a string');
542
536
  }
@@ -1526,9 +1520,6 @@ async function importJwk(alg, jwk) {
1526
1520
  export async function deviceAuthorizationRequest(as, client, parameters, options) {
1527
1521
  assertAs(as);
1528
1522
  assertClient(client);
1529
- if (!(parameters instanceof URLSearchParams)) {
1530
- throw new TypeError('"parameters" must be an instance of URLSearchParams');
1531
- }
1532
1523
  if (typeof as.device_authorization_endpoint !== 'string') {
1533
1524
  throw new TypeError('"as.device_authorization_endpoint" must be a string');
1534
1525
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oauth4webapi",
3
- "version": "2.2.4",
3
+ "version": "2.3.0",
4
4
  "description": "OAuth 2 / OpenID Connect for Web Platform API JavaScript runtimes",
5
5
  "keywords": [
6
6
  "auth",
@@ -63,13 +63,13 @@
63
63
  },
64
64
  "devDependencies": {
65
65
  "@esbuild-kit/esm-loader": "^2.5.5",
66
- "@types/node": "^18.16.0",
66
+ "@types/node": "^18.16.1",
67
67
  "@types/qunit": "^2.19.4",
68
68
  "ava": "^5.2.0",
69
69
  "edge-runtime": "^2.1.4",
70
70
  "esbuild": "^0.17.18",
71
71
  "jose": "^4.14.1",
72
- "patch-package": "^6.5.1",
72
+ "patch-package": "^7.0.0",
73
73
  "prettier": "^2.8.8",
74
74
  "prettier-plugin-jsdoc": "^0.4.2",
75
75
  "qunit": "^2.19.4",