@levrbet/shared 0.1.30 → 0.1.31
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.
|
@@ -1,17 +1,3 @@
|
|
|
1
1
|
import type { NextFunction, Request, Response } from "express";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* This middleware validates Privy access tokens and ID tokens, authenticates users,
|
|
6
|
-
* and sets the authenticated user context on the request object. It supports both
|
|
7
|
-
* User and Admin authentication types.
|
|
8
|
-
*
|
|
9
|
-
* @param type - The authentication type, either "User" or "Admin"
|
|
10
|
-
* @returns An Express middleware function that:
|
|
11
|
-
* - Extracts Privy tokens and ETH address from request headers
|
|
12
|
-
* - Validates the tokens using the appropriate Privy service method
|
|
13
|
-
* - Sets `req.privyUser` and `req.ethAddress` properties on successful authentication
|
|
14
|
-
* - Returns 401 Unauthorized response if authentication fails
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
export declare const privyAuthMiddleware: (type: "User" | "Admin") => (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
2
|
+
export declare const privyUserAuthMiddleware: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
3
|
+
export declare const privyAdminAuthMiddleware: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.privyAdminAuthMiddleware = exports.privyUserAuthMiddleware = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
const constants_1 = require("../../../core/constants");
|
|
6
6
|
const privy_service_1 = require("../privy.service");
|
|
@@ -34,5 +34,6 @@ const privyAuthMiddleware = (type) => {
|
|
|
34
34
|
next();
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
-
exports.
|
|
37
|
+
exports.privyUserAuthMiddleware = privyAuthMiddleware("User");
|
|
38
|
+
exports.privyAdminAuthMiddleware = privyAuthMiddleware("Admin");
|
|
38
39
|
//# sourceMappingURL=privy.middleware.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"privy.middleware.js","sourceRoot":"","sources":["../../../../src/server/auth/middleware/privy.middleware.ts"],"names":[],"mappings":";;;AACA,+BAA4C;AAC5C,uDAA8G;AAC9G,oDAA+C;AAE/C;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"privy.middleware.js","sourceRoot":"","sources":["../../../../src/server/auth/middleware/privy.middleware.ts"],"names":[],"mappings":";;;AACA,+BAA4C;AAC5C,uDAA8G;AAC9G,oDAA+C;AAE/C;;;;;;;;;;;;;;GAcG;AACH,MAAM,mBAAmB,GAAG,CAAC,IAAsB,EAAE,EAAE;IACnD,OAAO,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAiB,EAAE;QAC5E,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,qCAAyB,CAAC,EAAE,QAAQ,EAAE,CAAA;QACrE,MAAM,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC,iCAAqB,CAAC,EAAE,QAAQ,EAAE,CAAA;QACnE,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,8BAAkB,CAAC,EAAE,QAAQ,EAAE,CAAA;QAE9D,MAAM,SAAS,GAAG,MAAM,4BAAY,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,CAAA;QAErG,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAA;YACjD,OAAM;QACV,CAAC;QAED,GAAG,CAAC,SAAS,GAAG,SAAS,CAAA;QACzB,GAAG,CAAC,UAAU,GAAG,UAAU,IAAI,IAAA,gBAAS,EAAC,UAAU,CAAC,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