@jmlq/auth 0.0.1-alpha.16 → 0.0.1-alpha.18

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.
@@ -88,4 +88,16 @@ export declare class Credential {
88
88
  expiresAt: Date;
89
89
  createdAt?: Date;
90
90
  }): Credential;
91
+ /**
92
+ * Devuelve el refresh token o lanza si no existe.
93
+ *
94
+ * Uso:
95
+ * - Flujos donde el refresh token es OBLIGATORIO
96
+ * (login, refresh/rotación).
97
+ *
98
+ * Seguridad:
99
+ * - Evita usar `!` o cast inseguros.
100
+ * - Hace explícito el invariante del dominio.
101
+ */
102
+ requireRefreshToken(): string;
91
103
  }
@@ -102,5 +102,22 @@ class Credential {
102
102
  createdAt: props.createdAt ?? new Date(),
103
103
  });
104
104
  }
105
+ /**
106
+ * Devuelve el refresh token o lanza si no existe.
107
+ *
108
+ * Uso:
109
+ * - Flujos donde el refresh token es OBLIGATORIO
110
+ * (login, refresh/rotación).
111
+ *
112
+ * Seguridad:
113
+ * - Evita usar `!` o cast inseguros.
114
+ * - Hace explícito el invariante del dominio.
115
+ */
116
+ requireRefreshToken() {
117
+ if (!this._refreshToken) {
118
+ throw new Error("Invariant violation: refreshToken is required but missing");
119
+ }
120
+ return this._refreshToken;
121
+ }
105
122
  }
106
123
  exports.Credential = Credential;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jmlq/auth",
3
3
  "description": "JWT authentication package with clean architecture",
4
- "version": "0.0.1-alpha.16",
4
+ "version": "0.0.1-alpha.18",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {