jose 4.8.3 → 4.9.2
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 +6 -3
- package/dist/browser/index.js +1 -1
- package/dist/browser/jwe/flattened/decrypt.js +3 -3
- package/dist/browser/jwk/thumbprint.js +7 -1
- package/dist/browser/jws/flattened/verify.js +1 -1
- package/dist/browser/lib/decrypt_key_management.js +4 -1
- package/dist/node/cjs/index.js +2 -1
- package/dist/node/cjs/jwe/flattened/decrypt.js +3 -3
- package/dist/node/cjs/jwk/thumbprint.js +9 -2
- package/dist/node/cjs/jws/flattened/verify.js +1 -1
- package/dist/node/cjs/lib/decrypt_key_management.js +4 -1
- package/dist/node/cjs/runtime/key_to_jwk.js +4 -0
- package/dist/node/esm/index.js +1 -1
- package/dist/node/esm/jwe/flattened/decrypt.js +3 -3
- package/dist/node/esm/jwk/thumbprint.js +7 -1
- package/dist/node/esm/jws/flattened/verify.js +1 -1
- package/dist/node/esm/lib/decrypt_key_management.js +4 -1
- package/dist/node/esm/runtime/key_to_jwk.js +4 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/jwe/compact/decrypt.d.ts +9 -7
- package/dist/types/jwe/compact/encrypt.d.ts +14 -20
- package/dist/types/jwe/flattened/decrypt.d.ts +12 -13
- package/dist/types/jwe/flattened/encrypt.d.ts +17 -26
- package/dist/types/jwe/general/decrypt.d.ts +13 -14
- package/dist/types/jwe/general/encrypt.d.ts +6 -15
- package/dist/types/jwk/embedded.d.ts +8 -7
- package/dist/types/jwk/thumbprint.d.ts +30 -7
- package/dist/types/jwks/local.d.ts +12 -15
- package/dist/types/jwks/remote.d.ts +22 -36
- package/dist/types/jws/compact/sign.d.ts +3 -6
- package/dist/types/jws/compact/verify.d.ts +11 -8
- package/dist/types/jws/flattened/sign.d.ts +3 -6
- package/dist/types/jws/flattened/verify.d.ts +12 -9
- package/dist/types/jws/general/sign.d.ts +7 -18
- package/dist/types/jws/general/verify.d.ts +14 -11
- package/dist/types/jwt/decrypt.d.ts +13 -12
- package/dist/types/jwt/encrypt.d.ts +15 -18
- package/dist/types/jwt/produce.d.ts +9 -14
- package/dist/types/jwt/sign.d.ts +2 -2
- package/dist/types/jwt/unsecured.d.ts +4 -4
- package/dist/types/jwt/verify.d.ts +15 -13
- package/dist/types/key/export.d.ts +13 -8
- package/dist/types/key/generate_key_pair.d.ts +14 -19
- package/dist/types/key/generate_secret.d.ts +3 -2
- package/dist/types/key/import.d.ts +50 -39
- package/dist/types/types.d.ts +203 -371
- package/dist/types/util/decode_jwt.d.ts +7 -6
- package/dist/types/util/decode_protected_header.d.ts +3 -2
- package/dist/types/util/errors.d.ts +20 -61
- package/package.json +4 -2
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { JWTPayload } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* Decodes a signed JSON Web Token payload. This does not validate the JWT Claims Set
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @param jwt JWT token in compact JWS serialization.
|
|
3
|
+
* Decodes a signed JSON Web Token payload. This does not validate the JWT Claims Set types or
|
|
4
|
+
* values. This does not validate the JWS Signature. For a proper Signed JWT Claims Set validation
|
|
5
|
+
* and JWS signature verification use `jose.jwtVerify()`. For an encrypted JWT Claims Set validation
|
|
6
|
+
* and JWE decryption use `jose.jwtDecrypt()`.
|
|
9
7
|
*
|
|
10
8
|
* @example Usage
|
|
9
|
+
*
|
|
11
10
|
* ```js
|
|
12
11
|
* const claims = jose.decodeJwt(token)
|
|
13
12
|
* console.log(claims)
|
|
14
13
|
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param jwt JWT token in compact JWS serialization.
|
|
15
16
|
*/
|
|
16
17
|
export declare function decodeJwt(jwt: string): JWTPayload;
|
|
@@ -3,12 +3,13 @@ export declare type ProtectedHeaderParameters = JWSHeaderParameters & JWEHeaderP
|
|
|
3
3
|
/**
|
|
4
4
|
* Decodes the Protected Header of a JWE/JWS/JWT token utilizing any JOSE serialization.
|
|
5
5
|
*
|
|
6
|
-
* @param token JWE/JWS/JWT token in any JOSE serialization.
|
|
7
|
-
*
|
|
8
6
|
* @example Usage
|
|
7
|
+
*
|
|
9
8
|
* ```js
|
|
10
9
|
* const protectedHeader = jose.decodeProtectedHeader(token)
|
|
11
10
|
* console.log(protectedHeader)
|
|
12
11
|
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param token JWE/JWS/JWT token in any JOSE serialization.
|
|
13
14
|
*/
|
|
14
15
|
export declare function decodeProtectedHeader(token: string | object): ProtectedHeaderParameters;
|
|
@@ -1,53 +1,32 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A generic Error subclass that all other specific
|
|
3
|
-
* JOSE Error subclasses inherit from.
|
|
4
|
-
*/
|
|
1
|
+
/** A generic Error subclass that all other specific JOSE Error subclasses inherit from. */
|
|
5
2
|
export declare class JOSEError extends Error {
|
|
6
|
-
/**
|
|
7
|
-
* A unique error code for the particular error subclass.
|
|
8
|
-
*/
|
|
3
|
+
/** A unique error code for the particular error subclass. */
|
|
9
4
|
static get code(): string;
|
|
10
|
-
/**
|
|
11
|
-
* A unique error code for the particular error subclass.
|
|
12
|
-
*/
|
|
5
|
+
/** A unique error code for the particular error subclass. */
|
|
13
6
|
code: string;
|
|
14
7
|
constructor(message?: string);
|
|
15
8
|
}
|
|
16
|
-
/**
|
|
17
|
-
* An error subclass thrown when a JWT Claim Set member validation fails.
|
|
18
|
-
*/
|
|
9
|
+
/** An error subclass thrown when a JWT Claim Set member validation fails. */
|
|
19
10
|
export declare class JWTClaimValidationFailed extends JOSEError {
|
|
20
11
|
static get code(): 'ERR_JWT_CLAIM_VALIDATION_FAILED';
|
|
21
12
|
code: string;
|
|
22
|
-
/**
|
|
23
|
-
* The Claim for which the validation failed.
|
|
24
|
-
*/
|
|
13
|
+
/** The Claim for which the validation failed. */
|
|
25
14
|
claim: string;
|
|
26
|
-
/**
|
|
27
|
-
* Reason code for the validation failure.
|
|
28
|
-
*/
|
|
15
|
+
/** Reason code for the validation failure. */
|
|
29
16
|
reason: string;
|
|
30
17
|
constructor(message: string, claim?: string, reason?: string);
|
|
31
18
|
}
|
|
32
|
-
/**
|
|
33
|
-
* An error subclass thrown when a JWT is expired.
|
|
34
|
-
*/
|
|
19
|
+
/** An error subclass thrown when a JWT is expired. */
|
|
35
20
|
export declare class JWTExpired extends JOSEError implements JWTClaimValidationFailed {
|
|
36
21
|
static get code(): 'ERR_JWT_EXPIRED';
|
|
37
22
|
code: string;
|
|
38
|
-
/**
|
|
39
|
-
* The Claim for which the validation failed.
|
|
40
|
-
*/
|
|
23
|
+
/** The Claim for which the validation failed. */
|
|
41
24
|
claim: string;
|
|
42
|
-
/**
|
|
43
|
-
* Reason code for the validation failure.
|
|
44
|
-
*/
|
|
25
|
+
/** Reason code for the validation failure. */
|
|
45
26
|
reason: string;
|
|
46
27
|
constructor(message: string, claim?: string, reason?: string);
|
|
47
28
|
}
|
|
48
|
-
/**
|
|
49
|
-
* An error subclass thrown when a JOSE Algorithm is not allowed per developer preference.
|
|
50
|
-
*/
|
|
29
|
+
/** An error subclass thrown when a JOSE Algorithm is not allowed per developer preference. */
|
|
51
30
|
export declare class JOSEAlgNotAllowed extends JOSEError {
|
|
52
31
|
static get code(): 'ERR_JOSE_ALG_NOT_ALLOWED';
|
|
53
32
|
code: string;
|
|
@@ -60,76 +39,56 @@ export declare class JOSENotSupported extends JOSEError {
|
|
|
60
39
|
static get code(): 'ERR_JOSE_NOT_SUPPORTED';
|
|
61
40
|
code: string;
|
|
62
41
|
}
|
|
63
|
-
/**
|
|
64
|
-
* An error subclass thrown when a JWE ciphertext decryption fails.
|
|
65
|
-
*/
|
|
42
|
+
/** An error subclass thrown when a JWE ciphertext decryption fails. */
|
|
66
43
|
export declare class JWEDecryptionFailed extends JOSEError {
|
|
67
44
|
static get code(): 'ERR_JWE_DECRYPTION_FAILED';
|
|
68
45
|
code: string;
|
|
69
46
|
message: string;
|
|
70
47
|
}
|
|
71
|
-
/**
|
|
72
|
-
* An error subclass thrown when a JWE is invalid.
|
|
73
|
-
*/
|
|
48
|
+
/** An error subclass thrown when a JWE is invalid. */
|
|
74
49
|
export declare class JWEInvalid extends JOSEError {
|
|
75
50
|
static get code(): 'ERR_JWE_INVALID';
|
|
76
51
|
code: string;
|
|
77
52
|
}
|
|
78
|
-
/**
|
|
79
|
-
* An error subclass thrown when a JWS is invalid.
|
|
80
|
-
*/
|
|
53
|
+
/** An error subclass thrown when a JWS is invalid. */
|
|
81
54
|
export declare class JWSInvalid extends JOSEError {
|
|
82
55
|
static get code(): 'ERR_JWS_INVALID';
|
|
83
56
|
code: string;
|
|
84
57
|
}
|
|
85
|
-
/**
|
|
86
|
-
* An error subclass thrown when a JWT is invalid.
|
|
87
|
-
*/
|
|
58
|
+
/** An error subclass thrown when a JWT is invalid. */
|
|
88
59
|
export declare class JWTInvalid extends JOSEError {
|
|
89
60
|
static get code(): 'ERR_JWT_INVALID';
|
|
90
61
|
code: string;
|
|
91
62
|
}
|
|
92
|
-
/**
|
|
93
|
-
* An error subclass thrown when a JWK is invalid.
|
|
94
|
-
*/
|
|
63
|
+
/** An error subclass thrown when a JWK is invalid. */
|
|
95
64
|
export declare class JWKInvalid extends JOSEError {
|
|
96
65
|
static get code(): 'ERR_JWK_INVALID';
|
|
97
66
|
code: string;
|
|
98
67
|
}
|
|
99
|
-
/**
|
|
100
|
-
* An error subclass thrown when a JWKS is invalid.
|
|
101
|
-
*/
|
|
68
|
+
/** An error subclass thrown when a JWKS is invalid. */
|
|
102
69
|
export declare class JWKSInvalid extends JOSEError {
|
|
103
70
|
static get code(): 'ERR_JWKS_INVALID';
|
|
104
71
|
code: string;
|
|
105
72
|
}
|
|
106
|
-
/**
|
|
107
|
-
* An error subclass thrown when no keys match from a JWKS.
|
|
108
|
-
*/
|
|
73
|
+
/** An error subclass thrown when no keys match from a JWKS. */
|
|
109
74
|
export declare class JWKSNoMatchingKey extends JOSEError {
|
|
110
75
|
static get code(): 'ERR_JWKS_NO_MATCHING_KEY';
|
|
111
76
|
code: string;
|
|
112
77
|
message: string;
|
|
113
78
|
}
|
|
114
|
-
/**
|
|
115
|
-
* An error subclass thrown when multiple keys match from a JWKS.
|
|
116
|
-
*/
|
|
79
|
+
/** An error subclass thrown when multiple keys match from a JWKS. */
|
|
117
80
|
export declare class JWKSMultipleMatchingKeys extends JOSEError {
|
|
118
81
|
static get code(): 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
|
|
119
82
|
code: string;
|
|
120
83
|
message: string;
|
|
121
84
|
}
|
|
122
|
-
/**
|
|
123
|
-
* Timeout was reached when retrieving the JWKS response.
|
|
124
|
-
*/
|
|
85
|
+
/** Timeout was reached when retrieving the JWKS response. */
|
|
125
86
|
export declare class JWKSTimeout extends JOSEError {
|
|
126
87
|
static get code(): 'ERR_JWKS_TIMEOUT';
|
|
127
88
|
code: string;
|
|
128
89
|
message: string;
|
|
129
90
|
}
|
|
130
|
-
/**
|
|
131
|
-
* An error subclass thrown when JWS signature verification fails.
|
|
132
|
-
*/
|
|
91
|
+
/** An error subclass thrown when JWS signature verification fails. */
|
|
133
92
|
export declare class JWSSignatureVerificationFailed extends JOSEError {
|
|
134
93
|
static get code(): 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';
|
|
135
94
|
code: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jose",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.2",
|
|
4
4
|
"description": "'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK, JWKS with no dependencies using runtime's native crypto",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"browser",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"exports": {
|
|
57
57
|
".": {
|
|
58
58
|
"types": "./dist/types/index.d.ts",
|
|
59
|
+
"deno": "./dist/browser/index.js",
|
|
59
60
|
"browser": "./dist/browser/index.js",
|
|
60
61
|
"worker": "./dist/browser/index.js",
|
|
61
62
|
"import": "./dist/node/esm/index.js",
|
|
@@ -76,5 +77,6 @@
|
|
|
76
77
|
"!dist/node/webcrypto/**/*",
|
|
77
78
|
"!dist/types/runtime/*",
|
|
78
79
|
"!dist/types/lib/*"
|
|
79
|
-
]
|
|
80
|
+
],
|
|
81
|
+
"deno": "./dist/browser/index.js"
|
|
80
82
|
}
|