"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var crypto_exports = {};
__export(crypto_exports, {
  CryptoKeyFormat: () => CryptoKeyFormat,
  SigningKeySpec: () => SigningKeySpec,
  SigningPublicKey: () => SigningPublicKey
});
module.exports = __toCommonJS(crypto_exports);
var import_runtime = require("@protobuf-ts/runtime");
var import_runtime2 = require("@protobuf-ts/runtime");
var import_runtime3 = require("@protobuf-ts/runtime");
var import_runtime4 = require("@protobuf-ts/runtime");
var SigningKeySpec = /* @__PURE__ */ ((SigningKeySpec2) => {
  SigningKeySpec2[SigningKeySpec2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  SigningKeySpec2[SigningKeySpec2["EC_CURVE25519"] = 1] = "EC_CURVE25519";
  SigningKeySpec2[SigningKeySpec2["EC_P256"] = 2] = "EC_P256";
  SigningKeySpec2[SigningKeySpec2["EC_P384"] = 3] = "EC_P384";
  SigningKeySpec2[SigningKeySpec2["EC_SECP256K1"] = 4] = "EC_SECP256K1";
  return SigningKeySpec2;
})(SigningKeySpec || {});
var CryptoKeyFormat = /* @__PURE__ */ ((CryptoKeyFormat2) => {
  CryptoKeyFormat2[CryptoKeyFormat2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  CryptoKeyFormat2[CryptoKeyFormat2["DER"] = 1] = "DER";
  CryptoKeyFormat2[CryptoKeyFormat2["RAW"] = 2] = "RAW";
  CryptoKeyFormat2[CryptoKeyFormat2["DER_X509_SUBJECT_PUBLIC_KEY_INFO"] = 3] = "DER_X509_SUBJECT_PUBLIC_KEY_INFO";
  return CryptoKeyFormat2;
})(CryptoKeyFormat || {});
class SigningPublicKey$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.SigningPublicKey", [
      {
        no: 1,
        name: "format",
        kind: "enum",
        T: () => [
          "com.daml.ledger.api.v2.CryptoKeyFormat",
          CryptoKeyFormat,
          "CRYPTO_KEY_FORMAT_"
        ]
      },
      {
        no: 2,
        name: "key_data",
        kind: "scalar",
        T: 12
      },
      {
        no: 3,
        name: "key_spec",
        kind: "enum",
        T: () => [
          "com.daml.ledger.api.v2.SigningKeySpec",
          SigningKeySpec,
          "SIGNING_KEY_SPEC_"
        ]
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.format = 0;
    message.keyData = new Uint8Array(0);
    message.keySpec = 0;
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.CryptoKeyFormat format */
        1:
          message.format = reader.int32();
          break;
        case /* bytes key_data */
        2:
          message.keyData = reader.bytes();
          break;
        case /* com.daml.ledger.api.v2.SigningKeySpec key_spec */
        3:
          message.keySpec = reader.int32();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.format !== 0)
      writer.tag(1, import_runtime.WireType.Varint).int32(message.format);
    if (message.keyData.length)
      writer.tag(2, import_runtime.WireType.LengthDelimited).bytes(message.keyData);
    if (message.keySpec !== 0)
      writer.tag(3, import_runtime.WireType.Varint).int32(message.keySpec);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const SigningPublicKey = new SigningPublicKey$Type();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  CryptoKeyFormat,
  SigningKeySpec,
  SigningPublicKey
});
//# sourceMappingURL=crypto.cjs.map