@jmlq/auth-plugin-jose 0.0.1-alpha.11 → 0.0.1-alpha.12
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.
|
@@ -36,17 +36,19 @@ const JOSE_NAME_TO_AUTH_CODE = {
|
|
|
36
36
|
JWTExpired: "TOKEN_EXPIRED",
|
|
37
37
|
JWTNotBefore: "TOKEN_NOT_YET_VALID",
|
|
38
38
|
JWTNotYetValid: "TOKEN_NOT_YET_VALID",
|
|
39
|
-
// Tiempo
|
|
40
|
-
JWSSignatureVerificationFailed: "SIGNATURE_INVALID",
|
|
41
|
-
JWSInvalid: "SIGNATURE_INVALID",
|
|
42
|
-
JWSError: "SIGNATURE_INVALID",
|
|
43
39
|
// Firma
|
|
40
|
+
JWSSignatureVerificationFailed: "SIGNATURE_INVALID",
|
|
41
|
+
// Estructura/serialización JWS inválida
|
|
42
|
+
JWSInvalid: "TOKEN_MALFORMED",
|
|
43
|
+
JWSMalformed: "TOKEN_MALFORMED",
|
|
44
|
+
// Error genérico JWS (no asumir firma)
|
|
45
|
+
JWSError: "TOKEN_INVALID",
|
|
46
|
+
// Claims inválidos (issuer, exp, nbf, etc. dependiendo de jose)
|
|
44
47
|
JWTClaimValidationFailed: "CLAIMS_VALIDATION_ERROR",
|
|
45
|
-
//
|
|
48
|
+
// Token inválido (pero no necesariamente “malformed”)
|
|
46
49
|
JWTInvalid: "TOKEN_INVALID",
|
|
47
|
-
// Token
|
|
50
|
+
// Token malformado
|
|
48
51
|
JWTMalformed: "TOKEN_MALFORMED",
|
|
49
|
-
JWSMalformed: "TOKEN_MALFORMED",
|
|
50
52
|
JOSEError: "TOKEN_MALFORMED",
|
|
51
53
|
// Algoritmo / soporte
|
|
52
54
|
JOSENotSupported: "ALGORITHM_UNSUPPORTED",
|
|
@@ -85,14 +87,14 @@ function mapJoseErrorToAuthError(err, ctx) {
|
|
|
85
87
|
const message = AUTH_CODE_TO_MESSAGE[code] ??
|
|
86
88
|
// fallback defensivo (no dependemos de message de jose)
|
|
87
89
|
"JWT operation failed";
|
|
88
|
-
console.log({
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
});
|
|
90
|
+
// console.log({
|
|
91
|
+
// package: "@jmlq/auth-plugin-jose",
|
|
92
|
+
// name,
|
|
93
|
+
// meta,
|
|
94
|
+
// code,
|
|
95
|
+
// message,
|
|
96
|
+
// err,
|
|
97
|
+
// });
|
|
96
98
|
return {
|
|
97
99
|
code,
|
|
98
100
|
message,
|
|
@@ -101,6 +103,7 @@ function mapJoseErrorToAuthError(err, ctx) {
|
|
|
101
103
|
};
|
|
102
104
|
}
|
|
103
105
|
function toAuthDomainError(createAuthError, err, ctx) {
|
|
106
|
+
// Si ya es error del core, conservarlo (NO remapear)
|
|
104
107
|
if (auth_1.AuthDomainError.isAuthError(err)) {
|
|
105
108
|
return err;
|
|
106
109
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jmlq/auth-plugin-jose",
|
|
3
3
|
"description": "Infrastructure plugin that integrates the jose library with @jmlq/auth, providing JWT token generation and verification following Clean Architecture principles.",
|
|
4
|
-
"version": "0.0.1-alpha.
|
|
4
|
+
"version": "0.0.1-alpha.12",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"author": "MLahuasi",
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@jmlq/auth": "^0.0.1-alpha.
|
|
32
|
+
"@jmlq/auth": "^0.0.1-alpha.33",
|
|
33
33
|
"jose": "^6.1.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|