Rocky_Mountain_Vending/.pnpm-store/v10/files/89/6e85c001cb6ff235e3c6aef8aa093a69948d12096967f777ca05ef10cef27059bec1bdd645205eecefb7b35ded0d57fe4e60f74911b9b9ab8ae8834dbd022a
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

34 lines
1.6 KiB
Text

import { HttpRequest } from "@smithy/protocol-http";
import { HttpApiKeyAuthLocation } from "@smithy/types";
export class HttpApiKeyAuthSigner {
async sign(httpRequest, identity, signingProperties) {
if (!signingProperties) {
throw new Error("request could not be signed with `apiKey` since the `name` and `in` signer properties are missing");
}
if (!signingProperties.name) {
throw new Error("request could not be signed with `apiKey` since the `name` signer property is missing");
}
if (!signingProperties.in) {
throw new Error("request could not be signed with `apiKey` since the `in` signer property is missing");
}
if (!identity.apiKey) {
throw new Error("request could not be signed with `apiKey` since the `apiKey` is not defined");
}
const clonedRequest = HttpRequest.clone(httpRequest);
if (signingProperties.in === HttpApiKeyAuthLocation.QUERY) {
clonedRequest.query[signingProperties.name] = identity.apiKey;
}
else if (signingProperties.in === HttpApiKeyAuthLocation.HEADER) {
clonedRequest.headers[signingProperties.name] = signingProperties.scheme
? `${signingProperties.scheme} ${identity.apiKey}`
: identity.apiKey;
}
else {
throw new Error("request can only be signed with `apiKey` locations `query` or `header`, " +
"but found: `" +
signingProperties.in +
"`");
}
return clonedRequest;
}
}