Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions dist/middleware/apiKeyMiddleware.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
import { Request, Response, NextFunction } from "express";
export declare const apiKeyMiddleware: (req: Request, res: Response, next: NextFunction) => Promise<void>;
import { AuthenticatedApiKey } from "../types/apiKey.types";
declare global {
namespace Express {
interface Request {
apiKey?: AuthenticatedApiKey;
}
}
}
/**
* `apiKeyAuth()`
*
* Drop this onto any router or individual route that needs
* API-key protection:
*
* router.use(apiKeyAuth()); // protect all verbs
* router.post("/prices", apiKeyAuth(), handler); // just POST
*
* The middleware automatically maps the HTTP method to the
* required scope, so you never have to pass a scope manually.
*/
export declare function apiKeyAuth(): (req: Request, res: Response, next: NextFunction) => Promise<void>;
/** Require the "read" scope explicitly (ignores HTTP method). */
export declare function requireReadScope(): (_req: Request, res: Response, next: NextFunction) => void;
/** Require the "write" scope explicitly (ignores HTTP method). */
export declare function requireWriteScope(): (_req: Request, res: Response, next: NextFunction) => void;
//# sourceMappingURL=apiKeyMiddleware.d.ts.map
Loading