expresso-macchiato 1.0.0-dev.7 → 1.0.0-dev.8
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -1
- package/dist/index.mjs +4 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -503,7 +503,7 @@ declare class Token<Payload extends Record<string, any> = DefaultTokenPayload> {
|
|
|
503
503
|
private keyStore;
|
|
504
504
|
constructor(tokenPayload: TokenConstructor);
|
|
505
505
|
private getKey;
|
|
506
|
-
authorize(req: Request): Promise<Payload>;
|
|
506
|
+
authorize(req: Request | string): Promise<Payload>;
|
|
507
507
|
private deriveEncryptionKey;
|
|
508
508
|
generateJWE(payload: Payload): Promise<string>;
|
|
509
509
|
verifyJWE(token: string): Promise<Payload>;
|
package/dist/index.d.ts
CHANGED
|
@@ -503,7 +503,7 @@ declare class Token<Payload extends Record<string, any> = DefaultTokenPayload> {
|
|
|
503
503
|
private keyStore;
|
|
504
504
|
constructor(tokenPayload: TokenConstructor);
|
|
505
505
|
private getKey;
|
|
506
|
-
authorize(req: Request): Promise<Payload>;
|
|
506
|
+
authorize(req: Request | string): Promise<Payload>;
|
|
507
507
|
private deriveEncryptionKey;
|
|
508
508
|
generateJWE(payload: Payload): Promise<string>;
|
|
509
509
|
verifyJWE(token: string): Promise<Payload>;
|
package/dist/index.js
CHANGED
|
@@ -906,7 +906,10 @@ var Token = class {
|
|
|
906
906
|
}
|
|
907
907
|
// Metodo per autorizzare una richiesta
|
|
908
908
|
async authorize(req) {
|
|
909
|
-
if (
|
|
909
|
+
if (typeof req === "string") {
|
|
910
|
+
const payload = await this.verifyJWE(req);
|
|
911
|
+
return payload;
|
|
912
|
+
} else if (this.TOKEN_COOKIE_NAME) {
|
|
910
913
|
const rawCookies = _nullishCoalesce(req.headers.cookie, () => ( ""));
|
|
911
914
|
const cookies = _cookie.parse.call(void 0, rawCookies);
|
|
912
915
|
const cookieToken = _nullishCoalesce(cookies[this.TOKEN_COOKIE_NAME], () => ( null));
|
package/dist/index.mjs
CHANGED
|
@@ -906,7 +906,10 @@ var Token = class {
|
|
|
906
906
|
}
|
|
907
907
|
// Metodo per autorizzare una richiesta
|
|
908
908
|
async authorize(req) {
|
|
909
|
-
if (
|
|
909
|
+
if (typeof req === "string") {
|
|
910
|
+
const payload = await this.verifyJWE(req);
|
|
911
|
+
return payload;
|
|
912
|
+
} else if (this.TOKEN_COOKIE_NAME) {
|
|
910
913
|
const rawCookies = req.headers.cookie ?? "";
|
|
911
914
|
const cookies = parse(rawCookies);
|
|
912
915
|
const cookieToken = cookies[this.TOKEN_COOKIE_NAME] ?? null;
|