vona-module-a-jwt 5.0.22 → 5.0.23
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.js +4 -4
- package/dist/types/jwt.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26,8 +26,8 @@ let ServiceJwtClient = (_dec$4 = Service(), _dec2$4 = BeanInfo({
|
|
|
26
26
|
const configJwt = this.scope.config;
|
|
27
27
|
const configClient = configJwt.clients[clientName];
|
|
28
28
|
if (!configClient) throw new Error(`jwt client not found: ${clientName}`);
|
|
29
|
-
const secret = configJwt.
|
|
30
|
-
this._clientOptions = deepExtend({}, configJwt.
|
|
29
|
+
const secret = configJwt.base.secret ?? this.app.config.server.keys[0];
|
|
30
|
+
this._clientOptions = deepExtend({}, configJwt.base, {
|
|
31
31
|
secret
|
|
32
32
|
}, configClient);
|
|
33
33
|
this._clientName = clientName;
|
|
@@ -104,7 +104,7 @@ let BeanJwt = (_dec$3 = Bean(), _dec2$3 = BeanInfo({
|
|
|
104
104
|
const refreshToken = await this.get('refresh').sign(payloadData, options);
|
|
105
105
|
// expiresIn
|
|
106
106
|
let expiresIn = this.scope.config.clients.access.signOptions.expiresIn;
|
|
107
|
-
if (typeof expiresIn === 'string') expiresIn = ms(expiresIn);
|
|
107
|
+
if (typeof expiresIn === 'string') expiresIn = Math.floor(ms(expiresIn) / 1000);
|
|
108
108
|
// ok
|
|
109
109
|
return {
|
|
110
110
|
accessToken,
|
|
@@ -231,7 +231,7 @@ function config(app) {
|
|
|
231
231
|
expiresIn: 10 * 60
|
|
232
232
|
}
|
|
233
233
|
},
|
|
234
|
-
|
|
234
|
+
base: {
|
|
235
235
|
secret: undefined,
|
|
236
236
|
signOptions: {
|
|
237
237
|
issuer: app.meta.env.APP_NAME
|
package/dist/types/jwt.d.ts
CHANGED