oauth4webapi
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -1,7 +0,7 @@ | ||
declare type JsonObject = { | ||
type JsonObject = { | ||
[Key in string]?: JsonValue; | ||
}; | ||
declare type JsonArray = JsonValue[]; | ||
declare type JsonPrimitive = string | number | boolean | null; | ||
declare type JsonValue = JsonPrimitive | JsonObject | JsonArray; | ||
type JsonArray = JsonValue[]; | ||
type JsonPrimitive = string | number | boolean | null; | ||
type JsonValue = JsonPrimitive | JsonObject | JsonArray; | ||
/** | ||
@@ -44,3 +44,3 @@ * Interface to pass an asymmetric private key and, optionally, its associated JWK Key ID to be | ||
*/ | ||
export declare type ClientAuthenticationMethod = 'client_secret_basic' | 'client_secret_post' | 'private_key_jwt' | 'none'; | ||
export type ClientAuthenticationMethod = 'client_secret_basic' | 'client_secret_post' | 'private_key_jwt' | 'none'; | ||
/** | ||
@@ -88,3 +88,3 @@ * Supported JWS `alg` Algorithm identifiers. | ||
*/ | ||
export declare type JWSAlgorithm = 'PS256' | 'ES256' | 'RS256' | 'EdDSA'; | ||
export type JWSAlgorithm = 'PS256' | 'ES256' | 'RS256' | 'EdDSA'; | ||
/** | ||
@@ -1019,3 +1019,3 @@ * Authorization Server Metadata | ||
export declare function validateAuthResponse(as: AuthorizationServer, client: Client, parameters: URLSearchParams | URL, expectedState?: string | typeof expectNoState | typeof skipStateCheck): CallbackParameters | OAuth2Error; | ||
declare type ReturnTypes = TokenEndpointResponse | OAuth2TokenEndpointResponse | OpenIDTokenEndpointResponse | ClientCredentialsGrantResponse | DeviceAuthorizationResponse | IntrospectionResponse | OAuth2Error | PushedAuthorizationResponse | URLSearchParams | UserInfoResponse; | ||
type ReturnTypes = TokenEndpointResponse | OAuth2TokenEndpointResponse | OpenIDTokenEndpointResponse | ClientCredentialsGrantResponse | DeviceAuthorizationResponse | IntrospectionResponse | OAuth2Error | PushedAuthorizationResponse | URLSearchParams | UserInfoResponse; | ||
export interface DeviceAuthorizationRequestOptions extends HttpRequestOptions, AuthenticatedRequestOptions { | ||
@@ -1022,0 +1022,0 @@ } |
@@ -484,9 +484,11 @@ let USER_AGENT; | ||
} | ||
const jwkCache = Symbol(); | ||
let jwkCache; | ||
async function publicJwk(key) { | ||
if (key[jwkCache]) { | ||
return key[jwkCache]; | ||
jwkCache || (jwkCache = new WeakMap()); | ||
if (jwkCache.has(key)) { | ||
return jwkCache.get(key); | ||
} | ||
const { kty, e, n, x, y, crv } = await crypto.subtle.exportKey('jwk', key); | ||
const jwk = (key[jwkCache] = { kty, e, n, x, y, crv }); | ||
const jwk = { kty, e, n, x, y, crv }; | ||
jwkCache.set(key, jwk); | ||
return jwk; | ||
@@ -650,3 +652,3 @@ } | ||
} | ||
const jwksCache = Symbol(); | ||
let jwksCache; | ||
async function getPublicSigKeyFromIssuerJwksUri(as, options, header) { | ||
@@ -657,7 +659,8 @@ const { alg, kid } = header; | ||
let age; | ||
if (as[jwksCache]) { | ||
jwksCache || (jwksCache = new WeakMap()); | ||
if (jwksCache.has(as)) { | ||
; | ||
({ jwks, age } = as[jwksCache]); | ||
({ jwks, age } = jwksCache.get(as)); | ||
if (age >= 300) { | ||
as[jwksCache] = undefined; | ||
jwksCache.delete(as); | ||
return getPublicSigKeyFromIssuerJwksUri(as, options, header); | ||
@@ -669,3 +672,3 @@ } | ||
age = 0; | ||
as[jwksCache] = { | ||
jwksCache.set(as, { | ||
jwks, | ||
@@ -676,3 +679,3 @@ iat: epochTime(), | ||
}, | ||
}; | ||
}); | ||
} | ||
@@ -720,3 +723,3 @@ let kty; | ||
if (age >= 60) { | ||
as[jwksCache] = undefined; | ||
jwksCache.delete(as); | ||
return getPublicSigKeyFromIssuerJwksUri(as, options, header); | ||
@@ -723,0 +726,0 @@ } |
{ | ||
"name": "oauth4webapi", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "OAuth 2 / OpenID Connect for Web Platform API JavaScript runtimes", | ||
@@ -55,3 +55,2 @@ "keywords": [ | ||
"format-check": "npm run _format -- --check", | ||
"prepack": "npm run format && npm run docs && ./examples/.update-diffs.sh && git diff --quiet && npm run test && npm run build", | ||
"tap:browsers": "./tap/.browsers.sh", | ||
@@ -67,3 +66,3 @@ "tap:bun": "./tap/.bun.sh", | ||
"devDependencies": { | ||
"@esbuild-kit/esm-loader": "^2.5.0", | ||
"@esbuild-kit/esm-loader": "^2.5.1", | ||
"@types/node": "^18.11.9", | ||
@@ -73,14 +72,14 @@ "@types/qunit": "^2.19.3", | ||
"edge-runtime": "^2.0.2", | ||
"esbuild": "^0.15.14", | ||
"jose": "^4.11.0", | ||
"esbuild": "^0.15.15", | ||
"jose": "^4.11.1", | ||
"patch-package": "^6.5.0", | ||
"prettier": "^2.7.1", | ||
"prettier": "^2.8.0", | ||
"prettier-plugin-jsdoc": "^0.4.2", | ||
"qunit": "^2.19.3", | ||
"timekeeper": "^2.2.0", | ||
"typedoc": "^0.23.20", | ||
"typedoc": "^0.23.21", | ||
"typedoc-plugin-markdown": "^3.13.6", | ||
"typescript": "^4.8.4", | ||
"undici": "^5.12.0" | ||
"typescript": "^4.9.3", | ||
"undici": "^5.13.0" | ||
} | ||
} |
@@ -42,3 +42,3 @@ # OAuth 2 / OpenID Connect for Web Platform API JavaScript runtimes | ||
```js | ||
import * as oauth2 from 'https://deno.land/x/oauth4webapi@v2.0.3/mod.ts' | ||
import * as oauth2 from 'https://deno.land/x/oauth4webapi@v2.0.4/mod.ts' | ||
``` | ||
@@ -45,0 +45,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2638
118706