import {
  safeEqual
} from "./chunk-RQR5RUKG.js";
import {
  base64UrlEncode
} from "./chunk-OD6CXVQX.js";

// src/hmac.ts
import { createHmac } from "crypto";
var Hmac = class {
  #key;
  constructor(key) {
    this.#key = key;
  }
  /**
   * Generate the hmac
   */
  generate(value) {
    return base64UrlEncode(createHmac("sha256", this.#key).update(value).digest());
  }
  /**
   * Compare raw value against an existing hmac
   */
  compare(value, existingHmac) {
    return safeEqual(this.generate(value), existingHmac);
  }
};

export {
  Hmac
};
/*
 * @boringnode/encryption
 *
 * @license MIT
 * @copyright Boring Node
 */
//# sourceMappingURL=chunk-2MF2TUNL.js.map