@rdyl/node-koa-controller 0.1.8 → 0.1.9
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/CHANGELOG.md
CHANGED
|
@@ -114,7 +114,7 @@ var JwtTokens = /** @class */ (function () {
|
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
116
|
};
|
|
117
|
-
JwtTokens.prototype.
|
|
117
|
+
JwtTokens.prototype.create = function (data) {
|
|
118
118
|
var token = this.encode(data);
|
|
119
119
|
var created = new Date().getTime();
|
|
120
120
|
var item = {
|
|
@@ -152,6 +152,10 @@ var JwtSecretGateway = /** @class */ (function () {
|
|
|
152
152
|
});
|
|
153
153
|
});
|
|
154
154
|
};
|
|
155
|
+
JwtSecretGateway.prototype.authorize = function (data) {
|
|
156
|
+
var token = this._jwtToken.create(data);
|
|
157
|
+
return token;
|
|
158
|
+
};
|
|
155
159
|
return JwtSecretGateway;
|
|
156
160
|
}());
|
|
157
161
|
exports.JwtSecretGateway = JwtSecretGateway;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ declare class JwtTokens<T> {
|
|
|
9
9
|
removeBy(t: string): void;
|
|
10
10
|
find(t: string): JwtTokenItem<T> | null;
|
|
11
11
|
get(token: string): Promise<JwtResData<T>>;
|
|
12
|
-
|
|
12
|
+
create(data: T): string;
|
|
13
13
|
}
|
|
14
14
|
export declare class JwtSecretGateway<T extends object> {
|
|
15
15
|
headerName: string;
|
|
@@ -19,6 +19,7 @@ export declare class JwtSecretGateway<T extends object> {
|
|
|
19
19
|
duration?: number;
|
|
20
20
|
});
|
|
21
21
|
use(ctx: KoaCtx): Promise<JwtResData<T>>;
|
|
22
|
+
authorize(data: T): string;
|
|
22
23
|
}
|
|
23
24
|
export interface JwtTokenItem<T> {
|
|
24
25
|
token: string;
|