unjwt 0.7.0 → 0.7.1

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.
@@ -1,4 +1,4 @@
1
- import { $ as JWKAlgorithm, A as JWSSignOptions, At as JWK_RSA_Public, B as JWTClaimValidationOptions, C as JWSMultiSignOptions, Ct as JWK_Pair, D as JWSMultiVerifyOutcome, Dt as JWK_RSA_ENC, E as JWSMultiVerifyOptions, Et as JWK_RSA, Ft as KeyManagementAlgorithm, G as DeriveKeyOptions, H as JoseHeaderParameters, It as UnwrapKeyOptions, J as GenerateJWKReturn, K as DeriveKeyReturn, Lt as WrapKeyOptions, M as JWSVerifyResult, Mt as JWK_Symmetric, N as StrictOmit, Nt as JWK_Symmetric_Algorithm, O as JWSMultiVerifyResult, Ot as JWK_RSA_PSS, Pt as JWK_oct, Q as JWK, R as JOSEPayload, Rt as WrapKeyResult, S as JWSHeaderParameters, St as JWK_PBES2, T as JWSMultiVerifyAllOptions, Tt as JWK_Public, U as CompositeKey, V as JWTClaims, W as ContentEncryptionAlgorithm, X as GenerateKeyOptions, Y as GenerateKeyAlgorithm, Z as GenerateKeyReturn, _ as JWEProtectedHeader, _t as JWK_HMAC, a as JWEDecryptOptions, at as JWKSet, b as JWSGeneralSerialization, bt as JWK_OKP_Public, c as JWEFlattenedSerialization, ct as JWK_AES_GCM_KW, d as JWEHeaderParameters, dt as JWK_Asymmetric_Algorithm, et as JWKCacheAdapter, f as JWEKeyManagementHeaderParameters, ft as JWK_EC, g as JWEMultiRecipient, gt as JWK_EC_Public, h as JWEMultiEncryptOptions, ht as JWK_EC_Private, i as NotBeforeIn, it as JWKParameters, j as JWSVerifyOptions, jt as JWK_RSA_SIGN, k as JWSProtectedHeader, kt as JWK_RSA_Private, l as JWEGeneralRecipient, lt as JWK_AES_KW, m as JWEMultiDecryptResult, mt as JWK_ECDSA, n as ExpiresIn, nt as JWKLookupFunctionHeader, o as JWEDecryptResult, ot as JWK_AES_CBC_HMAC, p as JWEMultiDecryptOptions, pt as JWK_ECDH_ES, q as GenerateJWKOptions, r as MaxTokenAge, rt as JWKPEMAlgorithm, s as JWEEncryptOptions, st as JWK_AES_GCM, t as Duration, tt as JWKLookupFunction, u as JWEGeneralSerialization, ut as JWK_Asymmetric, v as JWSAlgorithm, vt as JWK_OKP, w as JWSMultiSigner, wt as JWK_Private, x as JWSGeneralSignature, xt as JWK_OKP_SIGN, y as JWSFlattenedSerialization, yt as JWK_OKP_Private, z as JWT } from "../../_chunks/index.mjs";
1
+ import { $ as DeriveKeyOptions, A as JWSMultiSigner, At as JWK_PBES2, B as JWSVerifyResult, Bt as JWK_Symmetric, C as JWSAsymmetricPrivateJWK, Ct as JWK_EC_Private, D as JWSGeneralSignature, Dt as JWK_OKP_Private, E as JWSGeneralSerialization, Et as JWK_OKP, F as JWSProtectedHeader, Ft as JWK_RSA_ENC, Gt as UnwrappingKeyFor, Ht as JWK_oct, I as JWSSignJWK, It as JWK_RSA_PSS, J as JWTClaimValidationOptions, Jt as WrappingKeyFor, K as JOSEPayload, Kt as WrapKeyOptions, L as JWSSignOptions, Lt as JWK_RSA_Private, M as JWSMultiVerifyOptions, Mt as JWK_Private, N as JWSMultiVerifyOutcome, Nt as JWK_Public, O as JWSHeaderParameters, Ot as JWK_OKP_Public, P as JWSMultiVerifyResult, Pt as JWK_RSA, Q as ContentEncryptionAlgorithm, R as JWSVerifyJWK, Rt as JWK_RSA_Public, S as JWSAlgorithm, St as JWK_ECDSA, T as JWSFlattenedSerialization, Tt as JWK_HMAC, Ut as KeyManagementAlgorithm, V as StrictOmit, Vt as JWK_Symmetric_Algorithm, Wt as UnwrapKeyOptions, X as JoseHeaderParameters, Y as JWTClaims, Z as CompositeKey, _ as JWEMultiDecryptOptions, _t as JWK_AES_KW, a as JWEAsymmetricPrivateJWK, at as GenerateKeyReturn, b as JWEMultiRecipient, bt as JWK_EC, c as JWEDecryptOptions, ct as JWKCacheAdapter, d as JWEEncryptOptions, dt as JWKPEMAlgorithm, et as DeriveKeyReturn, f as JWEFlattenedSerialization, ft as JWKParameters, g as JWEKeyManagementHeaderParameters, gt as JWK_AES_GCM_KW, h as JWEHeaderParameters, ht as JWK_AES_GCM, i as NotBeforeIn, it as GenerateKeyOptions, j as JWSMultiVerifyAllOptions, jt as JWK_Pair, k as JWSMultiSignOptions, kt as JWK_OKP_SIGN, l as JWEDecryptResult, lt as JWKLookupFunction, m as JWEGeneralSerialization, mt as JWK_AES_CBC_HMAC, n as ExpiresIn, nt as GenerateJWKReturn, o as JWEAsymmetricPublicJWK, ot as JWK, p as JWEGeneralRecipient, pt as JWKSet, q as JWT, qt as WrapKeyResult, r as MaxTokenAge, rt as GenerateKeyAlgorithm, s as JWEDecryptJWK, st as JWKAlgorithm, t as Duration, tt as GenerateJWKOptions, u as JWEEncryptJWK, ut as JWKLookupFunctionHeader, v as JWEMultiDecryptResult, vt as JWK_Asymmetric, w as JWSAsymmetricPublicJWK, wt as JWK_EC_Public, x as JWEProtectedHeader, xt as JWK_ECDH_ES, y as JWEMultiEncryptOptions, yt as JWK_Asymmetric_Algorithm, z as JWSVerifyOptions, zt as JWK_RSA_SIGN } from "../../_chunks/index.mjs";
2
2
  import { deriveJWKFromPassword, exportPEM, exportToPEM, generateJWK, importFromPEM, importPEM } from "../../core/jwk.mjs";
3
3
  import { H3Event, HTTPEvent } from "h3";
4
4
  import { CookieSerializeOptions } from "cookie-es";
@@ -73,13 +73,13 @@ interface SessionHooksJWE<T extends Record<string, any> = SessionClaims, MaxAge
73
73
  header: JWEHeaderParameters;
74
74
  event: TEvent;
75
75
  config: SessionConfigJWE<T, MaxAge, TEvent>;
76
- }) => JWK_Symmetric | JWK_Private | Promise<JWK_Symmetric | JWK_Private>;
76
+ }) => JWEDecryptJWK | Promise<JWEDecryptJWK>;
77
77
  }
78
78
  interface SessionConfigJWE<T extends Record<string, any> = SessionClaims, MaxAge extends ExpiresIn | undefined = ExpiresIn | undefined, TEvent extends HTTPEvent | H3Event = HTTPEvent | H3Event> {
79
79
  /** Shared secret used, string for PBES2 or Json Web Key (JWK) */
80
- key: string | JWK_Symmetric | {
81
- privateKey: JWK_Private | JWK_Symmetric;
82
- publicKey?: JWK_Public;
80
+ key: string | JWEEncryptJWK | {
81
+ privateKey: JWEAsymmetricPrivateJWK;
82
+ publicKey?: JWEAsymmetricPublicJWK;
83
83
  };
84
84
  /** Session lifetime in seconds (used to derive exp from iat) */
85
85
  maxAge?: MaxAge;
@@ -184,12 +184,12 @@ interface SessionHooksJWS<T extends Record<string, any> = SessionClaims, MaxAge
184
184
  header: JWKLookupFunctionHeader;
185
185
  event: TEvent;
186
186
  config: SessionConfigJWS<T, MaxAge, TEvent>;
187
- }) => JWKSet | JWK_Symmetric | JWK_Public | Promise<JWKSet | JWK_Symmetric | JWK_Public>;
187
+ }) => JWKSet | JWSVerifyJWK | Promise<JWKSet | JWSVerifyJWK>;
188
188
  }
189
189
  interface SessionConfigJWS<T extends Record<string, any> = SessionClaims, MaxAge extends ExpiresIn | undefined = ExpiresIn | undefined, TEvent extends HTTPEvent = HTTPEvent> {
190
- key: JWK_Symmetric | {
191
- privateKey: JWK_Private;
192
- publicKey: JWK_Public | JWK_Public[] | JWKSet;
190
+ key: JWK_oct<JWK_HMAC> | {
191
+ privateKey: JWSAsymmetricPrivateJWK;
192
+ publicKey: JWSAsymmetricPublicJWK | JWSAsymmetricPublicJWK[] | JWKSet;
193
193
  };
194
194
  maxAge?: MaxAge;
195
195
  name?: string;
@@ -210,4 +210,4 @@ declare function updateJWSSession<T extends Record<string, any> = SessionClaims,
210
210
  declare function signJWSSession<T extends Record<string, any> = SessionClaims, MaxAge extends ExpiresIn | undefined = ExpiresIn | undefined, TEvent extends HTTPEvent = HTTPEvent>(event: TEvent, config: SessionConfigJWS<T, MaxAge, TEvent>): Promise<string>;
211
211
  declare function verifyJWSSession<T extends Record<string, any> = SessionClaims, MaxAge extends ExpiresIn | undefined = ExpiresIn | undefined, TEvent extends HTTPEvent = HTTPEvent>(event: TEvent, config: SessionConfigJWS<T, MaxAge, TEvent>, token: string): Promise<Partial<SessionJWS<T, MaxAge>>>;
212
212
  declare function clearJWSSession<T extends Record<string, any> = SessionClaims, MaxAge extends ExpiresIn | undefined = ExpiresIn | undefined, TEvent extends HTTPEvent = HTTPEvent>(event: TEvent, config: SessionConfigJWS<T, MaxAge, TEvent>): Promise<void>;
213
- export { CompositeKey, ContentEncryptionAlgorithm, DeriveKeyOptions, DeriveKeyReturn, Duration, ExpiresIn, GenerateJWKOptions, GenerateJWKReturn, GenerateKeyAlgorithm, GenerateKeyOptions, GenerateKeyReturn, JOSEPayload, JWEDecryptOptions, JWEDecryptResult, JWEEncryptOptions, JWEFlattenedSerialization, JWEGeneralRecipient, JWEGeneralSerialization, JWEHeaderParameters, JWEKeyManagementHeaderParameters, JWEMultiDecryptOptions, JWEMultiDecryptResult, JWEMultiEncryptOptions, JWEMultiRecipient, JWEProtectedHeader, JWK, JWKAlgorithm, JWKCacheAdapter, JWKLookupFunction, JWKLookupFunctionHeader, JWKPEMAlgorithm, JWKParameters, JWKSet, JWK_AES_CBC_HMAC, JWK_AES_GCM, JWK_AES_GCM_KW, JWK_AES_KW, JWK_Asymmetric, JWK_Asymmetric_Algorithm, JWK_EC, JWK_ECDH_ES, JWK_ECDSA, JWK_EC_Private, JWK_EC_Public, JWK_HMAC, JWK_OKP, JWK_OKP_Private, JWK_OKP_Public, JWK_OKP_SIGN, JWK_PBES2, JWK_Pair, JWK_Private, JWK_Public, JWK_RSA, JWK_RSA_ENC, JWK_RSA_PSS, JWK_RSA_Private, JWK_RSA_Public, JWK_RSA_SIGN, JWK_Symmetric, JWK_Symmetric_Algorithm, JWK_oct, JWSAlgorithm, JWSFlattenedSerialization, JWSGeneralSerialization, JWSGeneralSignature, JWSHeaderParameters, JWSMultiSignOptions, JWSMultiSigner, JWSMultiVerifyAllOptions, JWSMultiVerifyOptions, JWSMultiVerifyOutcome, JWSMultiVerifyResult, JWSProtectedHeader, JWSSignOptions, JWSVerifyOptions, JWSVerifyResult, JWT, JWTClaimValidationOptions, JWTClaims, JoseHeaderParameters, KeyManagementAlgorithm, MaxTokenAge, NotBeforeIn, type SessionClaims, type SessionConfigJWE, type SessionConfigJWS, type SessionData, type SessionHooksJWE, type SessionHooksJWS, type SessionJWE, type SessionJWS, type SessionManager, type SessionUpdate, UnwrapKeyOptions, WrapKeyOptions, WrapKeyResult, clearJWESession, clearJWSSession, deriveJWKFromPassword, exportPEM, exportToPEM, generateJWK, getJWESession, getJWESessionToken, getJWSSession, importFromPEM, importPEM, sealJWESession, signJWSSession, unsealJWESession, updateJWESession, updateJWSSession, useJWESession, useJWSSession, verifyJWSSession };
213
+ export { CompositeKey, ContentEncryptionAlgorithm, DeriveKeyOptions, DeriveKeyReturn, Duration, ExpiresIn, GenerateJWKOptions, GenerateJWKReturn, GenerateKeyAlgorithm, GenerateKeyOptions, GenerateKeyReturn, JOSEPayload, JWEAsymmetricPrivateJWK, JWEAsymmetricPublicJWK, JWEDecryptJWK, JWEDecryptOptions, JWEDecryptResult, JWEEncryptJWK, JWEEncryptOptions, JWEFlattenedSerialization, JWEGeneralRecipient, JWEGeneralSerialization, JWEHeaderParameters, JWEKeyManagementHeaderParameters, JWEMultiDecryptOptions, JWEMultiDecryptResult, JWEMultiEncryptOptions, JWEMultiRecipient, JWEProtectedHeader, JWK, JWKAlgorithm, JWKCacheAdapter, JWKLookupFunction, JWKLookupFunctionHeader, JWKPEMAlgorithm, JWKParameters, JWKSet, JWK_AES_CBC_HMAC, JWK_AES_GCM, JWK_AES_GCM_KW, JWK_AES_KW, JWK_Asymmetric, JWK_Asymmetric_Algorithm, JWK_EC, JWK_ECDH_ES, JWK_ECDSA, JWK_EC_Private, JWK_EC_Public, JWK_HMAC, JWK_OKP, JWK_OKP_Private, JWK_OKP_Public, JWK_OKP_SIGN, JWK_PBES2, JWK_Pair, JWK_Private, JWK_Public, JWK_RSA, JWK_RSA_ENC, JWK_RSA_PSS, JWK_RSA_Private, JWK_RSA_Public, JWK_RSA_SIGN, JWK_Symmetric, JWK_Symmetric_Algorithm, JWK_oct, JWSAlgorithm, JWSAsymmetricPrivateJWK, JWSAsymmetricPublicJWK, JWSFlattenedSerialization, JWSGeneralSerialization, JWSGeneralSignature, JWSHeaderParameters, JWSMultiSignOptions, JWSMultiSigner, JWSMultiVerifyAllOptions, JWSMultiVerifyOptions, JWSMultiVerifyOutcome, JWSMultiVerifyResult, JWSProtectedHeader, JWSSignJWK, JWSSignOptions, JWSVerifyJWK, JWSVerifyOptions, JWSVerifyResult, JWT, JWTClaimValidationOptions, JWTClaims, JoseHeaderParameters, KeyManagementAlgorithm, MaxTokenAge, NotBeforeIn, type SessionClaims, type SessionConfigJWE, type SessionConfigJWS, type SessionData, type SessionHooksJWE, type SessionHooksJWS, type SessionJWE, type SessionJWS, type SessionManager, type SessionUpdate, UnwrapKeyOptions, UnwrappingKeyFor, WrapKeyOptions, WrapKeyResult, WrappingKeyFor, clearJWESession, clearJWSSession, deriveJWKFromPassword, exportPEM, exportToPEM, generateJWK, getJWESession, getJWESessionToken, getJWSSession, importFromPEM, importPEM, sealJWESession, signJWSSession, unsealJWESession, updateJWESession, updateJWSSession, useJWESession, useJWSSession, verifyJWSSession };
@@ -2,8 +2,8 @@ import { D as JWTError, O as isJWTError, c as isPrivateJWK, l as isPublicJWK, p
2
2
  import { c as exportPEM, g as importPEM, i as deriveJWKFromPassword, l as exportToPEM, m as importFromPEM, u as generateJWK } from "../../_chunks/jwk.mjs";
3
3
  import { n as verify, t as sign } from "../../_chunks/jws.mjs";
4
4
  import { n as encrypt, t as decrypt } from "../../_chunks/jwe.mjs";
5
- import { t as NullProtoObj } from "../../_chunks/libs/rou3.mjs";
6
5
  import { getChunkedCookie, getEventContext, setChunkedCookie } from "h3";
6
+ import { NullProtoObj } from "rou3";
7
7
  const kGetSessionPromise$1 = Symbol("h3_jwe_getSession");
8
8
  const DEFAULT_NAME$1 = "h3-jwe";
9
9
  const DEFAULT_COOKIE$1 = {
@@ -298,8 +298,8 @@ function getEncryptKey(key) {
298
298
  if (!key) throw new Error("Session: JWE key is required.");
299
299
  let _key;
300
300
  if (typeof key === "string") _key = key;
301
- else if (isSymmetricJWK(key) || isPrivateJWK(key)) _key = key;
302
- else if ("publicKey" in key && isPublicJWK(key.publicKey)) _key = key.publicKey;
301
+ else if (isSymmetricJWK(key)) _key = key;
302
+ else if ("publicKey" in key && key.publicKey && isPublicJWK(key.publicKey)) _key = key.publicKey;
303
303
  else if ("privateKey" in key && isPrivateJWK(key.privateKey)) _key = key.privateKey;
304
304
  if (!_key) throw new Error("Session: Invalid JWE key. It must be a password string or valid JWK.", { cause: key });
305
305
  return _key;
@@ -1,3 +1,3 @@
1
- import { F as JWTErrorCauseMap, I as JWTErrorCode, L as isJWTError, P as JWTError, _ as JWEProtectedHeader, a as JWEDecryptOptions, c as JWEFlattenedSerialization, d as JWEHeaderParameters, f as JWEKeyManagementHeaderParameters, g as JWEMultiRecipient, h as JWEMultiEncryptOptions, l as JWEGeneralRecipient, m as JWEMultiDecryptResult, o as JWEDecryptResult, p as JWEMultiDecryptOptions, s as JWEEncryptOptions, u as JWEGeneralSerialization } from "../_chunks/index.mjs";
1
+ import { G as isJWTError, H as JWTError, U as JWTErrorCauseMap, W as JWTErrorCode, _ as JWEMultiDecryptOptions, a as JWEAsymmetricPrivateJWK, b as JWEMultiRecipient, c as JWEDecryptOptions, d as JWEEncryptOptions, f as JWEFlattenedSerialization, g as JWEKeyManagementHeaderParameters, h as JWEHeaderParameters, l as JWEDecryptResult, m as JWEGeneralSerialization, o as JWEAsymmetricPublicJWK, p as JWEGeneralRecipient, s as JWEDecryptJWK, u as JWEEncryptJWK, v as JWEMultiDecryptResult, x as JWEProtectedHeader, y as JWEMultiEncryptOptions } from "../_chunks/index.mjs";
2
2
  import { a as generalToFlattened, i as encryptMulti, n as encrypt, r as decryptMulti, t as decrypt } from "../_chunks/jwe.mjs";
3
- export { JWEDecryptOptions, JWEDecryptResult, JWEEncryptOptions, JWEFlattenedSerialization, JWEGeneralRecipient, JWEGeneralSerialization, JWEHeaderParameters, JWEKeyManagementHeaderParameters, JWEMultiDecryptOptions, JWEMultiDecryptResult, JWEMultiEncryptOptions, JWEMultiRecipient, JWEProtectedHeader, JWTError, JWTErrorCauseMap, JWTErrorCode, decrypt, decryptMulti, encrypt, encryptMulti, generalToFlattened, isJWTError };
3
+ export { JWEAsymmetricPrivateJWK, JWEAsymmetricPublicJWK, JWEDecryptJWK, JWEDecryptOptions, JWEDecryptResult, JWEEncryptJWK, JWEEncryptOptions, JWEFlattenedSerialization, JWEGeneralRecipient, JWEGeneralSerialization, JWEHeaderParameters, JWEKeyManagementHeaderParameters, JWEMultiDecryptOptions, JWEMultiDecryptResult, JWEMultiEncryptOptions, JWEMultiRecipient, JWEProtectedHeader, JWTError, JWTErrorCauseMap, JWTErrorCode, decrypt, decryptMulti, encrypt, encryptMulti, generalToFlattened, isJWTError };
@@ -1,4 +1,4 @@
1
- import { $ as JWKAlgorithm, At as JWK_RSA_Public, Ct as JWK_Pair, Dt as JWK_RSA_ENC, Et as JWK_RSA, F as JWTErrorCauseMap, Ft as KeyManagementAlgorithm, G as DeriveKeyOptions, H as JoseHeaderParameters, I as JWTErrorCode, It as UnwrapKeyOptions, J as GenerateJWKReturn, K as DeriveKeyReturn, L as isJWTError, Lt as WrapKeyOptions, Mt as JWK_Symmetric, Nt as JWK_Symmetric_Algorithm, Ot as JWK_RSA_PSS, P as JWTError, Pt as JWK_oct, Q as JWK, Rt as WrapKeyResult, St as JWK_PBES2, Tt as JWK_Public, U as CompositeKey, W as ContentEncryptionAlgorithm, X as GenerateKeyOptions, Y as GenerateKeyAlgorithm, Z as GenerateKeyReturn, _t as JWK_HMAC, at as JWKSet, bt as JWK_OKP_Public, ct as JWK_AES_GCM_KW, dt as JWK_Asymmetric_Algorithm, et as JWKCacheAdapter, ft as JWK_EC, gt as JWK_EC_Public, ht as JWK_EC_Private, it as JWKParameters, jt as JWK_RSA_SIGN, kt as JWK_RSA_Private, lt as JWK_AES_KW, mt as JWK_ECDSA, nt as JWKLookupFunctionHeader, ot as JWK_AES_CBC_HMAC, pt as JWK_ECDH_ES, q as GenerateJWKOptions, rt as JWKPEMAlgorithm, st as JWK_AES_GCM, tt as JWKLookupFunction, ut as JWK_Asymmetric, vt as JWK_OKP, wt as JWK_Private, xt as JWK_OKP_SIGN, yt as JWK_OKP_Private } from "../_chunks/index.mjs";
1
+ import { $ as DeriveKeyOptions, At as JWK_PBES2, Bt as JWK_Symmetric, Ct as JWK_EC_Private, Dt as JWK_OKP_Private, Et as JWK_OKP, Ft as JWK_RSA_ENC, G as isJWTError, Gt as UnwrappingKeyFor, H as JWTError, Ht as JWK_oct, It as JWK_RSA_PSS, Jt as WrappingKeyFor, Kt as WrapKeyOptions, Lt as JWK_RSA_Private, Mt as JWK_Private, Nt as JWK_Public, Ot as JWK_OKP_Public, Pt as JWK_RSA, Q as ContentEncryptionAlgorithm, Rt as JWK_RSA_Public, St as JWK_ECDSA, Tt as JWK_HMAC, U as JWTErrorCauseMap, Ut as KeyManagementAlgorithm, Vt as JWK_Symmetric_Algorithm, W as JWTErrorCode, Wt as UnwrapKeyOptions, X as JoseHeaderParameters, Z as CompositeKey, _t as JWK_AES_KW, at as GenerateKeyReturn, bt as JWK_EC, ct as JWKCacheAdapter, dt as JWKPEMAlgorithm, et as DeriveKeyReturn, ft as JWKParameters, gt as JWK_AES_GCM_KW, ht as JWK_AES_GCM, it as GenerateKeyOptions, jt as JWK_Pair, kt as JWK_OKP_SIGN, lt as JWKLookupFunction, mt as JWK_AES_CBC_HMAC, nt as GenerateJWKReturn, ot as JWK, pt as JWKSet, qt as WrapKeyResult, rt as GenerateKeyAlgorithm, st as JWKAlgorithm, tt as GenerateJWKOptions, ut as JWKLookupFunctionHeader, vt as JWK_Asymmetric, wt as JWK_EC_Public, xt as JWK_ECDH_ES, yt as JWK_Asymmetric_Algorithm, zt as JWK_RSA_SIGN } from "../_chunks/index.mjs";
2
2
  /**
3
3
  * Generates a cryptographic key for the specified JWA algorithm.
4
4
  *
@@ -213,7 +213,7 @@ declare function exportKey<T extends JWK>(key: CryptoKey, jwkParams?: Omit<JWKPa
213
213
  * @param options Additional options required by certain algorithms (e.g., p2s, p2c for PBES2).
214
214
  * @returns A Promise resolving to an alg-specific {@link WrapKeyResult}.
215
215
  */
216
- declare function wrapKey<TAlg extends KeyManagementAlgorithm>(alg: TAlg, keyToWrap: CryptoKey | Uint8Array<ArrayBuffer>, wrappingKey: CryptoKey | JWK | string | Uint8Array<ArrayBuffer>, options?: WrapKeyOptions): Promise<WrapKeyResult<TAlg>>;
216
+ declare function wrapKey<TAlg extends KeyManagementAlgorithm>(alg: TAlg, keyToWrap: CryptoKey | Uint8Array<ArrayBuffer>, wrappingKey: WrappingKeyFor<TAlg>, options?: WrapKeyOptions): Promise<WrapKeyResult<TAlg>>;
217
217
  /**
218
218
  * Unwraps a Content Encryption Key (CEK) using the specified algorithm and unwrapping key.
219
219
  *
@@ -223,13 +223,13 @@ declare function wrapKey<TAlg extends KeyManagementAlgorithm>(alg: TAlg, keyToWr
223
223
  * @param options Additional options required by certain algorithms (e.g., iv, tag, p2s, p2c, epk).
224
224
  * @returns A Promise resolving to the unwrapped key (CEK) as a CryptoKey or Uint8Array.
225
225
  */
226
- declare function unwrapKey(alg: KeyManagementAlgorithm, wrappedKey: Uint8Array<ArrayBuffer>, unwrappingKey: CryptoKey | JWK | string | Uint8Array<ArrayBuffer>, options: UnwrapKeyOptions & {
226
+ declare function unwrapKey<TAlg extends KeyManagementAlgorithm>(alg: TAlg, wrappedKey: Uint8Array<ArrayBuffer>, unwrappingKey: UnwrappingKeyFor<TAlg>, options: UnwrapKeyOptions & {
227
227
  format: "raw";
228
228
  }): Promise<Uint8Array<ArrayBuffer>>;
229
- declare function unwrapKey(alg: KeyManagementAlgorithm, wrappedKey: Uint8Array<ArrayBuffer>, unwrappingKey: CryptoKey | JWK | string | Uint8Array<ArrayBuffer>, options?: UnwrapKeyOptions & {
229
+ declare function unwrapKey<TAlg extends KeyManagementAlgorithm>(alg: TAlg, wrappedKey: Uint8Array<ArrayBuffer>, unwrappingKey: UnwrappingKeyFor<TAlg>, options?: UnwrapKeyOptions & {
230
230
  format?: "cryptokey";
231
231
  }): Promise<CryptoKey>;
232
- declare function unwrapKey(alg: KeyManagementAlgorithm, wrappedKey: Uint8Array<ArrayBuffer>, unwrappingKey: CryptoKey | JWK | string | Uint8Array<ArrayBuffer>, options: UnwrapKeyOptions): Promise<CryptoKey | Uint8Array<ArrayBuffer>>;
232
+ declare function unwrapKey<TAlg extends KeyManagementAlgorithm>(alg: TAlg, wrappedKey: Uint8Array<ArrayBuffer>, unwrappingKey: UnwrappingKeyFor<TAlg>, options: UnwrapKeyOptions): Promise<CryptoKey | Uint8Array<ArrayBuffer>>;
233
233
  /**
234
234
  * Imports a PEM-encoded key and returns it as a JWK.
235
235
  *
@@ -384,4 +384,4 @@ declare function getJWKFromSet(jwkSet: JWKSet, kidOrProtectedHeader: string | (J
384
384
  * @returns An array of matching JWKs.
385
385
  */
386
386
  declare function getJWKsFromSet(jwkSet: JWKSet, filter?: (jwk: JWK) => boolean): JWK[];
387
- export { CompositeKey, ContentEncryptionAlgorithm, DeriveKeyOptions, DeriveKeyReturn, GenerateJWKOptions, GenerateJWKReturn, GenerateKeyAlgorithm, GenerateKeyOptions, GenerateKeyReturn, JWK, JWKAlgorithm, JWKCacheAdapter, JWKLookupFunction, JWKLookupFunctionHeader, JWKPEMAlgorithm, JWKParameters, JWKSet, JWK_AES_CBC_HMAC, JWK_AES_GCM, JWK_AES_GCM_KW, JWK_AES_KW, JWK_Asymmetric, JWK_Asymmetric_Algorithm, JWK_EC, JWK_ECDH_ES, JWK_ECDSA, JWK_EC_Private, JWK_EC_Public, JWK_HMAC, JWK_OKP, JWK_OKP_Private, JWK_OKP_Public, JWK_OKP_SIGN, JWK_PBES2, JWK_Pair, JWK_Private, JWK_Public, JWK_RSA, JWK_RSA_ENC, JWK_RSA_PSS, JWK_RSA_Private, JWK_RSA_Public, JWK_RSA_SIGN, JWK_Symmetric, JWK_Symmetric_Algorithm, JWK_oct, JWTError, type JWTErrorCauseMap, type JWTErrorCode, KeyManagementAlgorithm, UnwrapKeyOptions, WeakMapJWKCache, WrapKeyOptions, WrapKeyResult, clearJWKCache, configureJWKCache, deriveJWKFromPassword, deriveKeyFromPassword, deriveSharedSecret, exportKey, exportPEM, exportToPEM, generateJWK, generateKey, getJWKFromSet, getJWKsFromSet, importFromPEM, importKey, importPEM, isJWTError, unwrapKey, wrapKey };
387
+ export { CompositeKey, ContentEncryptionAlgorithm, DeriveKeyOptions, DeriveKeyReturn, GenerateJWKOptions, GenerateJWKReturn, GenerateKeyAlgorithm, GenerateKeyOptions, GenerateKeyReturn, JWK, JWKAlgorithm, JWKCacheAdapter, JWKLookupFunction, JWKLookupFunctionHeader, JWKPEMAlgorithm, JWKParameters, JWKSet, JWK_AES_CBC_HMAC, JWK_AES_GCM, JWK_AES_GCM_KW, JWK_AES_KW, JWK_Asymmetric, JWK_Asymmetric_Algorithm, JWK_EC, JWK_ECDH_ES, JWK_ECDSA, JWK_EC_Private, JWK_EC_Public, JWK_HMAC, JWK_OKP, JWK_OKP_Private, JWK_OKP_Public, JWK_OKP_SIGN, JWK_PBES2, JWK_Pair, JWK_Private, JWK_Public, JWK_RSA, JWK_RSA_ENC, JWK_RSA_PSS, JWK_RSA_Private, JWK_RSA_Public, JWK_RSA_SIGN, JWK_Symmetric, JWK_Symmetric_Algorithm, JWK_oct, JWTError, type JWTErrorCauseMap, type JWTErrorCode, KeyManagementAlgorithm, UnwrapKeyOptions, UnwrappingKeyFor, WeakMapJWKCache, WrapKeyOptions, WrapKeyResult, WrappingKeyFor, clearJWKCache, configureJWKCache, deriveJWKFromPassword, deriveKeyFromPassword, deriveSharedSecret, exportKey, exportPEM, exportToPEM, generateJWK, generateKey, getJWKFromSet, getJWKsFromSet, importFromPEM, importKey, importPEM, isJWTError, unwrapKey, wrapKey };
@@ -1,3 +1,3 @@
1
- import { A as JWSSignOptions, C as JWSMultiSignOptions, D as JWSMultiVerifyOutcome, E as JWSMultiVerifyOptions, F as JWTErrorCauseMap, I as JWTErrorCode, L as isJWTError, M as JWSVerifyResult, O as JWSMultiVerifyResult, P as JWTError, S as JWSHeaderParameters, T as JWSMultiVerifyAllOptions, b as JWSGeneralSerialization, j as JWSVerifyOptions, k as JWSProtectedHeader, v as JWSAlgorithm, w as JWSMultiSigner, x as JWSGeneralSignature, y as JWSFlattenedSerialization } from "../_chunks/index.mjs";
1
+ import { A as JWSMultiSigner, B as JWSVerifyResult, C as JWSAsymmetricPrivateJWK, D as JWSGeneralSignature, E as JWSGeneralSerialization, F as JWSProtectedHeader, G as isJWTError, H as JWTError, I as JWSSignJWK, L as JWSSignOptions, M as JWSMultiVerifyOptions, N as JWSMultiVerifyOutcome, O as JWSHeaderParameters, P as JWSMultiVerifyResult, R as JWSVerifyJWK, S as JWSAlgorithm, T as JWSFlattenedSerialization, U as JWTErrorCauseMap, W as JWTErrorCode, j as JWSMultiVerifyAllOptions, k as JWSMultiSignOptions, w as JWSAsymmetricPublicJWK, z as JWSVerifyOptions } from "../_chunks/index.mjs";
2
2
  import { a as verifyMulti, i as signMulti, n as verify, o as verifyMultiAll, r as generalToFlattenedJWS, t as sign } from "../_chunks/jws.mjs";
3
- export { JWSAlgorithm, JWSFlattenedSerialization, JWSGeneralSerialization, JWSGeneralSignature, JWSHeaderParameters, JWSMultiSignOptions, JWSMultiSigner, JWSMultiVerifyAllOptions, JWSMultiVerifyOptions, JWSMultiVerifyOutcome, JWSMultiVerifyResult, JWSProtectedHeader, JWSSignOptions, JWSVerifyOptions, JWSVerifyResult, JWTError, JWTErrorCauseMap, JWTErrorCode, generalToFlattenedJWS, isJWTError, sign, signMulti, verify, verifyMulti, verifyMultiAll };
3
+ export { JWSAlgorithm, JWSAsymmetricPrivateJWK, JWSAsymmetricPublicJWK, JWSFlattenedSerialization, JWSGeneralSerialization, JWSGeneralSignature, JWSHeaderParameters, JWSMultiSignOptions, JWSMultiSigner, JWSMultiVerifyAllOptions, JWSMultiVerifyOptions, JWSMultiVerifyOutcome, JWSMultiVerifyResult, JWSProtectedHeader, JWSSignJWK, JWSSignOptions, JWSVerifyJWK, JWSVerifyOptions, JWSVerifyResult, JWTError, JWTErrorCauseMap, JWTErrorCode, generalToFlattenedJWS, isJWTError, sign, signMulti, verify, verifyMulti, verifyMultiAll };
@@ -1,4 +1,4 @@
1
- import { B as JWTClaimValidationOptions, Ft as KeyManagementAlgorithm, N as StrictOmit, Pt as JWK_oct, Q as JWK, Tt as JWK_Public, V as JWTClaims, at as JWKSet, n as ExpiresIn, t as Duration, v as JWSAlgorithm, wt as JWK_Private } from "../../_chunks/index.mjs";
1
+ import { Ct as JWK_EC_Private, Dt as JWK_OKP_Private, Ht as JWK_oct, J as JWTClaimValidationOptions, Lt as JWK_RSA_Private, Mt as JWK_Private, Nt as JWK_Public, Ot as JWK_OKP_Public, Rt as JWK_RSA_Public, S as JWSAlgorithm, Ut as KeyManagementAlgorithm, V as StrictOmit, Y as JWTClaims, n as ExpiresIn, ot as JWK, pt as JWKSet, t as Duration, wt as JWK_EC_Public } from "../../_chunks/index.mjs";
2
2
  import { a as textDecoder, c as sanitizeObject, i as base64UrlEncode, l as sanitizeObjectCopy, n as base64Encode, o as textEncoder, r as base64UrlDecode, s as safeJsonParse, t as base64Decode, u as secureRandomBytes } from "../../_chunks/libs/unsecure.mjs";
3
3
  /**
4
4
  * Infer the set of JWS signing algorithms a key unambiguously supports.
@@ -106,18 +106,37 @@ declare function assertCryptoKey(key: unknown): asserts key is CryptoKey;
106
106
  declare function isCryptoKey(key: unknown): key is CryptoKey;
107
107
  /** Type guard for `CryptoKeyPair` — both `publicKey` and `privateKey` must be CryptoKeys. */
108
108
  declare const isCryptoKeyPair: (key: any) => key is CryptoKeyPair;
109
- /** Returns true if the JWK is a symmetric (oct) key. */
110
- declare function isSymmetricJWK(key: unknown): key is Extract<JWK, JWK_oct>;
111
- /** Returns true if the JWK is an asymmetric (RSA, EC, OKP) key. */
109
+ /**
110
+ * Returns true if the JWK is a symmetric (oct) key.
111
+ *
112
+ * The `T` inference preserves the caller's narrowed alg type — passing a
113
+ * `JWK_oct<"HS256">` refines to `JWK_oct<"HS256">`, not `JWK_oct<string>`.
114
+ */
115
+ declare function isSymmetricJWK<T>(key: T): key is Extract<T, JWK_oct>;
116
+ declare function isSymmetricJWK(key: unknown): key is JWK_oct;
117
+ /**
118
+ * Returns true if the JWK is an asymmetric (RSA, EC, OKP) key.
119
+ *
120
+ * The `T` inference preserves the caller's narrowed alg type — passing a
121
+ * `JWK_EC<"ES256">` refines to `JWK_EC<"ES256">`, not `JWK_EC<string>`,
122
+ * and so on for RSA and OKP.
123
+ */
124
+ declare function isAsymmetricJWK<T>(key: T): key is Exclude<T, JWK_oct>;
112
125
  declare function isAsymmetricJWK(key: unknown): key is Exclude<JWK, JWK_oct>;
113
126
  /**
114
127
  * Type guard that checks if the provided JWK contains private key material.
115
128
  * It relies purely on the presence of private components (e.g. "d"), not on the alg value.
129
+ *
130
+ * Preserves narrow alg types from the caller.
116
131
  */
132
+ declare function isPrivateJWK<T>(key: T): key is Extract<T, JWK_EC_Private | JWK_OKP_Private | JWK_RSA_Private>;
117
133
  declare function isPrivateJWK(key: unknown): key is JWK_Private;
118
134
  /**
119
135
  * Type guard that checks if the provided JWK is a public (asymmetric) key.
120
136
  * This checks for the presence of public components and absence of private material.
137
+ *
138
+ * Preserves narrow alg types from the caller.
121
139
  */
140
+ declare function isPublicJWK<T>(key: T): key is Exclude<Extract<T, JWK_EC_Public | JWK_OKP_Public | JWK_RSA_Public>, JWK_Private>;
122
141
  declare function isPublicJWK(key: unknown): key is JWK_Public;
123
142
  export { ComputeJwtTimeClaimsOptions, StrictOmit, applyTypCtyDefaults, assertCryptoKey, base64Decode, base64Encode, base64UrlDecode, base64UrlEncode, computeDurationInSeconds, computeExpiresInSeconds, computeJwtTimeClaims, computeMaxTokenAgeSeconds, concatUint8Arrays, decodeMaybeJWTString, decodePayloadFromB64UrlSegment, decodePayloadFromBytes, getPlaintextBytes, inferJWEAllowedAlgorithms, inferJWSAllowedAlgorithms, isAsymmetricJWK, isCryptoKey, isCryptoKeyPair, isJWK, isJWKSet, isJWTContent, isPrivateJWK, isPublicJWK, isSymmetricJWK, maybeArray, safeJsonParse, sanitizeObject, sanitizeObjectCopy, secureRandomBytes, textDecoder, textEncoder, validateCriticalHeadersJWE, validateCriticalHeadersJWS, validateJwtClaims };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as JWKAlgorithm, A as JWSSignOptions, At as JWK_RSA_Public, B as JWTClaimValidationOptions, C as JWSMultiSignOptions, Ct as JWK_Pair, D as JWSMultiVerifyOutcome, Dt as JWK_RSA_ENC, E as JWSMultiVerifyOptions, Et as JWK_RSA, F as JWTErrorCauseMap, Ft as KeyManagementAlgorithm, G as DeriveKeyOptions, H as JoseHeaderParameters, I as JWTErrorCode, It as UnwrapKeyOptions, J as GenerateJWKReturn, K as DeriveKeyReturn, L as isJWTError, Lt as WrapKeyOptions, M as JWSVerifyResult, Mt as JWK_Symmetric, Nt as JWK_Symmetric_Algorithm, O as JWSMultiVerifyResult, Ot as JWK_RSA_PSS, P as JWTError, Pt as JWK_oct, Q as JWK, R as JOSEPayload, Rt as WrapKeyResult, S as JWSHeaderParameters, St as JWK_PBES2, T as JWSMultiVerifyAllOptions, Tt as JWK_Public, U as CompositeKey, V as JWTClaims, W as ContentEncryptionAlgorithm, X as GenerateKeyOptions, Y as GenerateKeyAlgorithm, Z as GenerateKeyReturn, _ as JWEProtectedHeader, _t as JWK_HMAC, a as JWEDecryptOptions, at as JWKSet, b as JWSGeneralSerialization, bt as JWK_OKP_Public, c as JWEFlattenedSerialization, ct as JWK_AES_GCM_KW, d as JWEHeaderParameters, dt as JWK_Asymmetric_Algorithm, et as JWKCacheAdapter, f as JWEKeyManagementHeaderParameters, ft as JWK_EC, g as JWEMultiRecipient, gt as JWK_EC_Public, h as JWEMultiEncryptOptions, ht as JWK_EC_Private, i as NotBeforeIn, it as JWKParameters, j as JWSVerifyOptions, jt as JWK_RSA_SIGN, k as JWSProtectedHeader, kt as JWK_RSA_Private, l as JWEGeneralRecipient, lt as JWK_AES_KW, m as JWEMultiDecryptResult, mt as JWK_ECDSA, n as ExpiresIn, nt as JWKLookupFunctionHeader, o as JWEDecryptResult, ot as JWK_AES_CBC_HMAC, p as JWEMultiDecryptOptions, pt as JWK_ECDH_ES, q as GenerateJWKOptions, r as MaxTokenAge, rt as JWKPEMAlgorithm, s as JWEEncryptOptions, st as JWK_AES_GCM, t as Duration, tt as JWKLookupFunction, u as JWEGeneralSerialization, ut as JWK_Asymmetric, v as JWSAlgorithm, vt as JWK_OKP, w as JWSMultiSigner, wt as JWK_Private, x as JWSGeneralSignature, xt as JWK_OKP_SIGN, y as JWSFlattenedSerialization, yt as JWK_OKP_Private, z as JWT } from "./_chunks/index.mjs";
1
+ import { $ as DeriveKeyOptions, A as JWSMultiSigner, At as JWK_PBES2, B as JWSVerifyResult, Bt as JWK_Symmetric, C as JWSAsymmetricPrivateJWK, Ct as JWK_EC_Private, D as JWSGeneralSignature, Dt as JWK_OKP_Private, E as JWSGeneralSerialization, Et as JWK_OKP, F as JWSProtectedHeader, Ft as JWK_RSA_ENC, G as isJWTError, Gt as UnwrappingKeyFor, H as JWTError, Ht as JWK_oct, I as JWSSignJWK, It as JWK_RSA_PSS, J as JWTClaimValidationOptions, Jt as WrappingKeyFor, K as JOSEPayload, Kt as WrapKeyOptions, L as JWSSignOptions, Lt as JWK_RSA_Private, M as JWSMultiVerifyOptions, Mt as JWK_Private, N as JWSMultiVerifyOutcome, Nt as JWK_Public, O as JWSHeaderParameters, Ot as JWK_OKP_Public, P as JWSMultiVerifyResult, Pt as JWK_RSA, Q as ContentEncryptionAlgorithm, R as JWSVerifyJWK, Rt as JWK_RSA_Public, S as JWSAlgorithm, St as JWK_ECDSA, T as JWSFlattenedSerialization, Tt as JWK_HMAC, U as JWTErrorCauseMap, Ut as KeyManagementAlgorithm, Vt as JWK_Symmetric_Algorithm, W as JWTErrorCode, Wt as UnwrapKeyOptions, X as JoseHeaderParameters, Y as JWTClaims, Z as CompositeKey, _ as JWEMultiDecryptOptions, _t as JWK_AES_KW, a as JWEAsymmetricPrivateJWK, at as GenerateKeyReturn, b as JWEMultiRecipient, bt as JWK_EC, c as JWEDecryptOptions, ct as JWKCacheAdapter, d as JWEEncryptOptions, dt as JWKPEMAlgorithm, et as DeriveKeyReturn, f as JWEFlattenedSerialization, ft as JWKParameters, g as JWEKeyManagementHeaderParameters, gt as JWK_AES_GCM_KW, h as JWEHeaderParameters, ht as JWK_AES_GCM, i as NotBeforeIn, it as GenerateKeyOptions, j as JWSMultiVerifyAllOptions, jt as JWK_Pair, k as JWSMultiSignOptions, kt as JWK_OKP_SIGN, l as JWEDecryptResult, lt as JWKLookupFunction, m as JWEGeneralSerialization, mt as JWK_AES_CBC_HMAC, n as ExpiresIn, nt as GenerateJWKReturn, o as JWEAsymmetricPublicJWK, ot as JWK, p as JWEGeneralRecipient, pt as JWKSet, q as JWT, qt as WrapKeyResult, r as MaxTokenAge, rt as GenerateKeyAlgorithm, s as JWEDecryptJWK, st as JWKAlgorithm, t as Duration, tt as GenerateJWKOptions, u as JWEEncryptJWK, ut as JWKLookupFunctionHeader, v as JWEMultiDecryptResult, vt as JWK_Asymmetric, w as JWSAsymmetricPublicJWK, wt as JWK_EC_Public, x as JWEProtectedHeader, xt as JWK_ECDH_ES, y as JWEMultiEncryptOptions, yt as JWK_Asymmetric_Algorithm, z as JWSVerifyOptions, zt as JWK_RSA_SIGN } from "./_chunks/index.mjs";
2
2
  import { WeakMapJWKCache, clearJWKCache, configureJWKCache, deriveJWKFromPassword, deriveKeyFromPassword, deriveSharedSecret, exportKey, exportPEM, exportToPEM, generateJWK, generateKey, getJWKFromSet, getJWKsFromSet, importFromPEM, importKey, importPEM, unwrapKey, wrapKey } from "./core/jwk.mjs";
3
3
  import { a as generalToFlattened, i as encryptMulti, n as encrypt, r as decryptMulti, t as decrypt } from "./_chunks/jwe.mjs";
4
4
  import { a as verifyMulti, i as signMulti, n as verify, o as verifyMultiAll, r as generalToFlattenedJWS, t as sign } from "./_chunks/jws.mjs";
5
5
  import { assertCryptoKey, computeDurationInSeconds, computeExpiresInSeconds, computeMaxTokenAgeSeconds, isAsymmetricJWK, isCryptoKey, isCryptoKeyPair, isJWK, isJWKSet, isPrivateJWK, isPublicJWK, isSymmetricJWK, validateJwtClaims } from "./core/utils/index.mjs";
6
- export { CompositeKey, ContentEncryptionAlgorithm, DeriveKeyOptions, DeriveKeyReturn, Duration, ExpiresIn, GenerateJWKOptions, GenerateJWKReturn, GenerateKeyAlgorithm, GenerateKeyOptions, GenerateKeyReturn, JOSEPayload, JWEDecryptOptions, JWEDecryptResult, JWEEncryptOptions, JWEFlattenedSerialization, JWEGeneralRecipient, JWEGeneralSerialization, JWEHeaderParameters, JWEKeyManagementHeaderParameters, JWEMultiDecryptOptions, JWEMultiDecryptResult, JWEMultiEncryptOptions, JWEMultiRecipient, JWEProtectedHeader, JWK, JWKAlgorithm, JWKCacheAdapter, JWKLookupFunction, JWKLookupFunctionHeader, JWKPEMAlgorithm, JWKParameters, JWKSet, JWK_AES_CBC_HMAC, JWK_AES_GCM, JWK_AES_GCM_KW, JWK_AES_KW, JWK_Asymmetric, JWK_Asymmetric_Algorithm, JWK_EC, JWK_ECDH_ES, JWK_ECDSA, JWK_EC_Private, JWK_EC_Public, JWK_HMAC, JWK_OKP, JWK_OKP_Private, JWK_OKP_Public, JWK_OKP_SIGN, JWK_PBES2, JWK_Pair, JWK_Private, JWK_Public, JWK_RSA, JWK_RSA_ENC, JWK_RSA_PSS, JWK_RSA_Private, JWK_RSA_Public, JWK_RSA_SIGN, JWK_Symmetric, JWK_Symmetric_Algorithm, JWK_oct, JWSAlgorithm, JWSFlattenedSerialization, JWSGeneralSerialization, JWSGeneralSignature, JWSHeaderParameters, JWSMultiSignOptions, JWSMultiSigner, JWSMultiVerifyAllOptions, JWSMultiVerifyOptions, JWSMultiVerifyOutcome, JWSMultiVerifyResult, JWSProtectedHeader, JWSSignOptions, JWSVerifyOptions, JWSVerifyResult, JWT, JWTClaimValidationOptions, JWTClaims, JWTError, type JWTErrorCauseMap, type JWTErrorCode, JoseHeaderParameters, KeyManagementAlgorithm, MaxTokenAge, NotBeforeIn, UnwrapKeyOptions, WeakMapJWKCache, WrapKeyOptions, WrapKeyResult, assertCryptoKey, clearJWKCache, computeDurationInSeconds, computeExpiresInSeconds, computeMaxTokenAgeSeconds, configureJWKCache, decrypt, decryptMulti, deriveJWKFromPassword, deriveKeyFromPassword, deriveSharedSecret, encrypt, encryptMulti, exportKey, exportPEM, exportToPEM, generalToFlattened, generalToFlattenedJWS, generateJWK, generateKey, getJWKFromSet, getJWKsFromSet, importFromPEM, importKey, importPEM, isAsymmetricJWK, isCryptoKey, isCryptoKeyPair, isJWK, isJWKSet, isJWTError, isPrivateJWK, isPublicJWK, isSymmetricJWK, sign, signMulti, unwrapKey, validateJwtClaims, verify, verifyMulti, verifyMultiAll, wrapKey };
6
+ export { CompositeKey, ContentEncryptionAlgorithm, DeriveKeyOptions, DeriveKeyReturn, Duration, ExpiresIn, GenerateJWKOptions, GenerateJWKReturn, GenerateKeyAlgorithm, GenerateKeyOptions, GenerateKeyReturn, JOSEPayload, JWEAsymmetricPrivateJWK, JWEAsymmetricPublicJWK, JWEDecryptJWK, JWEDecryptOptions, JWEDecryptResult, JWEEncryptJWK, JWEEncryptOptions, JWEFlattenedSerialization, JWEGeneralRecipient, JWEGeneralSerialization, JWEHeaderParameters, JWEKeyManagementHeaderParameters, JWEMultiDecryptOptions, JWEMultiDecryptResult, JWEMultiEncryptOptions, JWEMultiRecipient, JWEProtectedHeader, JWK, JWKAlgorithm, JWKCacheAdapter, JWKLookupFunction, JWKLookupFunctionHeader, JWKPEMAlgorithm, JWKParameters, JWKSet, JWK_AES_CBC_HMAC, JWK_AES_GCM, JWK_AES_GCM_KW, JWK_AES_KW, JWK_Asymmetric, JWK_Asymmetric_Algorithm, JWK_EC, JWK_ECDH_ES, JWK_ECDSA, JWK_EC_Private, JWK_EC_Public, JWK_HMAC, JWK_OKP, JWK_OKP_Private, JWK_OKP_Public, JWK_OKP_SIGN, JWK_PBES2, JWK_Pair, JWK_Private, JWK_Public, JWK_RSA, JWK_RSA_ENC, JWK_RSA_PSS, JWK_RSA_Private, JWK_RSA_Public, JWK_RSA_SIGN, JWK_Symmetric, JWK_Symmetric_Algorithm, JWK_oct, JWSAlgorithm, JWSAsymmetricPrivateJWK, JWSAsymmetricPublicJWK, JWSFlattenedSerialization, JWSGeneralSerialization, JWSGeneralSignature, JWSHeaderParameters, JWSMultiSignOptions, JWSMultiSigner, JWSMultiVerifyAllOptions, JWSMultiVerifyOptions, JWSMultiVerifyOutcome, JWSMultiVerifyResult, JWSProtectedHeader, JWSSignJWK, JWSSignOptions, JWSVerifyJWK, JWSVerifyOptions, JWSVerifyResult, JWT, JWTClaimValidationOptions, JWTClaims, JWTError, type JWTErrorCauseMap, type JWTErrorCode, JoseHeaderParameters, KeyManagementAlgorithm, MaxTokenAge, NotBeforeIn, UnwrapKeyOptions, UnwrappingKeyFor, WeakMapJWKCache, WrapKeyOptions, WrapKeyResult, WrappingKeyFor, assertCryptoKey, clearJWKCache, computeDurationInSeconds, computeExpiresInSeconds, computeMaxTokenAgeSeconds, configureJWKCache, decrypt, decryptMulti, deriveJWKFromPassword, deriveKeyFromPassword, deriveSharedSecret, encrypt, encryptMulti, exportKey, exportPEM, exportToPEM, generalToFlattened, generalToFlattenedJWS, generateJWK, generateKey, getJWKFromSet, getJWKsFromSet, importFromPEM, importKey, importPEM, isAsymmetricJWK, isCryptoKey, isCryptoKeyPair, isJWK, isJWKSet, isJWTError, isPrivateJWK, isPublicJWK, isSymmetricJWK, sign, signMulti, unwrapKey, validateJwtClaims, verify, verifyMulti, verifyMultiAll, wrapKey };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unjwt",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Low-level JWT utilities",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -56,8 +56,8 @@
56
56
  "devDependencies": {
57
57
  "@types/node": "^24",
58
58
  "@types/supertest": "^7.2.0",
59
- "@typescript/native-preview": "7.0.0-dev.20260419.1",
60
- "@vitest/coverage-v8": "^4.1.4",
59
+ "@typescript/native-preview": "7.0.0-dev.20260421.2",
60
+ "@vitest/coverage-v8": "^4.1.5",
61
61
  "automd": "^0.4.3",
62
62
  "changelogen": "^0.6.2",
63
63
  "cookie-esv1": "npm:cookie-es@^1.2.3",
@@ -67,19 +67,19 @@
67
67
  "jose": "^6.2.2",
68
68
  "nano-staged": "^1.0.2",
69
69
  "obuild": "^0.4.33",
70
- "oxfmt": "^0.45.0",
71
- "oxlint": "^1.60.0",
72
- "rolldown": "1.0.0-rc.16",
73
- "rou3": "^0.8.1",
70
+ "oxfmt": "^0.46.0",
71
+ "oxlint": "^1.61.0",
72
+ "rolldown": "1.0.0-rc.17",
74
73
  "simple-git-hooks": "^2.13.1",
75
74
  "supertest": "^7.2.2",
76
75
  "typescript": "^6.0.3",
77
- "unsecure": "^0.2.1",
78
- "vitest": "^4.1.4"
76
+ "unsecure": "^0.2.2",
77
+ "vitest": "^4.1.5"
79
78
  },
80
79
  "peerDependencies": {
81
80
  "cookie-es": "^1.2.3 || ^3.1.1",
82
- "h3": "^1.15.4 || >=2.0.1-rc.20 || ^2.0.1"
81
+ "h3": "^1.15.4 || >=2.0.1-rc.20 || ^2.0.1",
82
+ "rou3": "^0.8.1"
83
83
  },
84
84
  "peerDependenciesMeta": {
85
85
  "cookie-es": {
@@ -87,6 +87,9 @@
87
87
  },
88
88
  "h3": {
89
89
  "optional": true
90
+ },
91
+ "rou3": {
92
+ "optional": true
90
93
  }
91
94
  },
92
95
  "resolutions": {
@@ -1,63 +0,0 @@
1
- # Licenses of Bundled Dependencies
2
-
3
- The published artifact additionally contains code with the following licenses:
4
- MIT
5
-
6
- # Bundled Dependencies
7
-
8
- ## rou3
9
-
10
- License: MIT
11
- Repository: https://github.com/h3js/rou3
12
-
13
- > MIT License
14
- >
15
- > Copyright (c) Pooya Parsa <pooya@pi0.io>
16
- >
17
- > Permission is hereby granted, free of charge, to any person obtaining a copy
18
- > of this software and associated documentation files (the "Software"), to deal
19
- > in the Software without restriction, including without limitation the rights
20
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
- > copies of the Software, and to permit persons to whom the Software is
22
- > furnished to do so, subject to the following conditions:
23
- >
24
- > The above copyright notice and this permission notice shall be included in all
25
- > copies or substantial portions of the Software.
26
- >
27
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
- > SOFTWARE.
34
-
35
- ---------------------------------------
36
-
37
- ## unsecure
38
-
39
- License: MIT
40
- By: Sandro Circi
41
- Repository: https://github.com/sandros94/unsecure
42
-
43
- > MIT License
44
- >
45
- > Copyright (c) 2025 Sandro Circi
46
- >
47
- > Permission is hereby granted, free of charge, to any person obtaining a copy
48
- > of this software and associated documentation files (the "Software"), to deal
49
- > in the Software without restriction, including without limitation the rights
50
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
51
- > copies of the Software, and to permit persons to whom the Software is
52
- > furnished to do so, subject to the following conditions:
53
- >
54
- > The above copyright notice and this permission notice shall be included in all
55
- > copies or substantial portions of the Software.
56
- >
57
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
59
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
60
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
61
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
62
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
63
- > SOFTWARE.
@@ -1,5 +0,0 @@
1
- const NullProtoObj = /* @__PURE__ */ (() => {
2
- const e = function() {};
3
- return e.prototype = Object.create(null), Object.freeze(e.prototype), e;
4
- })();
5
- export { NullProtoObj as t };