unjwt 0.5.9 → 0.5.10
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/dist/index.d.mts +5 -6
- package/dist/index.mjs +5 -5
- package/dist/jwe.d.mts +2 -3
- package/dist/jwe.mjs +4 -4
- package/dist/jwk.d.mts +2 -3
- package/dist/jwk.mjs +2 -2
- package/dist/jws.d.mts +2 -3
- package/dist/jws.mjs +4 -4
- package/dist/shared/unjwt.B1dfkZSt.mjs +161 -0
- package/dist/shared/{unjwt.DRUXIabl.mjs → unjwt.BrOta13J.mjs} +19 -8
- package/dist/shared/{unjwt.Ca03jPX3.mjs → unjwt.CEjyBwhK.mjs} +1 -1
- package/dist/shared/{unjwt.D9da8HQF.d.mts → unjwt.CN1C8TlR.d.mts} +90 -15
- package/dist/shared/unjwt.CUUg6g3N.d.mts +128 -0
- package/dist/shared/{unjwt.DH1p_WL8.d.mts → unjwt.Cz90HQhy.d.mts} +11 -12
- package/dist/shared/{unjwt.B2olxeGL.mjs → unjwt.D0WA_yog.mjs} +22 -86
- package/dist/shared/{unjwt.8w7jp2aw.d.mts → unjwt.Dof5OLMV.d.mts} +28 -30
- package/dist/shared/{unjwt.D_Mabhgz.d.mts → unjwt.igKyF5q2.d.mts} +13 -69
- package/dist/shared/unjwt.odifuYKu.mjs +297 -0
- package/dist/utils.d.mts +2 -2
- package/dist/utils.mjs +1 -1
- package/package.json +12 -11
- package/dist/shared/unjwt.BHpknTpg.mjs +0 -93
- package/dist/shared/unjwt.BvIkEGGz.d.mts +0 -52
- package/dist/shared/unjwt.CbvzYE-m.d.mts +0 -58
- package/dist/shared/unjwt.wHjOCapq.mjs +0 -279
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +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, m as JWK, E as JWKAlgorithm, F as JWKPEMAlgorithm, J as JWKParameters, n as JWKSet, v as JWK_AES_CBC_HMAC, w as JWK_AES_GCM, u as JWK_AES_GCM_KW, t as JWK_AES_KW, B as JWK_Asymmetric_Algorithm, h as JWK_EC, y as JWK_ECDH_ES, r as JWK_ECDSA, g as JWK_EC_Private, f as JWK_EC_Public, z as JWK_ED, o as JWK_HMAC, x as JWK_PBES2, k as JWK_RSA, s as JWK_RSA_ENC, q as JWK_RSA_PSS, j as JWK_RSA_Private, i as JWK_RSA_Public, p as JWK_RSA_SIGN, A as JWK_Symmetric_Algorithm, l as JWK_oct, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, e as WrapKeyResult } from './shared/unjwt.
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export { j as jwk } from './shared/unjwt.DH1p_WL8.mjs';
|
|
1
|
+
export { C as CompositeKey, d as ContentEncryptionAlgorithm, D as DeriveKeyOptions, c as DeriveKeyReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, m as JWK, E as JWKAlgorithm, F as JWKPEMAlgorithm, J as JWKParameters, n as JWKSet, v as JWK_AES_CBC_HMAC, w as JWK_AES_GCM, u as JWK_AES_GCM_KW, t as JWK_AES_KW, B as JWK_Asymmetric_Algorithm, h as JWK_EC, y as JWK_ECDH_ES, r as JWK_ECDSA, g as JWK_EC_Private, f as JWK_EC_Public, z as JWK_ED, o as JWK_HMAC, x as JWK_PBES2, k as JWK_RSA, s as JWK_RSA_ENC, q as JWK_RSA_PSS, j as JWK_RSA_Private, i as JWK_RSA_Public, p as JWK_RSA_SIGN, A as JWK_Symmetric_Algorithm, l as JWK_oct, L as JWT, M as JWTClaimValidationOptions, I as JWTClaims, H as JoseHeaderParameters, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, e as WrapKeyResult } from './shared/unjwt.CN1C8TlR.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.igKyF5q2.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.Dof5OLMV.mjs';
|
|
4
|
+
export { i as utils } from './shared/unjwt.CUUg6g3N.mjs';
|
|
5
|
+
export { j as jwk } from './shared/unjwt.Cz90HQhy.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.odifuYKu.mjs';
|
|
2
|
+
export { j as jwe } from './shared/unjwt.D0WA_yog.mjs';
|
|
3
|
+
export { j as jwk } from './shared/unjwt.BrOta13J.mjs';
|
|
4
|
+
export { j as jws } from './shared/unjwt.B1dfkZSt.mjs';
|
|
5
|
+
import './shared/unjwt.CEjyBwhK.mjs';
|
package/dist/jwe.d.mts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import './shared/unjwt.
|
|
2
|
-
|
|
3
|
-
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.8w7jp2aw.mjs';
|
|
1
|
+
import './shared/unjwt.CN1C8TlR.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.Dof5OLMV.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.BrOta13J.mjs';
|
|
2
|
+
import './shared/unjwt.odifuYKu.mjs';
|
|
3
|
+
export { d as decrypt, e as encrypt } from './shared/unjwt.D0WA_yog.mjs';
|
|
4
|
+
import './shared/unjwt.CEjyBwhK.mjs';
|
package/dist/jwk.d.mts
CHANGED
|
@@ -1,3 +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, m as JWK, E as JWKAlgorithm, F as JWKPEMAlgorithm, J as JWKParameters, n as JWKSet, v as JWK_AES_CBC_HMAC, w as JWK_AES_GCM, u as JWK_AES_GCM_KW, t as JWK_AES_KW, B as JWK_Asymmetric_Algorithm, h as JWK_EC, y as JWK_ECDH_ES, r as JWK_ECDSA, g as JWK_EC_Private, f as JWK_EC_Public, z as JWK_ED, o as JWK_HMAC, x as JWK_PBES2, k as JWK_RSA, s as JWK_RSA_ENC, q as JWK_RSA_PSS, j as JWK_RSA_Private, i as JWK_RSA_Public, p as JWK_RSA_SIGN, A as JWK_Symmetric_Algorithm, l as JWK_oct, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, e as WrapKeyResult } from './shared/unjwt.
|
|
2
|
-
|
|
3
|
-
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.DH1p_WL8.mjs';
|
|
1
|
+
export { C as CompositeKey, d as ContentEncryptionAlgorithm, D as DeriveKeyOptions, c as DeriveKeyReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, m as JWK, E as JWKAlgorithm, F as JWKPEMAlgorithm, J as JWKParameters, n as JWKSet, v as JWK_AES_CBC_HMAC, w as JWK_AES_GCM, u as JWK_AES_GCM_KW, t as JWK_AES_KW, B as JWK_Asymmetric_Algorithm, h as JWK_EC, y as JWK_ECDH_ES, r as JWK_ECDSA, g as JWK_EC_Private, f as JWK_EC_Public, z as JWK_ED, o as JWK_HMAC, x as JWK_PBES2, k as JWK_RSA, s as JWK_RSA_ENC, q as JWK_RSA_PSS, j as JWK_RSA_Private, i as JWK_RSA_Public, p as JWK_RSA_SIGN, A as JWK_Symmetric_Algorithm, l as JWK_oct, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, e as WrapKeyResult } from './shared/unjwt.CN1C8TlR.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.Cz90HQhy.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.odifuYKu.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.BrOta13J.mjs';
|
package/dist/jws.d.mts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import './shared/unjwt.
|
|
2
|
-
|
|
3
|
-
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.D_Mabhgz.mjs';
|
|
1
|
+
import './shared/unjwt.CN1C8TlR.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.igKyF5q2.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.BrOta13J.mjs';
|
|
2
|
+
import './shared/unjwt.odifuYKu.mjs';
|
|
3
|
+
import './shared/unjwt.CEjyBwhK.mjs';
|
|
4
|
+
export { s as sign, v as verify } from './shared/unjwt.B1dfkZSt.mjs';
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { i as importKey, g as getJWKFromSet } from './unjwt.BrOta13J.mjs';
|
|
2
|
+
import { 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.odifuYKu.mjs';
|
|
3
|
+
import { s as sign$1, v as verify$1 } from './unjwt.CEjyBwhK.mjs';
|
|
4
|
+
|
|
5
|
+
async function sign(payload, key, options = {}) {
|
|
6
|
+
const { protectedHeader: additionalProtectedHeader } = options;
|
|
7
|
+
let { alg } = options;
|
|
8
|
+
if (!alg) {
|
|
9
|
+
if (isJWK(key) && key.alg) {
|
|
10
|
+
alg = key.alg;
|
|
11
|
+
} else {
|
|
12
|
+
throw new TypeError('JWS "alg" (Algorithm) must be provided in options');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
validateKeyLength(key, alg);
|
|
16
|
+
const signingKey = await importKey(key, alg);
|
|
17
|
+
const protectedHeader = {
|
|
18
|
+
...additionalProtectedHeader,
|
|
19
|
+
...isJWK(key) && key.kid ? { kid: additionalProtectedHeader?.kid || key.kid } : {},
|
|
20
|
+
// Include kid if available
|
|
21
|
+
alg,
|
|
22
|
+
typ: additionalProtectedHeader?.typ
|
|
23
|
+
};
|
|
24
|
+
applyTypCtyDefaults(protectedHeader, payload);
|
|
25
|
+
if (protectedHeader.b64 === true) {
|
|
26
|
+
delete protectedHeader.b64;
|
|
27
|
+
}
|
|
28
|
+
const computedPayload = computeJwtTimeClaims(
|
|
29
|
+
payload,
|
|
30
|
+
protectedHeader.typ,
|
|
31
|
+
options.expiresIn,
|
|
32
|
+
options.currentDate
|
|
33
|
+
);
|
|
34
|
+
const protectedHeaderString = JSON.stringify(protectedHeader);
|
|
35
|
+
const protectedHeaderEncoded = base64UrlEncode(protectedHeaderString);
|
|
36
|
+
let payloadBytes;
|
|
37
|
+
if (payload instanceof Uint8Array) {
|
|
38
|
+
payloadBytes = payload;
|
|
39
|
+
} else if (typeof payload === "string") {
|
|
40
|
+
payloadBytes = textEncoder.encode(payload);
|
|
41
|
+
} else if (typeof payload === "object" && payload !== null) {
|
|
42
|
+
payloadBytes = textEncoder.encode(
|
|
43
|
+
JSON.stringify(computedPayload || payload)
|
|
44
|
+
);
|
|
45
|
+
} else {
|
|
46
|
+
throw new TypeError(
|
|
47
|
+
"Payload must be a string, Uint8Array, or a JSON-serializable object."
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
const useB64 = protectedHeader.b64 !== false;
|
|
51
|
+
const payloadEncoded = useB64 ? base64UrlEncode(payloadBytes) : textDecoder.decode(payloadBytes);
|
|
52
|
+
const signingInputString = `${protectedHeaderEncoded}.${payloadEncoded}`;
|
|
53
|
+
const signingInputBytes = textEncoder.encode(signingInputString);
|
|
54
|
+
const signatureBytes = await sign$1(alg, signingKey, signingInputBytes);
|
|
55
|
+
const signatureEncoded = base64UrlEncode(signatureBytes);
|
|
56
|
+
return `${signingInputString}.${signatureEncoded}`;
|
|
57
|
+
}
|
|
58
|
+
async function verify(jws, key, options = {}) {
|
|
59
|
+
const parts = jws.split(".");
|
|
60
|
+
if (parts.length !== 3) {
|
|
61
|
+
throw new Error("Invalid JWS: Must contain three parts separated by dots.");
|
|
62
|
+
}
|
|
63
|
+
const [protectedHeaderEncoded, payloadEncoded, signatureEncoded] = parts;
|
|
64
|
+
let protectedHeader;
|
|
65
|
+
try {
|
|
66
|
+
const protectedHeaderString = base64UrlDecode(protectedHeaderEncoded);
|
|
67
|
+
protectedHeader = JSON.parse(protectedHeaderString);
|
|
68
|
+
} catch (error_) {
|
|
69
|
+
throw new Error(
|
|
70
|
+
`Invalid JWS: Protected header is not valid Base64URL or JSON (${error_ instanceof Error ? error_.message : error_})`
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
if (!protectedHeader || typeof protectedHeader !== "object" || !protectedHeader.alg) {
|
|
74
|
+
throw new Error(
|
|
75
|
+
'Invalid JWS: Protected header must be an object with an "alg" property.'
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
const alg = protectedHeader.alg;
|
|
79
|
+
if (options.algorithms && !options.algorithms.includes(alg)) {
|
|
80
|
+
throw new Error(`Algorithm not allowed: ${alg}`);
|
|
81
|
+
}
|
|
82
|
+
if (options.typ && protectedHeader.typ !== options.typ) {
|
|
83
|
+
throw new Error(
|
|
84
|
+
`Invalid JWS: "typ" (Type) Header Parameter mismatch. Expected "${options.typ}", got "${protectedHeader.typ}".`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
let signatureBytes;
|
|
88
|
+
try {
|
|
89
|
+
signatureBytes = base64UrlDecode(signatureEncoded, false);
|
|
90
|
+
} catch (error_) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
`Invalid JWS: Signature is not valid Base64URL (${error_ instanceof Error ? error_.message : error_})`
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
const keyInput = typeof key === "function" ? await key(protectedHeader, jws) : key;
|
|
96
|
+
const resolvedKey = isJWKSet(
|
|
97
|
+
keyInput
|
|
98
|
+
) ? getJWKFromSet(keyInput, protectedHeader) : keyInput;
|
|
99
|
+
const verificationKey = await importKey(resolvedKey, alg);
|
|
100
|
+
const signingInputString = `${protectedHeaderEncoded}.${payloadEncoded}`;
|
|
101
|
+
const signingInputBytes = textEncoder.encode(signingInputString);
|
|
102
|
+
const isValid = await verify$1(
|
|
103
|
+
alg,
|
|
104
|
+
verificationKey,
|
|
105
|
+
signatureBytes,
|
|
106
|
+
signingInputBytes
|
|
107
|
+
);
|
|
108
|
+
if (!isValid) {
|
|
109
|
+
throw new Error("JWS signature verification failed.");
|
|
110
|
+
}
|
|
111
|
+
const useB64 = protectedHeader.b64 !== false;
|
|
112
|
+
let payload;
|
|
113
|
+
try {
|
|
114
|
+
payload = useB64 ? decodePayloadFromB64UrlSegment(
|
|
115
|
+
payloadEncoded,
|
|
116
|
+
protectedHeader,
|
|
117
|
+
options.forceUint8Array
|
|
118
|
+
) : options.forceUint8Array ? textEncoder.encode(payloadEncoded) : payloadEncoded;
|
|
119
|
+
} catch (error_) {
|
|
120
|
+
throw new Error(
|
|
121
|
+
`Invalid JWS: Payload decoding failed (${error_ instanceof Error ? error_.message : error_})`
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
validateCriticalHeadersJWS(protectedHeader, [
|
|
125
|
+
...options.critical || [],
|
|
126
|
+
...options.requiredHeaders || []
|
|
127
|
+
]);
|
|
128
|
+
if (payload && typeof payload === "object" && protectedHeader.typ === "JWT" && !options.forceUint8Array) {
|
|
129
|
+
validateJwtClaims(payload, options);
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
payload,
|
|
133
|
+
protectedHeader
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function validateKeyLength(key, alg) {
|
|
137
|
+
if (!alg || isJWK(key)) return;
|
|
138
|
+
if (alg.startsWith("HS") && key instanceof Uint8Array) {
|
|
139
|
+
const algLength = Number.parseInt(alg.slice(2)) / 8;
|
|
140
|
+
if (key.length < algLength) {
|
|
141
|
+
throw new TypeError(
|
|
142
|
+
`${alg} requires key length to be ${algLength} bytes or larger`
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
} else if ((alg.startsWith("RS") || alg.startsWith("PS")) && key instanceof CryptoKey) {
|
|
146
|
+
const { modulusLength } = key.algorithm;
|
|
147
|
+
if (typeof modulusLength !== "number" || modulusLength < 2048) {
|
|
148
|
+
throw new TypeError(
|
|
149
|
+
`${alg} requires key modulusLength to be 2048 bits or larger`
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const jws = {
|
|
156
|
+
__proto__: null,
|
|
157
|
+
sign: sign,
|
|
158
|
+
verify: verify
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export { jws as j, sign as s, verify as v };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as isCryptoKey, k as concatUint8Arrays, d as base64UrlEncode, q as base64Decode, s as base64Encode, t as textEncoder, r as randomBytes, a as isJWK, f as base64UrlDecode, g as isJWKSet } from './unjwt.odifuYKu.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This is a fork of Jose library's utility functions.
|
|
@@ -330,7 +330,7 @@ async function gcmEncrypt(enc, plaintext, cek, iv, aad) {
|
|
|
330
330
|
async function encrypt(enc, plaintext, cek, iv, aad) {
|
|
331
331
|
if (!isCryptoKey(cek) && !(cek instanceof Uint8Array)) {
|
|
332
332
|
throw new TypeError(
|
|
333
|
-
`Key must be ${cek} one of type: CryptoKey
|
|
333
|
+
`Key must be ${cek} one of type: CryptoKey or Uint8Array`
|
|
334
334
|
);
|
|
335
335
|
}
|
|
336
336
|
if (iv) {
|
|
@@ -461,7 +461,7 @@ async function gcmDecrypt(enc, cek, ciphertext, iv, tag, aad) {
|
|
|
461
461
|
async function decrypt(enc, cek, ciphertext, iv, tag, aad) {
|
|
462
462
|
if (!isCryptoKey(cek) && !(cek instanceof Uint8Array)) {
|
|
463
463
|
throw new TypeError(
|
|
464
|
-
`Key must be ${cek} one of type: CryptoKey
|
|
464
|
+
`Key must be ${cek} one of type: CryptoKey or Uint8Array`
|
|
465
465
|
);
|
|
466
466
|
}
|
|
467
467
|
if (!iv) {
|
|
@@ -497,18 +497,24 @@ async function decrypt(enc, cek, ciphertext, iv, tag, aad) {
|
|
|
497
497
|
* @source https://github.com/panva/jose/tree/69b7960c67e05be55fa2ec31c74b987696c20c60/src/lib/aesgcmkw.ts
|
|
498
498
|
* @license MIT https://github.com/panva/jose/blob/69b7960c67e05be55fa2ec31c74b987696c20c60/LICENSE.md
|
|
499
499
|
*/
|
|
500
|
-
async function encryptIV(alg, key,
|
|
500
|
+
async function encryptIV(alg, key, plaintext, iv) {
|
|
501
501
|
const jweAlgorithm = alg.slice(0, 7);
|
|
502
|
-
const wrapped = await encrypt(
|
|
502
|
+
const wrapped = await encrypt(
|
|
503
|
+
jweAlgorithm,
|
|
504
|
+
plaintext,
|
|
505
|
+
key,
|
|
506
|
+
iv,
|
|
507
|
+
new Uint8Array(0)
|
|
508
|
+
);
|
|
503
509
|
return {
|
|
504
510
|
encryptedKey: wrapped.ciphertext,
|
|
505
511
|
iv: base64UrlEncode(wrapped.iv),
|
|
506
512
|
tag: base64UrlEncode(wrapped.tag)
|
|
507
513
|
};
|
|
508
514
|
}
|
|
509
|
-
async function decryptIV(alg, key,
|
|
515
|
+
async function decryptIV(alg, key, ciphertext, iv, tag) {
|
|
510
516
|
const jweAlgorithm = alg.slice(0, 7);
|
|
511
|
-
return decrypt(jweAlgorithm, key,
|
|
517
|
+
return decrypt(jweAlgorithm, key, ciphertext, iv, tag, new Uint8Array(0));
|
|
512
518
|
}
|
|
513
519
|
|
|
514
520
|
/**
|
|
@@ -1479,7 +1485,12 @@ function getGenerateKeyParams(alg, options) {
|
|
|
1479
1485
|
keyUsages = defaultKeyUsage ?? ["sign", "verify"];
|
|
1480
1486
|
break;
|
|
1481
1487
|
}
|
|
1482
|
-
|
|
1488
|
+
case "Ed25519":
|
|
1489
|
+
case "EdDSA": {
|
|
1490
|
+
algorithm = { name: "Ed25519" };
|
|
1491
|
+
keyUsages = defaultKeyUsage ?? ["sign", "verify"];
|
|
1492
|
+
break;
|
|
1493
|
+
}
|
|
1483
1494
|
// RSA Encryption
|
|
1484
1495
|
case "RSA-OAEP":
|
|
1485
1496
|
case "RSA-OAEP-256":
|
|
@@ -15,7 +15,7 @@ interface GenerateKeyOptions {
|
|
|
15
15
|
/** RSA modulus length. Defaults to 2048. */
|
|
16
16
|
modulusLength?: number;
|
|
17
17
|
/** RSA public exponent. Defaults to 65537 (0x010001). */
|
|
18
|
-
publicExponent?: Uint8Array
|
|
18
|
+
publicExponent?: Uint8Array<ArrayBuffer>;
|
|
19
19
|
/** Export the generated key(s) as JWK. If true, the key(s) will be returned in JWK format. */
|
|
20
20
|
toJWK?: boolean | undefined;
|
|
21
21
|
}
|
|
@@ -23,12 +23,12 @@ type GenerateKeyReturnJWK<TAlg extends GenerateKeyAlgorithm> = TAlg extends JWK_
|
|
|
23
23
|
privateKey: JWK;
|
|
24
24
|
publicKey: JWK;
|
|
25
25
|
} : JWK;
|
|
26
|
-
type GenerateKeyReturnCrypto<TAlg extends GenerateKeyAlgorithm> = TAlg extends JWK_AES_CBC_HMAC ? Uint8Array : TAlg extends JWK_Asymmetric_Algorithm ? CryptoKeyPair : CryptoKey;
|
|
26
|
+
type GenerateKeyReturnCrypto<TAlg extends GenerateKeyAlgorithm> = TAlg extends JWK_AES_CBC_HMAC ? Uint8Array<ArrayBuffer> : TAlg extends JWK_Asymmetric_Algorithm ? CryptoKeyPair : CryptoKey;
|
|
27
27
|
type GenerateKeyReturn<TAlg extends GenerateKeyAlgorithm, TOptions extends GenerateKeyOptions> = TOptions["toJWK"] extends true ? GenerateKeyReturnJWK<TAlg> : GenerateKeyReturnCrypto<TAlg>;
|
|
28
28
|
/** Options for the deriveKeyFromPassword function. */
|
|
29
29
|
interface DeriveKeyOptions {
|
|
30
30
|
/** Salt value (p2s). Must be at least 8 bytes. */
|
|
31
|
-
salt: Uint8Array
|
|
31
|
+
salt: Uint8Array<ArrayBuffer>;
|
|
32
32
|
/** Iteration count (p2c). Must be a positive integer. */
|
|
33
33
|
iterations: number;
|
|
34
34
|
/** Key usages for the derived key. Defaults to ["wrapKey", "unwrapKey"]. */
|
|
@@ -44,22 +44,22 @@ type ContentEncryptionAlgorithm = JWK_AES_GCM | JWK_AES_CBC_HMAC;
|
|
|
44
44
|
/** Options for the wrapKey function. */
|
|
45
45
|
interface WrapKeyOptions {
|
|
46
46
|
/** Initialization Vector for AES-GCMKW. Generated if not provided. */
|
|
47
|
-
iv?: Uint8Array
|
|
47
|
+
iv?: Uint8Array<ArrayBuffer>;
|
|
48
48
|
/** PBES2 Salt value (p2s). Required for PBES2 algorithms. */
|
|
49
|
-
p2s?: Uint8Array
|
|
49
|
+
p2s?: Uint8Array<ArrayBuffer>;
|
|
50
50
|
/** PBES2 Iteration count (p2c). Required for PBES2 algorithms. */
|
|
51
51
|
p2c?: number;
|
|
52
52
|
/** ECDH-ES Ephemeral Public Key. Generated if not provided for ECDH-ES. */
|
|
53
53
|
epk?: JWK_EC_Public;
|
|
54
54
|
/** ECDH-ES Agreement PartyUInfo. */
|
|
55
|
-
apu?: Uint8Array
|
|
55
|
+
apu?: Uint8Array<ArrayBuffer>;
|
|
56
56
|
/** ECDH-ES Agreement PartyVInfo. */
|
|
57
|
-
apv?: Uint8Array
|
|
57
|
+
apv?: Uint8Array<ArrayBuffer>;
|
|
58
58
|
}
|
|
59
59
|
/** Result of the wrapKey function. */
|
|
60
60
|
interface WrapKeyResult {
|
|
61
61
|
/** The wrapped key (Ciphertext). */
|
|
62
|
-
encryptedKey: Uint8Array
|
|
62
|
+
encryptedKey: Uint8Array<ArrayBuffer>;
|
|
63
63
|
/** Initialization Vector used (only for AES-GCMKW). Base64URL encoded. */
|
|
64
64
|
iv?: string;
|
|
65
65
|
/** Authentication Tag generated (only for AES-GCMKW). Base64URL encoded. */
|
|
@@ -78,19 +78,19 @@ interface WrapKeyResult {
|
|
|
78
78
|
/** Options for the unwrapKey function. */
|
|
79
79
|
interface UnwrapKeyOptions {
|
|
80
80
|
/** Initialization Vector (required for AES-GCMKW). Base64URL encoded or Uint8Array. */
|
|
81
|
-
iv?: Uint8Array | string;
|
|
81
|
+
iv?: Uint8Array<ArrayBuffer> | string;
|
|
82
82
|
/** Authentication Tag (required for AES-GCMKW). Base64URL encoded or Uint8Array. */
|
|
83
|
-
tag?: Uint8Array | string;
|
|
83
|
+
tag?: Uint8Array<ArrayBuffer> | string;
|
|
84
84
|
/** PBES2 Salt value (required for PBES2). Base64URL encoded or Uint8Array. */
|
|
85
|
-
p2s?: Uint8Array | string;
|
|
85
|
+
p2s?: Uint8Array<ArrayBuffer> | string;
|
|
86
86
|
/** PBES2 Iteration count (required for PBES2). */
|
|
87
87
|
p2c?: number;
|
|
88
88
|
/** ECDH-ES Ephemeral Public Key (required for ECDH-ES). */
|
|
89
89
|
epk?: JWK_EC_Public;
|
|
90
90
|
/** ECDH-ES Agreement PartyUInfo. Base64URL encoded or Uint8Array. */
|
|
91
|
-
apu?: Uint8Array | string;
|
|
91
|
+
apu?: Uint8Array<ArrayBuffer> | string;
|
|
92
92
|
/** ECDH-ES Agreement PartyVInfo. Base64URL encoded or Uint8Array. */
|
|
93
|
-
apv?: Uint8Array | string;
|
|
93
|
+
apv?: Uint8Array<ArrayBuffer> | string;
|
|
94
94
|
/** Expected unwrapped key algorithm (e.g., 'AES-GCM', 'AES-CBC'). Used by crypto.subtle.unwrapKey. */
|
|
95
95
|
unwrappedKeyAlgorithm?: string | Algorithm | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams;
|
|
96
96
|
/** Expected key usages for the unwrapped key. */
|
|
@@ -203,8 +203,83 @@ type JWK_PBES2 = "PBES2-HS256+A128KW" | "PBES2-HS384+A192KW" | "PBES2-HS512+A256
|
|
|
203
203
|
type JWK_ECDH_ES = "ECDH-ES" | "ECDH-ES+A128KW" | "ECDH-ES+A192KW" | "ECDH-ES+A256KW";
|
|
204
204
|
type JWK_ED = "Ed25519" | "EdDSA";
|
|
205
205
|
type JWK_Symmetric_Algorithm = JWK_HMAC | JWK_AES_KW | JWK_AES_GCM;
|
|
206
|
-
type JWK_Asymmetric_Algorithm = JWK_RSA_SIGN | JWK_RSA_PSS | JWK_ECDSA | JWK_RSA_ENC;
|
|
206
|
+
type JWK_Asymmetric_Algorithm = JWK_RSA_SIGN | JWK_RSA_PSS | JWK_ECDSA | JWK_RSA_ENC | JWK_ED;
|
|
207
207
|
type JWKAlgorithm = JWK_Symmetric_Algorithm | JWK_Asymmetric_Algorithm | JWK_AES_CBC_HMAC | JWK_PBES2 | JWK_ECDH_ES | ("none" | "dir");
|
|
208
208
|
type JWKPEMAlgorithm = JWK_RSA_PSS | JWK_RSA_SIGN | JWK_RSA_ENC | JWK_ECDSA | JWK_ECDH_ES | JWK_ED;
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
/** Header Parameters common to JWE and JWS */
|
|
211
|
+
interface JoseHeaderParameters {
|
|
212
|
+
/** "kid" (Key ID) Header Parameter */
|
|
213
|
+
kid?: string;
|
|
214
|
+
/** "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter */
|
|
215
|
+
x5t?: string;
|
|
216
|
+
/** "x5c" (X.509 Certificate Chain) Header Parameter */
|
|
217
|
+
x5c?: string[];
|
|
218
|
+
/** "x5u" (X.509 URL) Header Parameter */
|
|
219
|
+
x5u?: string;
|
|
220
|
+
/** "jku" (JWK Set URL) Header Parameter */
|
|
221
|
+
jku?: string;
|
|
222
|
+
/** "jwk" (JSON Web Key) Header Parameter */
|
|
223
|
+
jwk?: JWK_RSA_Public;
|
|
224
|
+
/** "typ" (Type) Header Parameter */
|
|
225
|
+
typ?: string;
|
|
226
|
+
/** "cty" (Content Type) Header Parameter */
|
|
227
|
+
cty?: string;
|
|
228
|
+
/** "crit" (Critical) Header Parameter */
|
|
229
|
+
crit?: string[];
|
|
230
|
+
/** Any other JWS/JWE Header member. */
|
|
231
|
+
[propName: string]: unknown;
|
|
232
|
+
}
|
|
233
|
+
interface JWTClaims {
|
|
234
|
+
/** "iss" (Issuer) Claim */
|
|
235
|
+
iss?: string;
|
|
236
|
+
/** "sub" (Subject) Claim */
|
|
237
|
+
sub?: string;
|
|
238
|
+
/** "aud" (Audience) Claim */
|
|
239
|
+
aud?: string | string[];
|
|
240
|
+
/** "exp" (Expiration Time) Claim */
|
|
241
|
+
exp?: number;
|
|
242
|
+
/** "nbf" (Not Before) Claim */
|
|
243
|
+
nbf?: number;
|
|
244
|
+
/** "iat" (Issued At) Claim */
|
|
245
|
+
iat?: number;
|
|
246
|
+
/** "jti" (JWT ID) Claim */
|
|
247
|
+
jti?: string;
|
|
248
|
+
/** Any other JWT member. */
|
|
249
|
+
[propName: string]: unknown;
|
|
250
|
+
}
|
|
251
|
+
interface JWT<T = JWTClaims> {
|
|
252
|
+
header: JoseHeaderParameters & {
|
|
253
|
+
/** "alg" (Algorithm) Header Parameter */
|
|
254
|
+
alg: string;
|
|
255
|
+
};
|
|
256
|
+
claims: T;
|
|
257
|
+
}
|
|
258
|
+
interface JWTClaimValidationOptions {
|
|
259
|
+
/** Expected JWT "aud" (Audience) Claim value(s). Implies presence requirement. */
|
|
260
|
+
audience?: string | string[];
|
|
261
|
+
/** Expected JWT "iss" (Issuer) Claim value(s). Implies presence requirement. */
|
|
262
|
+
issuer?: string | string[];
|
|
263
|
+
/** Expected JWT "sub" (Subject) Claim value. Implies presence requirement. */
|
|
264
|
+
subject?: string;
|
|
265
|
+
/** Maximum token age in seconds, from the JWT "iat" (Issued At) Claim value. Implies presence requirement. */
|
|
266
|
+
maxTokenAge?: number;
|
|
267
|
+
/** Clock skew tolerance (in seconds) for validating time-based claims (nbf/exp/iat). */
|
|
268
|
+
clockTolerance?: number;
|
|
269
|
+
/** Expected JWT "typ" (Type) Header Parameter value. Implies presence requirement. */
|
|
270
|
+
typ?: string;
|
|
271
|
+
/** Date to use when comparing NumericDate claims, defaults to `new Date()`. */
|
|
272
|
+
currentDate?: Date;
|
|
273
|
+
/** Additional required claim names. */
|
|
274
|
+
requiredClaims?: string[];
|
|
275
|
+
/** List of critical header parameters that must be understood and processed. */
|
|
276
|
+
requiredHeaders?: string[];
|
|
277
|
+
/**
|
|
278
|
+
* Critical Header Parameters to be understood and processed.
|
|
279
|
+
* If the JWT contains critical headers not in this list (and not inherently understood by the library), decryption will fail.
|
|
280
|
+
* @deprecated use {@link requiredHeaders `recognizedHeaders` option} instead.
|
|
281
|
+
*/
|
|
282
|
+
critical?: string[];
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export type { JWK_Symmetric_Algorithm as A, JWK_Asymmetric_Algorithm as B, CompositeKey as C, DeriveKeyOptions as D, JWKAlgorithm as E, JWKPEMAlgorithm as F, GenerateKeyAlgorithm as G, JoseHeaderParameters as H, JWTClaims as I, JWKParameters as J, KeyManagementAlgorithm as K, JWT as L, JWTClaimValidationOptions as M, UnwrapKeyOptions as U, WrapKeyOptions as W, GenerateKeyOptions as a, GenerateKeyReturn as b, DeriveKeyReturn as c, ContentEncryptionAlgorithm as d, WrapKeyResult as e, JWK_EC_Public as f, JWK_EC_Private as g, JWK_EC as h, JWK_RSA_Public as i, JWK_RSA_Private as j, JWK_RSA as k, JWK_oct as l, JWK as m, JWKSet as n, JWK_HMAC as o, JWK_RSA_SIGN as p, JWK_RSA_PSS as q, JWK_ECDSA as r, JWK_RSA_ENC as s, JWK_AES_KW as t, JWK_AES_GCM_KW as u, JWK_AES_CBC_HMAC as v, JWK_AES_GCM as w, JWK_PBES2 as x, JWK_ECDH_ES as y, JWK_ED as z };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { I as JWTClaims, M as JWTClaimValidationOptions, m as JWK, n as JWKSet } from './unjwt.CN1C8TlR.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Apply default typ/cty semantics shared by JWS & JWE.
|
|
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 "json".
|
|
7
|
+
*/
|
|
8
|
+
declare function applyTypCtyDefaults<T extends {
|
|
9
|
+
typ?: string;
|
|
10
|
+
cty?: string;
|
|
11
|
+
}>(header: T, payload: unknown): T;
|
|
12
|
+
/** Returns true when headers indicate JSON content. */
|
|
13
|
+
declare function isJsonContent(header: {
|
|
14
|
+
typ?: string;
|
|
15
|
+
cty?: string;
|
|
16
|
+
} | undefined): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Given a decoded string and JOSE headers, return an object if JSON, otherwise the string.
|
|
19
|
+
*/
|
|
20
|
+
declare function decodeMaybeJsonString<T = unknown>(decodedString: string, header: {
|
|
21
|
+
typ?: string;
|
|
22
|
+
cty?: string;
|
|
23
|
+
} | undefined): T | string;
|
|
24
|
+
/**
|
|
25
|
+
* Decode a payload that is represented as raw bytes into T | string, honoring forceUint8Array and headers.
|
|
26
|
+
*/
|
|
27
|
+
declare function decodePayloadFromBytes<T = unknown>(bytes: Uint8Array<ArrayBuffer>, header: {
|
|
28
|
+
typ?: string;
|
|
29
|
+
cty?: string;
|
|
30
|
+
} | undefined, forceUint8Array?: boolean): T | Uint8Array<ArrayBuffer> | string;
|
|
31
|
+
/**
|
|
32
|
+
* Decode a payload that is a Base64URL segment into T | string | Uint8Array based on flags and headers.
|
|
33
|
+
*/
|
|
34
|
+
declare function decodePayloadFromB64UrlSegment<T = unknown>(payloadEncoded: string, header: {
|
|
35
|
+
typ?: string;
|
|
36
|
+
cty?: string;
|
|
37
|
+
} | undefined, forceUint8Array?: boolean): T | Uint8Array<ArrayBuffer> | string;
|
|
38
|
+
/** Convert plaintext input to bytes, shared by JWS & JWE when preparing payload. */
|
|
39
|
+
declare function getPlaintextBytes(payload: string | Uint8Array<ArrayBuffer> | Record<string, any>): Uint8Array<ArrayBuffer>;
|
|
40
|
+
/** Optionally compute iat/exp when signing JWTs. */
|
|
41
|
+
declare function computeJwtTimeClaims(payload: unknown, headerTyp: string | undefined, expiresIn?: number, currentDate?: Date): JWTClaims | undefined;
|
|
42
|
+
/** Validate JWT claims under JWS verification rules (or custom JWE implementations). */
|
|
43
|
+
declare function validateJwtClaims(jwtClaims: JWTClaims, options?: JWTClaimValidationOptions): void;
|
|
44
|
+
/** Validate critical headers in JWS semantics. */
|
|
45
|
+
declare function validateCriticalHeadersJWS(protectedHeader: {
|
|
46
|
+
crit?: string[];
|
|
47
|
+
} & Record<string, any>, requiredHeaders?: string[]): void;
|
|
48
|
+
/** Validate critical headers in JWE semantics. */
|
|
49
|
+
declare function validateCriticalHeadersJWE(protectedHeader: {
|
|
50
|
+
crit?: string[];
|
|
51
|
+
} & Record<string, any>, understoodFromOptions?: string[]): void;
|
|
52
|
+
|
|
53
|
+
declare const textEncoder: TextEncoder;
|
|
54
|
+
declare const textDecoder: TextDecoder;
|
|
55
|
+
declare function base64Encode(data: Uint8Array<ArrayBuffer> | string): string;
|
|
56
|
+
declare function base64UrlEncode(data: Uint8Array<ArrayBuffer> | string): string;
|
|
57
|
+
declare function base64Decode(str: string | undefined): string;
|
|
58
|
+
declare function base64Decode<T extends boolean | undefined>(str?: string | undefined, toString?: T): T extends false ? Uint8Array<ArrayBuffer> : string;
|
|
59
|
+
declare function base64UrlDecode(str: string | undefined): string;
|
|
60
|
+
declare function base64UrlDecode<T extends boolean | undefined>(str?: string | undefined, toString?: T): T extends false ? Uint8Array<ArrayBuffer> : string;
|
|
61
|
+
declare function randomBytes(length: Readonly<number>): Uint8Array<ArrayBuffer>;
|
|
62
|
+
/**
|
|
63
|
+
* Concatenates multiple Uint8Arrays
|
|
64
|
+
* @param arrays Arrays to concatenate
|
|
65
|
+
* @returns Concatenated array
|
|
66
|
+
*/
|
|
67
|
+
declare function concatUint8Arrays(...arrays: Readonly<Uint8Array<ArrayBuffer>[]>): Uint8Array<ArrayBuffer>;
|
|
68
|
+
declare function maybeArray<T>(item: T | T[]): T[];
|
|
69
|
+
declare function isJWK(key: any): key is JWK;
|
|
70
|
+
declare function isJWKSet(key: any): key is JWKSet;
|
|
71
|
+
declare function assertCryptoKey(key: unknown): asserts key is CryptoKey;
|
|
72
|
+
declare function isCryptoKey(key: unknown): key is CryptoKey;
|
|
73
|
+
declare const isCryptoKeyPair: (key: any) => key is CryptoKeyPair;
|
|
74
|
+
|
|
75
|
+
declare const index_applyTypCtyDefaults: typeof applyTypCtyDefaults;
|
|
76
|
+
declare const index_assertCryptoKey: typeof assertCryptoKey;
|
|
77
|
+
declare const index_base64Decode: typeof base64Decode;
|
|
78
|
+
declare const index_base64Encode: typeof base64Encode;
|
|
79
|
+
declare const index_base64UrlDecode: typeof base64UrlDecode;
|
|
80
|
+
declare const index_base64UrlEncode: typeof base64UrlEncode;
|
|
81
|
+
declare const index_computeJwtTimeClaims: typeof computeJwtTimeClaims;
|
|
82
|
+
declare const index_concatUint8Arrays: typeof concatUint8Arrays;
|
|
83
|
+
declare const index_decodeMaybeJsonString: typeof decodeMaybeJsonString;
|
|
84
|
+
declare const index_decodePayloadFromB64UrlSegment: typeof decodePayloadFromB64UrlSegment;
|
|
85
|
+
declare const index_decodePayloadFromBytes: typeof decodePayloadFromBytes;
|
|
86
|
+
declare const index_getPlaintextBytes: typeof getPlaintextBytes;
|
|
87
|
+
declare const index_isCryptoKey: typeof isCryptoKey;
|
|
88
|
+
declare const index_isCryptoKeyPair: typeof isCryptoKeyPair;
|
|
89
|
+
declare const index_isJWK: typeof isJWK;
|
|
90
|
+
declare const index_isJWKSet: typeof isJWKSet;
|
|
91
|
+
declare const index_isJsonContent: typeof isJsonContent;
|
|
92
|
+
declare const index_maybeArray: typeof maybeArray;
|
|
93
|
+
declare const index_randomBytes: typeof randomBytes;
|
|
94
|
+
declare const index_textDecoder: typeof textDecoder;
|
|
95
|
+
declare const index_textEncoder: typeof textEncoder;
|
|
96
|
+
declare const index_validateCriticalHeadersJWE: typeof validateCriticalHeadersJWE;
|
|
97
|
+
declare const index_validateCriticalHeadersJWS: typeof validateCriticalHeadersJWS;
|
|
98
|
+
declare const index_validateJwtClaims: typeof validateJwtClaims;
|
|
99
|
+
declare namespace index {
|
|
100
|
+
export {
|
|
101
|
+
index_applyTypCtyDefaults as applyTypCtyDefaults,
|
|
102
|
+
index_assertCryptoKey as assertCryptoKey,
|
|
103
|
+
index_base64Decode as base64Decode,
|
|
104
|
+
index_base64Encode as base64Encode,
|
|
105
|
+
index_base64UrlDecode as base64UrlDecode,
|
|
106
|
+
index_base64UrlEncode as base64UrlEncode,
|
|
107
|
+
index_computeJwtTimeClaims as computeJwtTimeClaims,
|
|
108
|
+
index_concatUint8Arrays as concatUint8Arrays,
|
|
109
|
+
index_decodeMaybeJsonString as decodeMaybeJsonString,
|
|
110
|
+
index_decodePayloadFromB64UrlSegment as decodePayloadFromB64UrlSegment,
|
|
111
|
+
index_decodePayloadFromBytes as decodePayloadFromBytes,
|
|
112
|
+
index_getPlaintextBytes as getPlaintextBytes,
|
|
113
|
+
index_isCryptoKey as isCryptoKey,
|
|
114
|
+
index_isCryptoKeyPair as isCryptoKeyPair,
|
|
115
|
+
index_isJWK as isJWK,
|
|
116
|
+
index_isJWKSet as isJWKSet,
|
|
117
|
+
index_isJsonContent as isJsonContent,
|
|
118
|
+
index_maybeArray as maybeArray,
|
|
119
|
+
index_randomBytes as randomBytes,
|
|
120
|
+
index_textDecoder as textDecoder,
|
|
121
|
+
index_textEncoder as textEncoder,
|
|
122
|
+
index_validateCriticalHeadersJWE as validateCriticalHeadersJWE,
|
|
123
|
+
index_validateCriticalHeadersJWS as validateCriticalHeadersJWS,
|
|
124
|
+
index_validateJwtClaims as validateJwtClaims,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export { 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, applyTypCtyDefaults as n, isJsonContent as o, decodeMaybeJsonString as p, decodePayloadFromBytes as q, randomBytes as r, decodePayloadFromB64UrlSegment as s, textEncoder as t, getPlaintextBytes as u, computeJwtTimeClaims as v, validateJwtClaims as w, validateCriticalHeadersJWS as x, validateCriticalHeadersJWE as y };
|