unjwt 0.5.14 → 0.5.16
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 +7 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +5 -5
- package/dist/jwe.d.mts +2 -2
- package/dist/jwe.mjs +4 -4
- package/dist/jwk.d.mts +2 -2
- package/dist/jwk.mjs +2 -2
- package/dist/jws.d.mts +2 -2
- package/dist/jws.mjs +4 -4
- package/dist/shared/{unjwt.B8wnSUll.mjs → unjwt.BZ3B0Ak8.mjs} +7 -4
- package/dist/shared/{unjwt.Cf7vmOhS.d.mts → unjwt.BkUfaQRR.d.mts} +47 -3
- package/dist/shared/{unjwt.BaB7HUR1.mjs → unjwt.BpusjhPR.mjs} +1 -1
- package/dist/shared/{unjwt.BEjwP_9W.mjs → unjwt.CRHfsi7v.mjs} +13 -14
- package/dist/shared/{unjwt.C6b_GyXm.d.mts → unjwt.CbxAdgsb.d.mts} +1 -1
- package/dist/shared/{unjwt.BVlHlXdP.mjs → unjwt.D1MC63Yb.mjs} +1 -1
- package/dist/shared/{unjwt.BYaxDvLV.d.mts → unjwt.DUVOOOvO.d.mts} +12 -12
- package/dist/shared/{unjwt.BsgIQHVD.d.mts → unjwt.OzI0aGB_.d.mts} +1 -1
- package/dist/shared/{unjwt.qWts1U9J.d.mts → unjwt.r8lbwWSJ.d.mts} +47 -3
- package/dist/shared/{unjwt.skuKf53c.mjs → unjwt.u3h40Nr-.mjs} +4 -4
- package/dist/utils.d.mts +2 -2
- package/dist/utils.mjs +1 -1
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -111,7 +111,7 @@ Creates a JWS token.
|
|
|
111
111
|
- `key`: The signing key (`CryptoKey`, `JWK`, or `Uint8Array` for symmetric keys).
|
|
112
112
|
- `options`:
|
|
113
113
|
- `alg`: (Required) The JWS algorithm (e.g., `"HS256"`, `"RS256"`, `"ES256"`, `"PS256"`).
|
|
114
|
-
- `protectedHeader`: An object for additional JWS Protected Header parameters (e.g., `kid`, `typ`, `cty`, `crit`, `b64`). If `payload` is an object and `typ` is not set, it defaults to `"
|
|
114
|
+
- `protectedHeader`: An object for additional JWS Protected Header parameters (e.g., `kid`, `typ`, `cty`, `crit`, `b64`). If `payload` is an object and `typ` is not set, it defaults to `"JWT"`. The `b64` parameter ([RFC7797 section-3](https://datatracker.ietf.org/doc/html/rfc7797#section-3)) controls payload encoding (defaults to `true`, meaning Base64URL encoded).
|
|
115
115
|
- `expiresIn`: Sets an expiration time in seconds (e.g., `3600` for 1 hour). If `iat` is missing it will be set to the current time. If `exp` is missing it will be set to `iat + expiresIn`. This is only applied if `payload` is a JWT.
|
|
116
116
|
- `currentDate`: The current date for computing `expiresIn` option. Defaults to `new Date()`.
|
|
117
117
|
|
|
@@ -123,9 +123,9 @@ Returns a `Promise<string>` resolving to the JWS token in Compact Serialization
|
|
|
123
123
|
import { sign } from "unjwt/jws";
|
|
124
124
|
|
|
125
125
|
const payload = { message: "My important data" }; // Object payload
|
|
126
|
-
const
|
|
126
|
+
const key = await generateKey("HS256", { toJWK: true }); // Generates a JWK_oct
|
|
127
127
|
|
|
128
|
-
const token = await sign(payload,
|
|
128
|
+
const token = await sign(payload, key);
|
|
129
129
|
|
|
130
130
|
console.log(token);
|
|
131
131
|
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
|
|
@@ -155,6 +155,7 @@ Verifies a JWS token.
|
|
|
155
155
|
A `KeyLookupFunction` has the signature `(header: JWSProtectedHeader, jws: string) => Promise<CryptoKey | JWK | JWKSet | Uint8Array> | CryptoKey | JWK | JWKSet | Uint8Array`.
|
|
156
156
|
- `options` (optional):
|
|
157
157
|
- `algorithms`: An array of allowed JWS `alg` values. If not provided, the `alg` from the JWS header is used.
|
|
158
|
+
- `validateJWT`: Unless false, will parse payload as JWT and validate claims if applicable (typ includes "jwt", case insensitive). Default `undefined`.
|
|
158
159
|
- `critical`: An array of JWS header parameter names that the application understands and processes.
|
|
159
160
|
|
|
160
161
|
Returns a `Promise<JWSVerifyResult<T>>` which is an object `{ payload: T, protectedHeader: JWSProtectedHeader }`.
|
|
@@ -170,7 +171,7 @@ const secret = "supersecretkey";
|
|
|
170
171
|
|
|
171
172
|
const { payload, protectedHeader } = await verify(token, secret);
|
|
172
173
|
console.log(payload); // { message: "My important data" }
|
|
173
|
-
console.log(protectedHeader); // { alg: "HS256", typ: "
|
|
174
|
+
console.log(protectedHeader); // { alg: "HS256", typ: "JWT" }
|
|
174
175
|
```
|
|
175
176
|
|
|
176
177
|
**Example (RS256 with key lookup):**
|
|
@@ -210,7 +211,7 @@ Encrypts data to produce a JWE token.
|
|
|
210
211
|
- `options`:
|
|
211
212
|
- `alg`: (Required) The JWE Key Management algorithm (e.g., `"A128KW"`, `"RSA-OAEP-256"`, `"PBES2-HS256+A128KW"`, `"ECDH-ES+A128KW"`), defaults depends on the key provided.
|
|
212
213
|
- `enc`: (Required) The JWE Content Encryption algorithm (e.g., `"A128GCM"`, `"A256CBC-HS512"`), defaults depends on the key provided.
|
|
213
|
-
- `protectedHeader`: An object for JWE Protected Header parameters (e.g., `kid`, `typ`, `cty`, `crit`, `apu`, `apv`, `p2s`, `p2c`). If `payload` is an object and `typ` is not set, it defaults to `"
|
|
214
|
+
- `protectedHeader`: An object for JWE Protected Header parameters (e.g., `kid`, `typ`, `cty`, `crit`, `apu`, `apv`, `p2s`, `p2c`). If `payload` is an object and `typ` is not set, it defaults to `"JWT"`.
|
|
214
215
|
- `cek`: (Optional) Provide your own Content Encryption Key (`CryptoKey` or `Uint8Array`).
|
|
215
216
|
- `contentEncryptionIV`: (Optional) Provide your own Initialization Vector for content encryption (`Uint8Array`).
|
|
216
217
|
- Other algorithm-specific options like `p2s`, `p2c` (for PBES2), `keyManagementIV`, `ecdhPartyUInfo`, `ecdhPartyVInfo`.
|
|
@@ -259,6 +260,7 @@ Decrypts a JWE token.
|
|
|
259
260
|
A `JWEKeyLookupFunction` has the signature `(header: JWEHeaderParameters) => Promise<CryptoKey | JWK | string | Uint8Array> | CryptoKey | JWK | string | Uint8Array`.
|
|
260
261
|
- `options` (optional):
|
|
261
262
|
- `algorithms`: Array of allowed JWE Key Management `alg` values.
|
|
263
|
+
- `validateJWT`: Unless false, will parse payload as JWT and validate claims if applicable (typ includes "jwt", case insensitive). Default `undefined`.
|
|
262
264
|
- `encryptionAlgorithms`: Array of allowed JWE Content Encryption `enc` values.
|
|
263
265
|
- `critical`: Array of JWE header parameter names that the application understands.
|
|
264
266
|
- `unwrappedKeyAlgorithm`: (For `unwrapKey` internally) Algorithm details for the CEK after unwrapping.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { C as CompositeKey, d as ContentEncryptionAlgorithm, D as DeriveKeyOptions, c as DeriveKeyReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, r as JWK, M as JWKAlgorithm, N as JWKPEMAlgorithm, J as JWKParameters, s as JWKSet, A as JWK_AES_CBC_HMAC, B as JWK_AES_GCM, z as JWK_AES_GCM_KW, y as JWK_AES_KW, L as JWK_Asymmetric_Algorithm, h as JWK_EC, F as JWK_ECDH_ES, w as JWK_ECDSA, g as JWK_EC_Private, f as JWK_EC_Public, t as JWK_HMAC, n as JWK_OKP, m as JWK_OKP_Private, l as JWK_OKP_Public, H as JWK_OKP_SIGN, E as JWK_PBES2, q as JWK_Private, p as JWK_Public, k as JWK_RSA, x as JWK_RSA_ENC, v as JWK_RSA_PSS, j as JWK_RSA_Private, i as JWK_RSA_Public, u as JWK_RSA_SIGN, I as JWK_Symmetric_Algorithm, o as JWK_oct, Q as JWT, R as JWTClaimValidationOptions, P as JWTClaims, O as JoseHeaderParameters, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, e as WrapKeyResult } from './shared/unjwt.
|
|
2
|
-
export { J as JWSAlgorithm, a as JWSHeaderParameters, f as JWSKeyLookupFunction, b as JWSProtectedHeader, c as JWSSignOptions, e as JWSVerifyOptions, d as JWSVerifyResult, j as jws } from './shared/unjwt.
|
|
3
|
-
export { d as JWEDecryptOptions, e as JWEDecryptResult, b as JWEEncryptOptions, J as JWEHeaderParameters, c as JWEKeyLookupFunction, a as JWEKeyManagementHeaderParameters, j as jwe } from './shared/unjwt.
|
|
4
|
-
export { i as utils } from './shared/unjwt.
|
|
5
|
-
export { j as jwk } from './shared/unjwt.
|
|
1
|
+
export { C as CompositeKey, d as ContentEncryptionAlgorithm, D as DeriveKeyOptions, c as DeriveKeyReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, r as JWK, M as JWKAlgorithm, N as JWKPEMAlgorithm, J as JWKParameters, s as JWKSet, A as JWK_AES_CBC_HMAC, B as JWK_AES_GCM, z as JWK_AES_GCM_KW, y as JWK_AES_KW, L as JWK_Asymmetric_Algorithm, h as JWK_EC, F as JWK_ECDH_ES, w as JWK_ECDSA, g as JWK_EC_Private, f as JWK_EC_Public, t as JWK_HMAC, n as JWK_OKP, m as JWK_OKP_Private, l as JWK_OKP_Public, H as JWK_OKP_SIGN, E as JWK_PBES2, q as JWK_Private, p as JWK_Public, k as JWK_RSA, x as JWK_RSA_ENC, v as JWK_RSA_PSS, j as JWK_RSA_Private, i as JWK_RSA_Public, u as JWK_RSA_SIGN, I as JWK_Symmetric_Algorithm, o as JWK_oct, Q as JWT, R as JWTClaimValidationOptions, P as JWTClaims, O as JoseHeaderParameters, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, e as WrapKeyResult } from './shared/unjwt.OzI0aGB_.mjs';
|
|
2
|
+
export { J as JWSAlgorithm, a as JWSHeaderParameters, f as JWSKeyLookupFunction, b as JWSProtectedHeader, c as JWSSignOptions, e as JWSVerifyOptions, d as JWSVerifyResult, j as jws } from './shared/unjwt.r8lbwWSJ.mjs';
|
|
3
|
+
export { d as JWEDecryptOptions, e as JWEDecryptResult, b as JWEEncryptOptions, J as JWEHeaderParameters, c as JWEKeyLookupFunction, a as JWEKeyManagementHeaderParameters, j as jwe } from './shared/unjwt.BkUfaQRR.mjs';
|
|
4
|
+
export { i as utils } from './shared/unjwt.DUVOOOvO.mjs';
|
|
5
|
+
export { j as jwk } from './shared/unjwt.CbxAdgsb.mjs';
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { i as utils } from './shared/unjwt.
|
|
2
|
-
export { j as jwe } from './shared/unjwt.
|
|
3
|
-
export { j as jwk } from './shared/unjwt.
|
|
4
|
-
export { j as jws } from './shared/unjwt.
|
|
5
|
-
import './shared/unjwt.
|
|
1
|
+
export { i as utils } from './shared/unjwt.CRHfsi7v.mjs';
|
|
2
|
+
export { j as jwe } from './shared/unjwt.BZ3B0Ak8.mjs';
|
|
3
|
+
export { j as jwk } from './shared/unjwt.D1MC63Yb.mjs';
|
|
4
|
+
export { j as jws } from './shared/unjwt.u3h40Nr-.mjs';
|
|
5
|
+
import './shared/unjwt.BpusjhPR.mjs';
|
package/dist/jwe.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Q as JWT, R as JWTClaimValidationOptions, P as JWTClaims, O as JoseHeaderParameters } from './shared/unjwt.
|
|
2
|
-
export { d as JWEDecryptOptions, e as JWEDecryptResult, b as JWEEncryptOptions, J as JWEHeaderParameters, c as JWEKeyLookupFunction, a as JWEKeyManagementHeaderParameters, g as decrypt, f as encrypt } from './shared/unjwt.
|
|
1
|
+
export { C as CompositeKey, d as ContentEncryptionAlgorithm, D as DeriveKeyOptions, c as DeriveKeyReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, r as JWK, M as JWKAlgorithm, N as JWKPEMAlgorithm, J as JWKParameters, s as JWKSet, A as JWK_AES_CBC_HMAC, B as JWK_AES_GCM, z as JWK_AES_GCM_KW, y as JWK_AES_KW, L as JWK_Asymmetric_Algorithm, h as JWK_EC, F as JWK_ECDH_ES, w as JWK_ECDSA, g as JWK_EC_Private, f as JWK_EC_Public, t as JWK_HMAC, n as JWK_OKP, m as JWK_OKP_Private, l as JWK_OKP_Public, H as JWK_OKP_SIGN, E as JWK_PBES2, q as JWK_Private, p as JWK_Public, k as JWK_RSA, x as JWK_RSA_ENC, v as JWK_RSA_PSS, j as JWK_RSA_Private, i as JWK_RSA_Public, u as JWK_RSA_SIGN, I as JWK_Symmetric_Algorithm, o as JWK_oct, Q as JWT, R as JWTClaimValidationOptions, P as JWTClaims, O as JoseHeaderParameters, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, e as WrapKeyResult } from './shared/unjwt.OzI0aGB_.mjs';
|
|
2
|
+
export { d as JWEDecryptOptions, e as JWEDecryptResult, b as JWEEncryptOptions, J as JWEHeaderParameters, c as JWEKeyLookupFunction, a as JWEKeyManagementHeaderParameters, g as decrypt, f as encrypt } from './shared/unjwt.BkUfaQRR.mjs';
|
package/dist/jwe.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './shared/unjwt.
|
|
2
|
-
import './shared/unjwt.
|
|
3
|
-
export { d as decrypt, e as encrypt } from './shared/unjwt.
|
|
4
|
-
import './shared/unjwt.
|
|
1
|
+
import './shared/unjwt.D1MC63Yb.mjs';
|
|
2
|
+
import './shared/unjwt.CRHfsi7v.mjs';
|
|
3
|
+
export { d as decrypt, e as encrypt } from './shared/unjwt.BZ3B0Ak8.mjs';
|
|
4
|
+
import './shared/unjwt.BpusjhPR.mjs';
|
package/dist/jwk.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as CompositeKey, d as ContentEncryptionAlgorithm, D as DeriveKeyOptions, c as DeriveKeyReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, r as JWK, M as JWKAlgorithm, N as JWKPEMAlgorithm, J as JWKParameters, s as JWKSet, A as JWK_AES_CBC_HMAC, B as JWK_AES_GCM, z as JWK_AES_GCM_KW, y as JWK_AES_KW, L as JWK_Asymmetric_Algorithm, h as JWK_EC, F as JWK_ECDH_ES, w as JWK_ECDSA, g as JWK_EC_Private, f as JWK_EC_Public, t as JWK_HMAC, n as JWK_OKP, m as JWK_OKP_Private, l as JWK_OKP_Public, H as JWK_OKP_SIGN, E as JWK_PBES2, q as JWK_Private, p as JWK_Public, k as JWK_RSA, x as JWK_RSA_ENC, v as JWK_RSA_PSS, j as JWK_RSA_Private, i as JWK_RSA_Public, u as JWK_RSA_SIGN, I as JWK_Symmetric_Algorithm, o as JWK_oct, Q as JWT, R as JWTClaimValidationOptions, P as JWTClaims, O as JoseHeaderParameters, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, e as WrapKeyResult } from './shared/unjwt.
|
|
2
|
-
export { d as deriveKeyFromPassword, b as exportJWKToPEM, e as exportKey, g as generateKey, c as getJWKFromSet, a as importJWKFromPEM, i as importKey, u as unwrapKey, w as wrapKey } from './shared/unjwt.
|
|
1
|
+
export { C as CompositeKey, d as ContentEncryptionAlgorithm, D as DeriveKeyOptions, c as DeriveKeyReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, r as JWK, M as JWKAlgorithm, N as JWKPEMAlgorithm, J as JWKParameters, s as JWKSet, A as JWK_AES_CBC_HMAC, B as JWK_AES_GCM, z as JWK_AES_GCM_KW, y as JWK_AES_KW, L as JWK_Asymmetric_Algorithm, h as JWK_EC, F as JWK_ECDH_ES, w as JWK_ECDSA, g as JWK_EC_Private, f as JWK_EC_Public, t as JWK_HMAC, n as JWK_OKP, m as JWK_OKP_Private, l as JWK_OKP_Public, H as JWK_OKP_SIGN, E as JWK_PBES2, q as JWK_Private, p as JWK_Public, k as JWK_RSA, x as JWK_RSA_ENC, v as JWK_RSA_PSS, j as JWK_RSA_Private, i as JWK_RSA_Public, u as JWK_RSA_SIGN, I as JWK_Symmetric_Algorithm, o as JWK_oct, Q as JWT, R as JWTClaimValidationOptions, P as JWTClaims, O as JoseHeaderParameters, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, e as WrapKeyResult } from './shared/unjwt.OzI0aGB_.mjs';
|
|
2
|
+
export { d as deriveKeyFromPassword, b as exportJWKToPEM, e as exportKey, g as generateKey, c as getJWKFromSet, a as importJWKFromPEM, i as importKey, u as unwrapKey, w as wrapKey } from './shared/unjwt.CbxAdgsb.mjs';
|
package/dist/jwk.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './shared/unjwt.
|
|
2
|
-
export { p as deriveKeyFromPassword, t as exportJWKToPEM, q as exportKey, o as generateKey, g as getJWKFromSet, s as importJWKFromPEM, i as importKey, m as unwrapKey, r as wrapKey } from './shared/unjwt.
|
|
1
|
+
import './shared/unjwt.CRHfsi7v.mjs';
|
|
2
|
+
export { p as deriveKeyFromPassword, t as exportJWKToPEM, q as exportKey, o as generateKey, g as getJWKFromSet, s as importJWKFromPEM, i as importKey, m as unwrapKey, r as wrapKey } from './shared/unjwt.D1MC63Yb.mjs';
|
package/dist/jws.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Q as JWT, R as JWTClaimValidationOptions, P as JWTClaims, O as JoseHeaderParameters } from './shared/unjwt.
|
|
2
|
-
export { J as JWSAlgorithm, a as JWSHeaderParameters, f as JWSKeyLookupFunction, b as JWSProtectedHeader, c as JWSSignOptions, e as JWSVerifyOptions, d as JWSVerifyResult, s as sign, v as verify } from './shared/unjwt.
|
|
1
|
+
export { C as CompositeKey, d as ContentEncryptionAlgorithm, D as DeriveKeyOptions, c as DeriveKeyReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, r as JWK, M as JWKAlgorithm, N as JWKPEMAlgorithm, J as JWKParameters, s as JWKSet, A as JWK_AES_CBC_HMAC, B as JWK_AES_GCM, z as JWK_AES_GCM_KW, y as JWK_AES_KW, L as JWK_Asymmetric_Algorithm, h as JWK_EC, F as JWK_ECDH_ES, w as JWK_ECDSA, g as JWK_EC_Private, f as JWK_EC_Public, t as JWK_HMAC, n as JWK_OKP, m as JWK_OKP_Private, l as JWK_OKP_Public, H as JWK_OKP_SIGN, E as JWK_PBES2, q as JWK_Private, p as JWK_Public, k as JWK_RSA, x as JWK_RSA_ENC, v as JWK_RSA_PSS, j as JWK_RSA_Private, i as JWK_RSA_Public, u as JWK_RSA_SIGN, I as JWK_Symmetric_Algorithm, o as JWK_oct, Q as JWT, R as JWTClaimValidationOptions, P as JWTClaims, O as JoseHeaderParameters, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, e as WrapKeyResult } from './shared/unjwt.OzI0aGB_.mjs';
|
|
2
|
+
export { J as JWSAlgorithm, a as JWSHeaderParameters, f as JWSKeyLookupFunction, b as JWSProtectedHeader, c as JWSSignOptions, e as JWSVerifyOptions, d as JWSVerifyResult, s as sign, v as verify } from './shared/unjwt.r8lbwWSJ.mjs';
|
package/dist/jws.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './shared/unjwt.
|
|
2
|
-
import './shared/unjwt.
|
|
3
|
-
import './shared/unjwt.
|
|
4
|
-
export { s as sign, v as verify } from './shared/unjwt.
|
|
1
|
+
import './shared/unjwt.D1MC63Yb.mjs';
|
|
2
|
+
import './shared/unjwt.CRHfsi7v.mjs';
|
|
3
|
+
import './shared/unjwt.BpusjhPR.mjs';
|
|
4
|
+
export { s as sign, v as verify } from './shared/unjwt.u3h40Nr-.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as checkEncCryptoKey, u as uint32be, b as generateCEK, e as encryptIV, w as wrap, k as keyToJWK, d as bitLengthCEK, f as jwkTokey, i as importKey, h as generateIV, l as encrypt$1, m as unwrapKey, n as decrypt$1 } from './unjwt.
|
|
2
|
-
import { k as concatUint8Arrays, t as textEncoder, l as assertCryptoKey, d as base64UrlEncode, m as isCryptoKey, a as isJWK, s as sanitizeObject, f as base64UrlDecode, r as randomBytes, b as applyTypCtyDefaults, c as computeJwtTimeClaims, n as getPlaintextBytes, o as decodePayloadFromBytes, p as validateCriticalHeadersJWE } from './unjwt.
|
|
3
|
-
import { c as checkKeyLength } from './unjwt.
|
|
1
|
+
import { a as checkEncCryptoKey, u as uint32be, b as generateCEK, e as encryptIV, w as wrap, k as keyToJWK, d as bitLengthCEK, f as jwkTokey, i as importKey, h as generateIV, l as encrypt$1, m as unwrapKey, n as decrypt$1 } from './unjwt.D1MC63Yb.mjs';
|
|
2
|
+
import { k as concatUint8Arrays, t as textEncoder, l as assertCryptoKey, d as base64UrlEncode, m as isCryptoKey, a as isJWK, s as sanitizeObject, f as base64UrlDecode, r as randomBytes, b as applyTypCtyDefaults, c as computeJwtTimeClaims, n as getPlaintextBytes, o as decodePayloadFromBytes, p as validateCriticalHeadersJWE, j as validateJwtClaims } from './unjwt.CRHfsi7v.mjs';
|
|
3
|
+
import { c as checkKeyLength } from './unjwt.BpusjhPR.mjs';
|
|
4
4
|
|
|
5
5
|
function lengthAndInput(input) {
|
|
6
6
|
return concatUint8Arrays(uint32be(input.length), input);
|
|
@@ -293,7 +293,7 @@ async function encrypt(payload, key, options = {}) {
|
|
|
293
293
|
];
|
|
294
294
|
return jweParts.join(".");
|
|
295
295
|
}
|
|
296
|
-
async function decrypt(jwe, key, options) {
|
|
296
|
+
async function decrypt(jwe, key, options = {}) {
|
|
297
297
|
const parts = jwe.split(".");
|
|
298
298
|
if (parts.length !== 5) {
|
|
299
299
|
throw new Error(
|
|
@@ -375,6 +375,9 @@ async function decrypt(jwe, key, options) {
|
|
|
375
375
|
...options?.critical || [],
|
|
376
376
|
...options?.requiredHeaders || []
|
|
377
377
|
]);
|
|
378
|
+
if (payload && typeof payload === "object" && options.validateJWT !== false && (options.validateJWT === true || protectedHeader.typ?.toLowerCase().includes("jwt")) && !options.forceUint8Array && !(payload instanceof Uint8Array)) {
|
|
379
|
+
validateJwtClaims(payload, options);
|
|
380
|
+
}
|
|
378
381
|
return {
|
|
379
382
|
payload,
|
|
380
383
|
protectedHeader,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { K as KeyManagementAlgorithm, d as ContentEncryptionAlgorithm, O as JoseHeaderParameters, f as JWK_EC_Public, r as JWK, R as JWTClaimValidationOptions, P as JWTClaims, Q as JWT } from './unjwt.
|
|
1
|
+
import { K as KeyManagementAlgorithm, d as ContentEncryptionAlgorithm, O as JoseHeaderParameters, f as JWK_EC_Public, r as JWK, R as JWTClaimValidationOptions, P as JWTClaims, C as CompositeKey, D as DeriveKeyOptions, c as DeriveKeyReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, M as JWKAlgorithm, N as JWKPEMAlgorithm, J as JWKParameters, s as JWKSet, A as JWK_AES_CBC_HMAC, B as JWK_AES_GCM, z as JWK_AES_GCM_KW, y as JWK_AES_KW, L as JWK_Asymmetric_Algorithm, h as JWK_EC, F as JWK_ECDH_ES, w as JWK_ECDSA, g as JWK_EC_Private, t as JWK_HMAC, n as JWK_OKP, m as JWK_OKP_Private, l as JWK_OKP_Public, H as JWK_OKP_SIGN, E as JWK_PBES2, q as JWK_Private, p as JWK_Public, k as JWK_RSA, x as JWK_RSA_ENC, v as JWK_RSA_PSS, j as JWK_RSA_Private, i as JWK_RSA_Public, u as JWK_RSA_SIGN, I as JWK_Symmetric_Algorithm, o as JWK_oct, Q as JWT, U as UnwrapKeyOptions, W as WrapKeyOptions, e as WrapKeyResult } from './unjwt.OzI0aGB_.mjs';
|
|
2
2
|
|
|
3
3
|
/** Recognized JWE Header Parameters, any other Header Members may also be present. */
|
|
4
4
|
interface JWEHeaderParameters extends JoseHeaderParameters {
|
|
@@ -72,7 +72,7 @@ interface JWEEncryptOptions {
|
|
|
72
72
|
enc?: ContentEncryptionAlgorithm;
|
|
73
73
|
/** Date to use when computing NumericDate claims, defaults to `new Date()`. */
|
|
74
74
|
currentDate?: Date;
|
|
75
|
-
/** Time at which the JWT should expire, if no `exp` was already provided (only when typ is "
|
|
75
|
+
/** Time at which the JWT should expire, if no `exp` was already provided (only when typ is "JWT" or explicitly parsing JWT). */
|
|
76
76
|
expiresIn?: number;
|
|
77
77
|
/** Additional JWE Protected Header parameters. */
|
|
78
78
|
protectedHeader?: Omit<JWEHeaderParameters, "alg" | "enc" | "iv" | "tag" | "p2s" | "p2c" | "apu" | "apv">;
|
|
@@ -119,6 +119,8 @@ interface JWEDecryptOptions extends JWTClaimValidationOptions {
|
|
|
119
119
|
extractable?: boolean;
|
|
120
120
|
/** If true, forces the payload to be returned as a Uint8Array, otherwise type is inferred based on JWE headers. */
|
|
121
121
|
forceUint8Array?: boolean;
|
|
122
|
+
/** Unless false, will parse payload as JWT and validate claims if applicable (typ "JWT"). */
|
|
123
|
+
validateJWT?: boolean;
|
|
122
124
|
}
|
|
123
125
|
/**
|
|
124
126
|
* Result of a JWE decryption operation.
|
|
@@ -170,20 +172,62 @@ declare function decrypt(jwe: string, key: CryptoKey | JWK | string | Uint8Array
|
|
|
170
172
|
forceUint8Array: true;
|
|
171
173
|
}): Promise<JWEDecryptResult<Uint8Array<ArrayBuffer>>>;
|
|
172
174
|
|
|
175
|
+
declare const jwe_CompositeKey: typeof CompositeKey;
|
|
176
|
+
declare const jwe_ContentEncryptionAlgorithm: typeof ContentEncryptionAlgorithm;
|
|
177
|
+
declare const jwe_DeriveKeyOptions: typeof DeriveKeyOptions;
|
|
178
|
+
declare const jwe_DeriveKeyReturn: typeof DeriveKeyReturn;
|
|
179
|
+
declare const jwe_GenerateKeyAlgorithm: typeof GenerateKeyAlgorithm;
|
|
180
|
+
declare const jwe_GenerateKeyOptions: typeof GenerateKeyOptions;
|
|
181
|
+
declare const jwe_GenerateKeyReturn: typeof GenerateKeyReturn;
|
|
173
182
|
type jwe_JWEDecryptOptions = JWEDecryptOptions;
|
|
174
183
|
type jwe_JWEDecryptResult<T extends JWTClaims | Uint8Array<ArrayBuffer> | string = JWTClaims | Uint8Array<ArrayBuffer> | string> = JWEDecryptResult<T>;
|
|
175
184
|
type jwe_JWEEncryptOptions = JWEEncryptOptions;
|
|
176
185
|
type jwe_JWEHeaderParameters = JWEHeaderParameters;
|
|
177
186
|
type jwe_JWEKeyLookupFunction = JWEKeyLookupFunction;
|
|
178
187
|
type jwe_JWEKeyManagementHeaderParameters = JWEKeyManagementHeaderParameters;
|
|
188
|
+
declare const jwe_JWK: typeof JWK;
|
|
189
|
+
declare const jwe_JWKAlgorithm: typeof JWKAlgorithm;
|
|
190
|
+
declare const jwe_JWKPEMAlgorithm: typeof JWKPEMAlgorithm;
|
|
191
|
+
declare const jwe_JWKParameters: typeof JWKParameters;
|
|
192
|
+
declare const jwe_JWKSet: typeof JWKSet;
|
|
193
|
+
declare const jwe_JWK_AES_CBC_HMAC: typeof JWK_AES_CBC_HMAC;
|
|
194
|
+
declare const jwe_JWK_AES_GCM: typeof JWK_AES_GCM;
|
|
195
|
+
declare const jwe_JWK_AES_GCM_KW: typeof JWK_AES_GCM_KW;
|
|
196
|
+
declare const jwe_JWK_AES_KW: typeof JWK_AES_KW;
|
|
197
|
+
declare const jwe_JWK_Asymmetric_Algorithm: typeof JWK_Asymmetric_Algorithm;
|
|
198
|
+
declare const jwe_JWK_EC: typeof JWK_EC;
|
|
199
|
+
declare const jwe_JWK_ECDH_ES: typeof JWK_ECDH_ES;
|
|
200
|
+
declare const jwe_JWK_ECDSA: typeof JWK_ECDSA;
|
|
201
|
+
declare const jwe_JWK_EC_Private: typeof JWK_EC_Private;
|
|
202
|
+
declare const jwe_JWK_EC_Public: typeof JWK_EC_Public;
|
|
203
|
+
declare const jwe_JWK_HMAC: typeof JWK_HMAC;
|
|
204
|
+
declare const jwe_JWK_OKP: typeof JWK_OKP;
|
|
205
|
+
declare const jwe_JWK_OKP_Private: typeof JWK_OKP_Private;
|
|
206
|
+
declare const jwe_JWK_OKP_Public: typeof JWK_OKP_Public;
|
|
207
|
+
declare const jwe_JWK_OKP_SIGN: typeof JWK_OKP_SIGN;
|
|
208
|
+
declare const jwe_JWK_PBES2: typeof JWK_PBES2;
|
|
209
|
+
declare const jwe_JWK_Private: typeof JWK_Private;
|
|
210
|
+
declare const jwe_JWK_Public: typeof JWK_Public;
|
|
211
|
+
declare const jwe_JWK_RSA: typeof JWK_RSA;
|
|
212
|
+
declare const jwe_JWK_RSA_ENC: typeof JWK_RSA_ENC;
|
|
213
|
+
declare const jwe_JWK_RSA_PSS: typeof JWK_RSA_PSS;
|
|
214
|
+
declare const jwe_JWK_RSA_Private: typeof JWK_RSA_Private;
|
|
215
|
+
declare const jwe_JWK_RSA_Public: typeof JWK_RSA_Public;
|
|
216
|
+
declare const jwe_JWK_RSA_SIGN: typeof JWK_RSA_SIGN;
|
|
217
|
+
declare const jwe_JWK_Symmetric_Algorithm: typeof JWK_Symmetric_Algorithm;
|
|
218
|
+
declare const jwe_JWK_oct: typeof JWK_oct;
|
|
179
219
|
declare const jwe_JWT: typeof JWT;
|
|
180
220
|
declare const jwe_JWTClaimValidationOptions: typeof JWTClaimValidationOptions;
|
|
181
221
|
declare const jwe_JWTClaims: typeof JWTClaims;
|
|
182
222
|
declare const jwe_JoseHeaderParameters: typeof JoseHeaderParameters;
|
|
223
|
+
declare const jwe_KeyManagementAlgorithm: typeof KeyManagementAlgorithm;
|
|
224
|
+
declare const jwe_UnwrapKeyOptions: typeof UnwrapKeyOptions;
|
|
225
|
+
declare const jwe_WrapKeyOptions: typeof WrapKeyOptions;
|
|
226
|
+
declare const jwe_WrapKeyResult: typeof WrapKeyResult;
|
|
183
227
|
declare const jwe_decrypt: typeof decrypt;
|
|
184
228
|
declare const jwe_encrypt: typeof encrypt;
|
|
185
229
|
declare namespace jwe {
|
|
186
|
-
export { jwe_JWT as JWT, jwe_JWTClaimValidationOptions as JWTClaimValidationOptions, jwe_JWTClaims as JWTClaims, jwe_JoseHeaderParameters as JoseHeaderParameters, jwe_decrypt as decrypt, jwe_encrypt as encrypt };
|
|
230
|
+
export { jwe_CompositeKey as CompositeKey, jwe_ContentEncryptionAlgorithm as ContentEncryptionAlgorithm, jwe_DeriveKeyOptions as DeriveKeyOptions, jwe_DeriveKeyReturn as DeriveKeyReturn, jwe_GenerateKeyAlgorithm as GenerateKeyAlgorithm, jwe_GenerateKeyOptions as GenerateKeyOptions, jwe_GenerateKeyReturn as GenerateKeyReturn, jwe_JWK as JWK, jwe_JWKAlgorithm as JWKAlgorithm, jwe_JWKPEMAlgorithm as JWKPEMAlgorithm, jwe_JWKParameters as JWKParameters, jwe_JWKSet as JWKSet, jwe_JWK_AES_CBC_HMAC as JWK_AES_CBC_HMAC, jwe_JWK_AES_GCM as JWK_AES_GCM, jwe_JWK_AES_GCM_KW as JWK_AES_GCM_KW, jwe_JWK_AES_KW as JWK_AES_KW, jwe_JWK_Asymmetric_Algorithm as JWK_Asymmetric_Algorithm, jwe_JWK_EC as JWK_EC, jwe_JWK_ECDH_ES as JWK_ECDH_ES, jwe_JWK_ECDSA as JWK_ECDSA, jwe_JWK_EC_Private as JWK_EC_Private, jwe_JWK_EC_Public as JWK_EC_Public, jwe_JWK_HMAC as JWK_HMAC, jwe_JWK_OKP as JWK_OKP, jwe_JWK_OKP_Private as JWK_OKP_Private, jwe_JWK_OKP_Public as JWK_OKP_Public, jwe_JWK_OKP_SIGN as JWK_OKP_SIGN, jwe_JWK_PBES2 as JWK_PBES2, jwe_JWK_Private as JWK_Private, jwe_JWK_Public as JWK_Public, jwe_JWK_RSA as JWK_RSA, jwe_JWK_RSA_ENC as JWK_RSA_ENC, jwe_JWK_RSA_PSS as JWK_RSA_PSS, jwe_JWK_RSA_Private as JWK_RSA_Private, jwe_JWK_RSA_Public as JWK_RSA_Public, jwe_JWK_RSA_SIGN as JWK_RSA_SIGN, jwe_JWK_Symmetric_Algorithm as JWK_Symmetric_Algorithm, jwe_JWK_oct as JWK_oct, jwe_JWT as JWT, jwe_JWTClaimValidationOptions as JWTClaimValidationOptions, jwe_JWTClaims as JWTClaims, jwe_JoseHeaderParameters as JoseHeaderParameters, jwe_KeyManagementAlgorithm as KeyManagementAlgorithm, jwe_UnwrapKeyOptions as UnwrapKeyOptions, jwe_WrapKeyOptions as WrapKeyOptions, jwe_WrapKeyResult as WrapKeyResult, jwe_decrypt as decrypt, jwe_encrypt as encrypt };
|
|
187
231
|
export type { jwe_JWEDecryptOptions as JWEDecryptOptions, jwe_JWEDecryptResult as JWEDecryptResult, jwe_JWEEncryptOptions as JWEEncryptOptions, jwe_JWEHeaderParameters as JWEHeaderParameters, jwe_JWEKeyLookupFunction as JWEKeyLookupFunction, jwe_JWEKeyManagementHeaderParameters as JWEKeyManagementHeaderParameters };
|
|
188
232
|
}
|
|
189
233
|
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
function applyTypCtyDefaults(header, payload) {
|
|
2
2
|
const isObjectPayload = typeof payload === "object" && payload !== null && !(payload instanceof Uint8Array);
|
|
3
3
|
if (header.typ === void 0 && isObjectPayload) {
|
|
4
|
-
header.typ = "
|
|
4
|
+
header.typ = "JWT";
|
|
5
5
|
}
|
|
6
|
-
if (
|
|
6
|
+
if (header.typ?.toLowerCase().includes("jwt") && isObjectPayload) {
|
|
7
7
|
header.cty ||= "application/json";
|
|
8
8
|
}
|
|
9
9
|
return header;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function isJWTContent(header) {
|
|
12
12
|
if (!header) return false;
|
|
13
|
-
if (header.typ
|
|
14
|
-
if (header.typ === "JWT") return true;
|
|
13
|
+
if (header.typ?.toLowerCase().includes("jwt")) return true;
|
|
15
14
|
const cty = header.cty?.toLowerCase();
|
|
16
15
|
return cty === "json" || cty === "application/json" || !!cty && cty.endsWith("+json");
|
|
17
16
|
}
|
|
18
|
-
function
|
|
19
|
-
if (
|
|
17
|
+
function decodeMaybeJWTString(decodedString, header) {
|
|
18
|
+
if (isJWTContent(header)) {
|
|
20
19
|
const looksLikeJson = decodedString.startsWith("{") && decodedString.endsWith("}") || decodedString.startsWith("[") && decodedString.endsWith("]");
|
|
21
20
|
if (looksLikeJson) {
|
|
22
21
|
try {
|
|
@@ -31,12 +30,12 @@ function decodeMaybeJsonString(decodedString, header) {
|
|
|
31
30
|
function decodePayloadFromBytes(bytes, header, forceUint8Array) {
|
|
32
31
|
if (forceUint8Array) return bytes;
|
|
33
32
|
const decodedString = textDecoder.decode(bytes);
|
|
34
|
-
return
|
|
33
|
+
return decodeMaybeJWTString(decodedString, header);
|
|
35
34
|
}
|
|
36
35
|
function decodePayloadFromB64UrlSegment(payloadEncoded, header, forceUint8Array) {
|
|
37
36
|
if (forceUint8Array) return base64UrlDecode(payloadEncoded, false);
|
|
38
37
|
const decodedString = base64UrlDecode(payloadEncoded);
|
|
39
|
-
return
|
|
38
|
+
return decodeMaybeJWTString(decodedString, header);
|
|
40
39
|
}
|
|
41
40
|
function getPlaintextBytes(payload) {
|
|
42
41
|
if (payload instanceof Uint8Array) return payload;
|
|
@@ -48,13 +47,13 @@ function getPlaintextBytes(payload) {
|
|
|
48
47
|
);
|
|
49
48
|
}
|
|
50
49
|
function computeJwtTimeClaims(payload, headerTyp, expiresIn, currentDate = /* @__PURE__ */ new Date()) {
|
|
51
|
-
if (expiresIn === void 0 || headerTyp
|
|
50
|
+
if (expiresIn === void 0 || !headerTyp?.toLowerCase().includes("jwt") || !(payload && typeof payload === "object") || payload instanceof Uint8Array || payload.exp) {
|
|
52
51
|
return void 0;
|
|
53
52
|
}
|
|
54
53
|
const now = Math.round(currentDate.getTime() / 1e3);
|
|
55
54
|
const claims = { ...payload };
|
|
56
55
|
claims.iat ||= now;
|
|
57
|
-
claims.exp =
|
|
56
|
+
claims.exp = claims.iat + expiresIn;
|
|
58
57
|
return claims;
|
|
59
58
|
}
|
|
60
59
|
function validateJwtClaims(jwtClaims, options = {}) {
|
|
@@ -362,7 +361,7 @@ const index = {
|
|
|
362
361
|
base64UrlEncode: base64UrlEncode,
|
|
363
362
|
computeJwtTimeClaims: computeJwtTimeClaims,
|
|
364
363
|
concatUint8Arrays: concatUint8Arrays,
|
|
365
|
-
|
|
364
|
+
decodeMaybeJWTString: decodeMaybeJWTString,
|
|
366
365
|
decodePayloadFromB64UrlSegment: decodePayloadFromB64UrlSegment,
|
|
367
366
|
decodePayloadFromBytes: decodePayloadFromBytes,
|
|
368
367
|
getPlaintextBytes: getPlaintextBytes,
|
|
@@ -371,7 +370,7 @@ const index = {
|
|
|
371
370
|
isCryptoKeyPair: isCryptoKeyPair,
|
|
372
371
|
isJWK: isJWK,
|
|
373
372
|
isJWKSet: isJWKSet,
|
|
374
|
-
|
|
373
|
+
isJWTContent: isJWTContent,
|
|
375
374
|
isPrivateJWK: isPrivateJWK,
|
|
376
375
|
isPublicJWK: isPublicJWK,
|
|
377
376
|
isSymmetricJWK: isSymmetricJWK,
|
|
@@ -385,4 +384,4 @@ const index = {
|
|
|
385
384
|
validateJwtClaims: validateJwtClaims
|
|
386
385
|
};
|
|
387
386
|
|
|
388
|
-
export { isPrivateJWK as A, isPublicJWK as B,
|
|
387
|
+
export { isPrivateJWK as A, isPublicJWK as B, isJWTContent as C, decodeMaybeJWTString as D, isJWK as a, applyTypCtyDefaults as b, computeJwtTimeClaims as c, base64UrlEncode as d, textDecoder as e, base64UrlDecode as f, isJWKSet as g, decodePayloadFromB64UrlSegment as h, index as i, validateJwtClaims as j, concatUint8Arrays as k, assertCryptoKey as l, isCryptoKey as m, getPlaintextBytes as n, decodePayloadFromBytes as o, validateCriticalHeadersJWE as p, base64Decode as q, randomBytes as r, sanitizeObject as s, textEncoder as t, base64Encode as u, validateCriticalHeadersJWS as v, maybeArray as w, isCryptoKeyPair as x, isSymmetricJWK as y, isAsymmetricJWK as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, E as JWK_PBES2, D as DeriveKeyOptions, c as DeriveKeyReturn, o as JWK_oct, r as JWK, K as KeyManagementAlgorithm, W as WrapKeyOptions, e as WrapKeyResult, U as UnwrapKeyOptions, N as JWKPEMAlgorithm, s as JWKSet, O as JoseHeaderParameters, C as CompositeKey, d as ContentEncryptionAlgorithm, M as JWKAlgorithm, J as JWKParameters, A as JWK_AES_CBC_HMAC, B as JWK_AES_GCM, z as JWK_AES_GCM_KW, y as JWK_AES_KW, L as JWK_Asymmetric_Algorithm, h as JWK_EC, F as JWK_ECDH_ES, w as JWK_ECDSA, g as JWK_EC_Private, f as JWK_EC_Public, t as JWK_HMAC, n as JWK_OKP, m as JWK_OKP_Private, l as JWK_OKP_Public, H as JWK_OKP_SIGN, q as JWK_Private, p as JWK_Public, k as JWK_RSA, x as JWK_RSA_ENC, v as JWK_RSA_PSS, j as JWK_RSA_Private, i as JWK_RSA_Public, u as JWK_RSA_SIGN, I as JWK_Symmetric_Algorithm, Q as JWT, R as JWTClaimValidationOptions, P as JWTClaims } from './unjwt.
|
|
1
|
+
import { G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, E as JWK_PBES2, D as DeriveKeyOptions, c as DeriveKeyReturn, o as JWK_oct, r as JWK, K as KeyManagementAlgorithm, W as WrapKeyOptions, e as WrapKeyResult, U as UnwrapKeyOptions, N as JWKPEMAlgorithm, s as JWKSet, O as JoseHeaderParameters, C as CompositeKey, d as ContentEncryptionAlgorithm, M as JWKAlgorithm, J as JWKParameters, A as JWK_AES_CBC_HMAC, B as JWK_AES_GCM, z as JWK_AES_GCM_KW, y as JWK_AES_KW, L as JWK_Asymmetric_Algorithm, h as JWK_EC, F as JWK_ECDH_ES, w as JWK_ECDSA, g as JWK_EC_Private, f as JWK_EC_Public, t as JWK_HMAC, n as JWK_OKP, m as JWK_OKP_Private, l as JWK_OKP_Public, H as JWK_OKP_SIGN, q as JWK_Private, p as JWK_Public, k as JWK_RSA, x as JWK_RSA_ENC, v as JWK_RSA_PSS, j as JWK_RSA_Private, i as JWK_RSA_Public, u as JWK_RSA_SIGN, I as JWK_Symmetric_Algorithm, Q as JWT, R as JWTClaimValidationOptions, P as JWTClaims } from './unjwt.OzI0aGB_.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This is a fork of Jose library's utility functions.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as isCryptoKey, k as concatUint8Arrays, d as base64UrlEncode, q as base64Decode, u as base64Encode, s as sanitizeObject, t as textEncoder, r as randomBytes, a as isJWK, f as base64UrlDecode, g as isJWKSet } from './unjwt.
|
|
1
|
+
import { m as isCryptoKey, k as concatUint8Arrays, d as base64UrlEncode, q as base64Decode, u as base64Encode, s as sanitizeObject, t as textEncoder, r as randomBytes, a as isJWK, f as base64UrlDecode, g as isJWKSet } from './unjwt.CRHfsi7v.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This is a fork of Jose library's utility functions.
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { P as JWTClaims, R as JWTClaimValidationOptions, r as JWK, s as JWKSet, o as JWK_oct, q as JWK_Private, p as JWK_Public } from './unjwt.
|
|
1
|
+
import { P as JWTClaims, R as JWTClaimValidationOptions, r as JWK, s as JWKSet, o as JWK_oct, q as JWK_Private, p as JWK_Public } from './unjwt.OzI0aGB_.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Apply default typ/cty semantics shared by JWS & JWE.
|
|
5
|
-
* - If typ is undefined and payload is a non-Uint8Array object, set typ="
|
|
6
|
-
* - If typ is "
|
|
5
|
+
* - If typ is undefined and payload is a non-Uint8Array object, set typ="JWT".
|
|
6
|
+
* - If typ is "JWT" and payload is a non-Uint8Array object, ensure cty defaults to "application/json".
|
|
7
7
|
*/
|
|
8
8
|
declare function applyTypCtyDefaults<T extends {
|
|
9
9
|
typ?: string;
|
|
10
10
|
cty?: string;
|
|
11
11
|
}>(header: T, payload: unknown): T;
|
|
12
12
|
/** Returns true when headers indicate JSON content. */
|
|
13
|
-
declare function
|
|
13
|
+
declare function isJWTContent(header: {
|
|
14
14
|
typ?: string;
|
|
15
15
|
cty?: string;
|
|
16
16
|
} | undefined): boolean;
|
|
17
17
|
/**
|
|
18
18
|
* Given a decoded string and JOSE headers, return an object if JSON, otherwise the string.
|
|
19
19
|
*/
|
|
20
|
-
declare function
|
|
20
|
+
declare function decodeMaybeJWTString<T = unknown>(decodedString: string, header: {
|
|
21
21
|
typ?: string;
|
|
22
22
|
cty?: string;
|
|
23
23
|
} | undefined): T | string;
|
|
@@ -85,9 +85,9 @@ declare function assertCryptoKey(key: unknown): asserts key is CryptoKey;
|
|
|
85
85
|
declare function isCryptoKey(key: unknown): key is CryptoKey;
|
|
86
86
|
declare const isCryptoKeyPair: (key: any) => key is CryptoKeyPair;
|
|
87
87
|
/** Returns true if the JWK is a symmetric (oct) key. */
|
|
88
|
-
declare function isSymmetricJWK(key: unknown): key is JWK_oct
|
|
88
|
+
declare function isSymmetricJWK(key: unknown): key is Extract<JWK, JWK_oct>;
|
|
89
89
|
/** Returns true if the JWK is an asymmetric (RSA, EC, OKP) key. */
|
|
90
|
-
declare function isAsymmetricJWK(key: unknown): key is JWK_oct
|
|
90
|
+
declare function isAsymmetricJWK(key: unknown): key is Exclude<JWK, JWK_oct>;
|
|
91
91
|
/**
|
|
92
92
|
* Type guard that checks if the provided JWK contains private key material.
|
|
93
93
|
* It relies purely on the presence of private components (e.g. "d"), not on the alg value.
|
|
@@ -107,7 +107,7 @@ declare const index_base64UrlDecode: typeof base64UrlDecode;
|
|
|
107
107
|
declare const index_base64UrlEncode: typeof base64UrlEncode;
|
|
108
108
|
declare const index_computeJwtTimeClaims: typeof computeJwtTimeClaims;
|
|
109
109
|
declare const index_concatUint8Arrays: typeof concatUint8Arrays;
|
|
110
|
-
declare const
|
|
110
|
+
declare const index_decodeMaybeJWTString: typeof decodeMaybeJWTString;
|
|
111
111
|
declare const index_decodePayloadFromB64UrlSegment: typeof decodePayloadFromB64UrlSegment;
|
|
112
112
|
declare const index_decodePayloadFromBytes: typeof decodePayloadFromBytes;
|
|
113
113
|
declare const index_getPlaintextBytes: typeof getPlaintextBytes;
|
|
@@ -116,7 +116,7 @@ declare const index_isCryptoKey: typeof isCryptoKey;
|
|
|
116
116
|
declare const index_isCryptoKeyPair: typeof isCryptoKeyPair;
|
|
117
117
|
declare const index_isJWK: typeof isJWK;
|
|
118
118
|
declare const index_isJWKSet: typeof isJWKSet;
|
|
119
|
-
declare const
|
|
119
|
+
declare const index_isJWTContent: typeof isJWTContent;
|
|
120
120
|
declare const index_isPrivateJWK: typeof isPrivateJWK;
|
|
121
121
|
declare const index_isPublicJWK: typeof isPublicJWK;
|
|
122
122
|
declare const index_isSymmetricJWK: typeof isSymmetricJWK;
|
|
@@ -138,7 +138,7 @@ declare namespace index {
|
|
|
138
138
|
index_base64UrlEncode as base64UrlEncode,
|
|
139
139
|
index_computeJwtTimeClaims as computeJwtTimeClaims,
|
|
140
140
|
index_concatUint8Arrays as concatUint8Arrays,
|
|
141
|
-
|
|
141
|
+
index_decodeMaybeJWTString as decodeMaybeJWTString,
|
|
142
142
|
index_decodePayloadFromB64UrlSegment as decodePayloadFromB64UrlSegment,
|
|
143
143
|
index_decodePayloadFromBytes as decodePayloadFromBytes,
|
|
144
144
|
index_getPlaintextBytes as getPlaintextBytes,
|
|
@@ -147,7 +147,7 @@ declare namespace index {
|
|
|
147
147
|
index_isCryptoKeyPair as isCryptoKeyPair,
|
|
148
148
|
index_isJWK as isJWK,
|
|
149
149
|
index_isJWKSet as isJWKSet,
|
|
150
|
-
|
|
150
|
+
index_isJWTContent as isJWTContent,
|
|
151
151
|
index_isPrivateJWK as isPrivateJWK,
|
|
152
152
|
index_isPublicJWK as isPublicJWK,
|
|
153
153
|
index_isSymmetricJWK as isSymmetricJWK,
|
|
@@ -162,4 +162,4 @@ declare namespace index {
|
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
export { validateJwtClaims as A, validateCriticalHeadersJWS as B, validateCriticalHeadersJWE as C, sanitizeObject as D, textDecoder as a, base64Encode as b, base64UrlEncode as c, base64Decode as d, base64UrlDecode as e, concatUint8Arrays as f, isJWK as g, isJWKSet as h, index as i, assertCryptoKey as j, isCryptoKey as k, isCryptoKeyPair as l, maybeArray as m, isSymmetricJWK as n, isAsymmetricJWK as o, isPrivateJWK as p, isPublicJWK as q, randomBytes as r, applyTypCtyDefaults as s, textEncoder as t,
|
|
165
|
+
export { validateJwtClaims as A, validateCriticalHeadersJWS as B, validateCriticalHeadersJWE as C, sanitizeObject as D, textDecoder as a, base64Encode as b, base64UrlEncode as c, base64Decode as d, base64UrlDecode as e, concatUint8Arrays as f, isJWK as g, isJWKSet as h, index as i, assertCryptoKey as j, isCryptoKey as k, isCryptoKeyPair as l, maybeArray as m, isSymmetricJWK as n, isAsymmetricJWK as o, isPrivateJWK as p, isPublicJWK as q, randomBytes as r, applyTypCtyDefaults as s, textEncoder as t, isJWTContent as u, decodeMaybeJWTString as v, decodePayloadFromBytes as w, decodePayloadFromB64UrlSegment as x, getPlaintextBytes as y, computeJwtTimeClaims as z };
|
|
@@ -198,7 +198,7 @@ interface JWK_oct extends JWKParameters {
|
|
|
198
198
|
k: string;
|
|
199
199
|
}
|
|
200
200
|
/** Public JSON Web Keys */
|
|
201
|
-
type JWK_Public = JWK_RSA_Public | JWK_EC_Public | JWK_OKP_Public
|
|
201
|
+
type JWK_Public = JWK_RSA_Public | JWK_EC_Public | JWK_OKP_Public;
|
|
202
202
|
/** Private JSON Web Keys */
|
|
203
203
|
type JWK_Private = JWK_RSA_Private | JWK_EC_Private | JWK_OKP_Private;
|
|
204
204
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as JWK_HMAC, u as JWK_RSA_SIGN, v as JWK_RSA_PSS, w as JWK_ECDSA, O as JoseHeaderParameters, r as JWK, s as JWKSet, R as JWTClaimValidationOptions, P as JWTClaims, Q as JWT } from './unjwt.
|
|
1
|
+
import { t as JWK_HMAC, u as JWK_RSA_SIGN, v as JWK_RSA_PSS, w as JWK_ECDSA, O as JoseHeaderParameters, r as JWK, s as JWKSet, R as JWTClaimValidationOptions, P as JWTClaims, C as CompositeKey, d as ContentEncryptionAlgorithm, D as DeriveKeyOptions, c as DeriveKeyReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, M as JWKAlgorithm, N as JWKPEMAlgorithm, J as JWKParameters, A as JWK_AES_CBC_HMAC, B as JWK_AES_GCM, z as JWK_AES_GCM_KW, y as JWK_AES_KW, L as JWK_Asymmetric_Algorithm, h as JWK_EC, F as JWK_ECDH_ES, g as JWK_EC_Private, f as JWK_EC_Public, n as JWK_OKP, m as JWK_OKP_Private, l as JWK_OKP_Public, H as JWK_OKP_SIGN, E as JWK_PBES2, q as JWK_Private, p as JWK_Public, k as JWK_RSA, x as JWK_RSA_ENC, j as JWK_RSA_Private, i as JWK_RSA_Public, I as JWK_Symmetric_Algorithm, o as JWK_oct, Q as JWT, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, e as WrapKeyResult } from './unjwt.OzI0aGB_.mjs';
|
|
2
2
|
|
|
3
3
|
type JWS_SIGN_EXTRA = "Ed25519" | "EdDSA";
|
|
4
4
|
/** JWS Signing Algorithm Identifier. */
|
|
@@ -27,7 +27,7 @@ interface JWSSignOptions {
|
|
|
27
27
|
alg?: JWSAlgorithm;
|
|
28
28
|
/**
|
|
29
29
|
* Additional protected header parameters. `alg` is automatically included.
|
|
30
|
-
* `typ` defaults to "
|
|
30
|
+
* `typ` defaults to "JWT" if not provided and payload is an object.
|
|
31
31
|
*/
|
|
32
32
|
protectedHeader?: JWSHeaderParameters;
|
|
33
33
|
/** Date to use when comparing NumericDate claims, defaults to `new Date()`. */
|
|
@@ -50,6 +50,8 @@ interface JWSVerifyOptions extends JWTClaimValidationOptions {
|
|
|
50
50
|
algorithms?: JWSAlgorithm[];
|
|
51
51
|
/** If true, forces the payload to be returned as a Uint8Array, otherwise type is inferred. */
|
|
52
52
|
forceUint8Array?: boolean;
|
|
53
|
+
/** Unless false, will parse payload as JWT and validate claims if applicable (typ "JWT"). */
|
|
54
|
+
validateJWT?: boolean;
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* Key lookup function for JWS verification.
|
|
@@ -98,6 +100,44 @@ declare function verify(jws: string, key: CryptoKey | JWK | JWKSet | Uint8Array<
|
|
|
98
100
|
forceUint8Array: true;
|
|
99
101
|
}): Promise<JWSVerifyResult<Uint8Array<ArrayBuffer>>>;
|
|
100
102
|
|
|
103
|
+
declare const jws_CompositeKey: typeof CompositeKey;
|
|
104
|
+
declare const jws_ContentEncryptionAlgorithm: typeof ContentEncryptionAlgorithm;
|
|
105
|
+
declare const jws_DeriveKeyOptions: typeof DeriveKeyOptions;
|
|
106
|
+
declare const jws_DeriveKeyReturn: typeof DeriveKeyReturn;
|
|
107
|
+
declare const jws_GenerateKeyAlgorithm: typeof GenerateKeyAlgorithm;
|
|
108
|
+
declare const jws_GenerateKeyOptions: typeof GenerateKeyOptions;
|
|
109
|
+
declare const jws_GenerateKeyReturn: typeof GenerateKeyReturn;
|
|
110
|
+
declare const jws_JWK: typeof JWK;
|
|
111
|
+
declare const jws_JWKAlgorithm: typeof JWKAlgorithm;
|
|
112
|
+
declare const jws_JWKPEMAlgorithm: typeof JWKPEMAlgorithm;
|
|
113
|
+
declare const jws_JWKParameters: typeof JWKParameters;
|
|
114
|
+
declare const jws_JWKSet: typeof JWKSet;
|
|
115
|
+
declare const jws_JWK_AES_CBC_HMAC: typeof JWK_AES_CBC_HMAC;
|
|
116
|
+
declare const jws_JWK_AES_GCM: typeof JWK_AES_GCM;
|
|
117
|
+
declare const jws_JWK_AES_GCM_KW: typeof JWK_AES_GCM_KW;
|
|
118
|
+
declare const jws_JWK_AES_KW: typeof JWK_AES_KW;
|
|
119
|
+
declare const jws_JWK_Asymmetric_Algorithm: typeof JWK_Asymmetric_Algorithm;
|
|
120
|
+
declare const jws_JWK_EC: typeof JWK_EC;
|
|
121
|
+
declare const jws_JWK_ECDH_ES: typeof JWK_ECDH_ES;
|
|
122
|
+
declare const jws_JWK_ECDSA: typeof JWK_ECDSA;
|
|
123
|
+
declare const jws_JWK_EC_Private: typeof JWK_EC_Private;
|
|
124
|
+
declare const jws_JWK_EC_Public: typeof JWK_EC_Public;
|
|
125
|
+
declare const jws_JWK_HMAC: typeof JWK_HMAC;
|
|
126
|
+
declare const jws_JWK_OKP: typeof JWK_OKP;
|
|
127
|
+
declare const jws_JWK_OKP_Private: typeof JWK_OKP_Private;
|
|
128
|
+
declare const jws_JWK_OKP_Public: typeof JWK_OKP_Public;
|
|
129
|
+
declare const jws_JWK_OKP_SIGN: typeof JWK_OKP_SIGN;
|
|
130
|
+
declare const jws_JWK_PBES2: typeof JWK_PBES2;
|
|
131
|
+
declare const jws_JWK_Private: typeof JWK_Private;
|
|
132
|
+
declare const jws_JWK_Public: typeof JWK_Public;
|
|
133
|
+
declare const jws_JWK_RSA: typeof JWK_RSA;
|
|
134
|
+
declare const jws_JWK_RSA_ENC: typeof JWK_RSA_ENC;
|
|
135
|
+
declare const jws_JWK_RSA_PSS: typeof JWK_RSA_PSS;
|
|
136
|
+
declare const jws_JWK_RSA_Private: typeof JWK_RSA_Private;
|
|
137
|
+
declare const jws_JWK_RSA_Public: typeof JWK_RSA_Public;
|
|
138
|
+
declare const jws_JWK_RSA_SIGN: typeof JWK_RSA_SIGN;
|
|
139
|
+
declare const jws_JWK_Symmetric_Algorithm: typeof JWK_Symmetric_Algorithm;
|
|
140
|
+
declare const jws_JWK_oct: typeof JWK_oct;
|
|
101
141
|
type jws_JWSAlgorithm = JWSAlgorithm;
|
|
102
142
|
type jws_JWSHeaderParameters = JWSHeaderParameters;
|
|
103
143
|
type jws_JWSKeyLookupFunction = JWSKeyLookupFunction;
|
|
@@ -109,10 +149,14 @@ declare const jws_JWT: typeof JWT;
|
|
|
109
149
|
declare const jws_JWTClaimValidationOptions: typeof JWTClaimValidationOptions;
|
|
110
150
|
declare const jws_JWTClaims: typeof JWTClaims;
|
|
111
151
|
declare const jws_JoseHeaderParameters: typeof JoseHeaderParameters;
|
|
152
|
+
declare const jws_KeyManagementAlgorithm: typeof KeyManagementAlgorithm;
|
|
153
|
+
declare const jws_UnwrapKeyOptions: typeof UnwrapKeyOptions;
|
|
154
|
+
declare const jws_WrapKeyOptions: typeof WrapKeyOptions;
|
|
155
|
+
declare const jws_WrapKeyResult: typeof WrapKeyResult;
|
|
112
156
|
declare const jws_sign: typeof sign;
|
|
113
157
|
declare const jws_verify: typeof verify;
|
|
114
158
|
declare namespace jws {
|
|
115
|
-
export { jws_JWT as JWT, jws_JWTClaimValidationOptions as JWTClaimValidationOptions, jws_JWTClaims as JWTClaims, jws_JoseHeaderParameters as JoseHeaderParameters, jws_sign as sign, jws_verify as verify };
|
|
159
|
+
export { jws_CompositeKey as CompositeKey, jws_ContentEncryptionAlgorithm as ContentEncryptionAlgorithm, jws_DeriveKeyOptions as DeriveKeyOptions, jws_DeriveKeyReturn as DeriveKeyReturn, jws_GenerateKeyAlgorithm as GenerateKeyAlgorithm, jws_GenerateKeyOptions as GenerateKeyOptions, jws_GenerateKeyReturn as GenerateKeyReturn, jws_JWK as JWK, jws_JWKAlgorithm as JWKAlgorithm, jws_JWKPEMAlgorithm as JWKPEMAlgorithm, jws_JWKParameters as JWKParameters, jws_JWKSet as JWKSet, jws_JWK_AES_CBC_HMAC as JWK_AES_CBC_HMAC, jws_JWK_AES_GCM as JWK_AES_GCM, jws_JWK_AES_GCM_KW as JWK_AES_GCM_KW, jws_JWK_AES_KW as JWK_AES_KW, jws_JWK_Asymmetric_Algorithm as JWK_Asymmetric_Algorithm, jws_JWK_EC as JWK_EC, jws_JWK_ECDH_ES as JWK_ECDH_ES, jws_JWK_ECDSA as JWK_ECDSA, jws_JWK_EC_Private as JWK_EC_Private, jws_JWK_EC_Public as JWK_EC_Public, jws_JWK_HMAC as JWK_HMAC, jws_JWK_OKP as JWK_OKP, jws_JWK_OKP_Private as JWK_OKP_Private, jws_JWK_OKP_Public as JWK_OKP_Public, jws_JWK_OKP_SIGN as JWK_OKP_SIGN, jws_JWK_PBES2 as JWK_PBES2, jws_JWK_Private as JWK_Private, jws_JWK_Public as JWK_Public, jws_JWK_RSA as JWK_RSA, jws_JWK_RSA_ENC as JWK_RSA_ENC, jws_JWK_RSA_PSS as JWK_RSA_PSS, jws_JWK_RSA_Private as JWK_RSA_Private, jws_JWK_RSA_Public as JWK_RSA_Public, jws_JWK_RSA_SIGN as JWK_RSA_SIGN, jws_JWK_Symmetric_Algorithm as JWK_Symmetric_Algorithm, jws_JWK_oct as JWK_oct, jws_JWT as JWT, jws_JWTClaimValidationOptions as JWTClaimValidationOptions, jws_JWTClaims as JWTClaims, jws_JoseHeaderParameters as JoseHeaderParameters, jws_KeyManagementAlgorithm as KeyManagementAlgorithm, jws_UnwrapKeyOptions as UnwrapKeyOptions, jws_WrapKeyOptions as WrapKeyOptions, jws_WrapKeyResult as WrapKeyResult, jws_sign as sign, jws_verify as verify };
|
|
116
160
|
export type { jws_JWSAlgorithm as JWSAlgorithm, jws_JWSHeaderParameters as JWSHeaderParameters, jws_JWSKeyLookupFunction as JWSKeyLookupFunction, jws_JWSProtectedHeader as JWSProtectedHeader, jws_JWSSignOptions as JWSSignOptions, jws_JWSVerifyOptions as JWSVerifyOptions, jws_JWSVerifyResult as JWSVerifyResult };
|
|
117
161
|
}
|
|
118
162
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as importKey, g as getJWKFromSet } from './unjwt.
|
|
2
|
-
import { s as sanitizeObject, a as isJWK, b as applyTypCtyDefaults, c as computeJwtTimeClaims, d as base64UrlEncode, t as textEncoder, e as textDecoder, f as base64UrlDecode, g as isJWKSet, h as decodePayloadFromB64UrlSegment, v as validateCriticalHeadersJWS, j as validateJwtClaims } from './unjwt.
|
|
3
|
-
import { s as sign$1, v as verify$1 } from './unjwt.
|
|
1
|
+
import { i as importKey, g as getJWKFromSet } from './unjwt.D1MC63Yb.mjs';
|
|
2
|
+
import { s as sanitizeObject, a as isJWK, b as applyTypCtyDefaults, c as computeJwtTimeClaims, d as base64UrlEncode, t as textEncoder, e as textDecoder, f as base64UrlDecode, g as isJWKSet, h as decodePayloadFromB64UrlSegment, v as validateCriticalHeadersJWS, j as validateJwtClaims } from './unjwt.CRHfsi7v.mjs';
|
|
3
|
+
import { s as sign$1, v as verify$1 } from './unjwt.BpusjhPR.mjs';
|
|
4
4
|
|
|
5
5
|
async function sign(payload, key, options = {}) {
|
|
6
6
|
const { protectedHeader: additionalProtectedHeader } = options;
|
|
@@ -130,7 +130,7 @@ async function verify(jws, key, options = {}) {
|
|
|
130
130
|
...options.critical || [],
|
|
131
131
|
...options.requiredHeaders || []
|
|
132
132
|
]);
|
|
133
|
-
if (payload && typeof payload === "object" && (
|
|
133
|
+
if (payload && typeof payload === "object" && options.validateJWT !== false && (options.validateJWT === true || protectedHeader.typ?.toLowerCase().includes("jwt")) && !options.forceUint8Array && !(payload instanceof Uint8Array)) {
|
|
134
134
|
validateJwtClaims(payload, options);
|
|
135
135
|
}
|
|
136
136
|
return {
|
package/dist/utils.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './shared/unjwt.
|
|
2
|
-
export { s as applyTypCtyDefaults, j as assertCryptoKey, d as base64Decode, b as base64Encode, e as base64UrlDecode, c as base64UrlEncode, z as computeJwtTimeClaims, f as concatUint8Arrays, v as
|
|
1
|
+
import './shared/unjwt.OzI0aGB_.mjs';
|
|
2
|
+
export { s as applyTypCtyDefaults, j as assertCryptoKey, d as base64Decode, b as base64Encode, e as base64UrlDecode, c as base64UrlEncode, z as computeJwtTimeClaims, f as concatUint8Arrays, v as decodeMaybeJWTString, x as decodePayloadFromB64UrlSegment, w as decodePayloadFromBytes, y as getPlaintextBytes, o as isAsymmetricJWK, k as isCryptoKey, l as isCryptoKeyPair, g as isJWK, h as isJWKSet, u as isJWTContent, p as isPrivateJWK, q as isPublicJWK, n as isSymmetricJWK, m as maybeArray, r as randomBytes, D as sanitizeObject, a as textDecoder, t as textEncoder, C as validateCriticalHeadersJWE, B as validateCriticalHeadersJWS, A as validateJwtClaims } from './shared/unjwt.DUVOOOvO.mjs';
|
package/dist/utils.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { b as applyTypCtyDefaults, l as assertCryptoKey, q as base64Decode, u as base64Encode, f as base64UrlDecode, d as base64UrlEncode, c as computeJwtTimeClaims, k as concatUint8Arrays, D as
|
|
1
|
+
export { b as applyTypCtyDefaults, l as assertCryptoKey, q as base64Decode, u as base64Encode, f as base64UrlDecode, d as base64UrlEncode, c as computeJwtTimeClaims, k as concatUint8Arrays, D as decodeMaybeJWTString, h as decodePayloadFromB64UrlSegment, o as decodePayloadFromBytes, n as getPlaintextBytes, z as isAsymmetricJWK, m as isCryptoKey, x as isCryptoKeyPair, a as isJWK, g as isJWKSet, C as isJWTContent, A as isPrivateJWK, B as isPublicJWK, y as isSymmetricJWK, w as maybeArray, r as randomBytes, s as sanitizeObject, e as textDecoder, t as textEncoder, p as validateCriticalHeadersJWE, v as validateCriticalHeadersJWS, j as validateJwtClaims } from './shared/unjwt.CRHfsi7v.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unjwt",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.16",
|
|
4
4
|
"description": "Low-level JWT utilities",
|
|
5
5
|
"repository": "sandros94/unjwt",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,20 +47,21 @@
|
|
|
47
47
|
"release": "pnpm test && pnpm prepack && changelogen --release --push --publish",
|
|
48
48
|
"test": "pnpm lint && pnpm test:types && vitest run --slowTestThreshold=500",
|
|
49
49
|
"test:coverage": "pnpm lint && pnpm test:types && vitest run --coverage --slowTestThreshold=500",
|
|
50
|
-
"test:types": "tsc --noEmit --skipLibCheck"
|
|
50
|
+
"test:types": "tsc --noEmit --skipLibCheck",
|
|
51
|
+
"bench": "vitest bench --run"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
|
-
"@types/node": "^22
|
|
54
|
+
"@types/node": "^22",
|
|
54
55
|
"@vitest/coverage-v8": "^3.2.4",
|
|
55
|
-
"automd": "^0.4.
|
|
56
|
+
"automd": "^0.4.2",
|
|
56
57
|
"changelogen": "^0.6.2",
|
|
57
|
-
"eslint": "^9.
|
|
58
|
+
"eslint": "^9.36.0",
|
|
58
59
|
"eslint-config-unjs": "^0.5.0",
|
|
59
|
-
"jose": "^6.0
|
|
60
|
+
"jose": "^6.1.0",
|
|
60
61
|
"prettier": "^3.6.2",
|
|
61
62
|
"typescript": "^5.9.2",
|
|
62
63
|
"unbuild": "^3.6.1",
|
|
63
64
|
"vitest": "^3.2.4"
|
|
64
65
|
},
|
|
65
|
-
"packageManager": "pnpm@10.
|
|
66
|
+
"packageManager": "pnpm@10.17.1"
|
|
66
67
|
}
|