Rocky_Mountain_Vending/.pnpm-store/v10/files/0c/8d0ce63fb56442055f0ef88665bdaee03a5627e717fe26a9881ac34c5ab70a3559577eebbf2ccf3853626cb92164b067759e8ccbff82f80cdb9c29acff48fb
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

37 lines
1.1 KiB
Text

import { fromArrayBuffer, fromString } from "@smithy/util-buffer-from";
import { toUint8Array } from "@smithy/util-utf8";
import { Buffer } from "buffer";
import { createHash, createHmac } from "crypto";
export class Hash {
algorithmIdentifier;
secret;
hash;
constructor(algorithmIdentifier, secret) {
this.algorithmIdentifier = algorithmIdentifier;
this.secret = secret;
this.reset();
}
update(toHash, encoding) {
this.hash.update(toUint8Array(castSourceData(toHash, encoding)));
}
digest() {
return Promise.resolve(this.hash.digest());
}
reset() {
this.hash = this.secret
? createHmac(this.algorithmIdentifier, castSourceData(this.secret))
: createHash(this.algorithmIdentifier);
}
}
function castSourceData(toCast, encoding) {
if (Buffer.isBuffer(toCast)) {
return toCast;
}
if (typeof toCast === "string") {
return fromString(toCast, encoding);
}
if (ArrayBuffer.isView(toCast)) {
return fromArrayBuffer(toCast.buffer, toCast.byteOffset, toCast.byteLength);
}
return fromArrayBuffer(toCast);
}