"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.generateKeyPair = exports.default = exports.WireguardKey = void 0;
var Schema = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/schema/Schema"));
var Function = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Function"));
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./internal/wireguardKey.js"));
function _getRequireWildcardCache(e) {
  if ("function" != typeof WeakMap) return null;
  var r = new WeakMap(),
    t = new WeakMap();
  return (_getRequireWildcardCache = function (e) {
    return e ? t : r;
  })(e);
}
function _interopRequireWildcard(e, r) {
  if (!r && e && e.__esModule) return e;
  if (null === e || "object" != typeof e && "function" != typeof e) return {
    default: e
  };
  var t = _getRequireWildcardCache(r);
  if (t && t.has(e)) return t.get(e);
  var n = {
      __proto__: null
    },
    a = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
    var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
    i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
  }
  return n.default = e, t && t.set(e, n), n;
}
/**
 * Wireguard key schemas and helpers
 *
 * @since 1.0.0
 */

/**
 * A wireguard key, which is a 44 character base64 string.
 *
 * @since 1.0.0
 * @category Schemas
 * @see {@link generateKeyPair}
 *
 * @see https://lists.zx2c4.com/pipermail/wireguard/2020-December/006222.html
 */
const WireguardKey = exports.WireguardKey = /*#__PURE__*/Function.pipe(Schema.string, /*#__PURE__*/Schema.pattern(/^[\d+/A-Za-z]{42}[048AEIMQUYcgkosw]=$/), /*#__PURE__*/Schema.identifier("WireguardKey"), /*#__PURE__*/Schema.description("A wireguard key"), /*#__PURE__*/Schema.brand("WireguardKey"));
/**
 * Generates a wireguard public private key pair.
 *
 * @since 1.0.0
 * @category Crypto
 * @example
 *     import { generateKeyPair } from "the-wireguard-effect/WireguardKey";
 *     const { privateKey, publicKey } = generateKeyPair();
 */
const generateKeyPair = exports.generateKeyPair = internal.generateKeyPair;
var _default = exports.default = WireguardKey;
//# sourceMappingURL=WireguardKey.js.map