import { WireType } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
var HashAlgorithm = /* @__PURE__ */ ((HashAlgorithm2) => {
  HashAlgorithm2[HashAlgorithm2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  HashAlgorithm2[HashAlgorithm2["SHA256"] = 1] = "SHA256";
  return HashAlgorithm2;
})(HashAlgorithm || {});
var HmacAlgorithm = /* @__PURE__ */ ((HmacAlgorithm2) => {
  HmacAlgorithm2[HmacAlgorithm2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  HmacAlgorithm2[HmacAlgorithm2["HMAC_SHA256"] = 1] = "HMAC_SHA256";
  return HmacAlgorithm2;
})(HmacAlgorithm || {});
var SignatureFormat = /* @__PURE__ */ ((SignatureFormat2) => {
  SignatureFormat2[SignatureFormat2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  SignatureFormat2[SignatureFormat2["RAW"] = 1] = "RAW";
  SignatureFormat2[SignatureFormat2["DER"] = 2] = "DER";
  SignatureFormat2[SignatureFormat2["CONCAT"] = 3] = "CONCAT";
  SignatureFormat2[SignatureFormat2["SYMBOLIC"] = 1e4] = "SYMBOLIC";
  return SignatureFormat2;
})(SignatureFormat || {});
var EncryptionKeySpec = /* @__PURE__ */ ((EncryptionKeySpec2) => {
  EncryptionKeySpec2[EncryptionKeySpec2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  EncryptionKeySpec2[EncryptionKeySpec2["EC_P256"] = 1] = "EC_P256";
  EncryptionKeySpec2[EncryptionKeySpec2["RSA_2048"] = 2] = "RSA_2048";
  return EncryptionKeySpec2;
})(EncryptionKeySpec || {});
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 KeyPurpose = /* @__PURE__ */ ((KeyPurpose2) => {
  KeyPurpose2[KeyPurpose2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  KeyPurpose2[KeyPurpose2["SIGNING"] = 1] = "SIGNING";
  KeyPurpose2[KeyPurpose2["ENCRYPTION"] = 2] = "ENCRYPTION";
  return KeyPurpose2;
})(KeyPurpose || {});
var SigningKeyUsage = /* @__PURE__ */ ((SigningKeyUsage2) => {
  SigningKeyUsage2[SigningKeyUsage2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  SigningKeyUsage2[SigningKeyUsage2["NAMESPACE"] = 1] = "NAMESPACE";
  SigningKeyUsage2[SigningKeyUsage2["IDENTITY_DELEGATION"] = 2] = "IDENTITY_DELEGATION";
  SigningKeyUsage2[SigningKeyUsage2["SEQUENCER_AUTHENTICATION"] = 3] = "SEQUENCER_AUTHENTICATION";
  SigningKeyUsage2[SigningKeyUsage2["PROTOCOL"] = 4] = "PROTOCOL";
  SigningKeyUsage2[SigningKeyUsage2["PROOF_OF_OWNERSHIP"] = 5] = "PROOF_OF_OWNERSHIP";
  return SigningKeyUsage2;
})(SigningKeyUsage || {});
var SigningAlgorithmSpec = /* @__PURE__ */ ((SigningAlgorithmSpec2) => {
  SigningAlgorithmSpec2[SigningAlgorithmSpec2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  SigningAlgorithmSpec2[SigningAlgorithmSpec2["ED25519"] = 1] = "ED25519";
  SigningAlgorithmSpec2[SigningAlgorithmSpec2["EC_DSA_SHA_256"] = 2] = "EC_DSA_SHA_256";
  SigningAlgorithmSpec2[SigningAlgorithmSpec2["EC_DSA_SHA_384"] = 3] = "EC_DSA_SHA_384";
  return SigningAlgorithmSpec2;
})(SigningAlgorithmSpec || {});
var SigningKeyScheme = /* @__PURE__ */ ((SigningKeyScheme2) => {
  SigningKeyScheme2[SigningKeyScheme2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  SigningKeyScheme2[SigningKeyScheme2["ED25519"] = 1] = "ED25519";
  SigningKeyScheme2[SigningKeyScheme2["EC_DSA_P256"] = 2] = "EC_DSA_P256";
  SigningKeyScheme2[SigningKeyScheme2["EC_DSA_P384"] = 3] = "EC_DSA_P384";
  return SigningKeyScheme2;
})(SigningKeyScheme || {});
var EncryptionAlgorithmSpec = /* @__PURE__ */ ((EncryptionAlgorithmSpec2) => {
  EncryptionAlgorithmSpec2[EncryptionAlgorithmSpec2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  EncryptionAlgorithmSpec2[EncryptionAlgorithmSpec2["ECIES_HKDF_HMAC_SHA256_AES128GCM"] = 1] = "ECIES_HKDF_HMAC_SHA256_AES128GCM";
  EncryptionAlgorithmSpec2[EncryptionAlgorithmSpec2["ECIES_HKDF_HMAC_SHA256_AES128CBC"] = 2] = "ECIES_HKDF_HMAC_SHA256_AES128CBC";
  EncryptionAlgorithmSpec2[EncryptionAlgorithmSpec2["RSA_OAEP_SHA256"] = 3] = "RSA_OAEP_SHA256";
  return EncryptionAlgorithmSpec2;
})(EncryptionAlgorithmSpec || {});
var EncryptionKeyScheme = /* @__PURE__ */ ((EncryptionKeyScheme2) => {
  EncryptionKeyScheme2[EncryptionKeyScheme2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  EncryptionKeyScheme2[EncryptionKeyScheme2["ECIES_P256_HKDF_HMAC_SHA256_AES128GCM"] = 1] = "ECIES_P256_HKDF_HMAC_SHA256_AES128GCM";
  EncryptionKeyScheme2[EncryptionKeyScheme2["ECIES_P256_HMAC_SHA256A_ES128CBC"] = 2] = "ECIES_P256_HMAC_SHA256A_ES128CBC";
  EncryptionKeyScheme2[EncryptionKeyScheme2["RSA2048_OAEP_SHA256"] = 3] = "RSA2048_OAEP_SHA256";
  return EncryptionKeyScheme2;
})(EncryptionKeyScheme || {});
var SymmetricKeyScheme = /* @__PURE__ */ ((SymmetricKeyScheme2) => {
  SymmetricKeyScheme2[SymmetricKeyScheme2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  SymmetricKeyScheme2[SymmetricKeyScheme2["AES128GCM"] = 1] = "AES128GCM";
  return SymmetricKeyScheme2;
})(SymmetricKeyScheme || {});
var CryptoKeyFormat = /* @__PURE__ */ ((CryptoKeyFormat2) => {
  CryptoKeyFormat2[CryptoKeyFormat2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  CryptoKeyFormat2[CryptoKeyFormat2["DER"] = 2] = "DER";
  CryptoKeyFormat2[CryptoKeyFormat2["RAW"] = 3] = "RAW";
  CryptoKeyFormat2[CryptoKeyFormat2["DER_X509_SUBJECT_PUBLIC_KEY_INFO"] = 4] = "DER_X509_SUBJECT_PUBLIC_KEY_INFO";
  CryptoKeyFormat2[CryptoKeyFormat2["DER_PKCS8_PRIVATE_KEY_INFO"] = 5] = "DER_PKCS8_PRIVATE_KEY_INFO";
  CryptoKeyFormat2[CryptoKeyFormat2["SYMBOLIC"] = 1e4] = "SYMBOLIC";
  return CryptoKeyFormat2;
})(CryptoKeyFormat || {});
var PbkdfScheme = /* @__PURE__ */ ((PbkdfScheme2) => {
  PbkdfScheme2[PbkdfScheme2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  PbkdfScheme2[PbkdfScheme2["ARGON2ID_MODE1"] = 1] = "ARGON2ID_MODE1";
  return PbkdfScheme2;
})(PbkdfScheme || {});
class Hmac$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.Hmac", [
      {
        no: 1,
        name: "algorithm",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.HmacAlgorithm",
          HmacAlgorithm,
          "HMAC_ALGORITHM_"
        ]
      },
      {
        no: 2,
        name: "hmac",
        kind: "scalar",
        T: 12
        /*ScalarType.BYTES*/
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.algorithm = 0;
    message.hmac = new Uint8Array(0);
    if (value !== void 0)
      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.digitalasset.canton.crypto.v30.HmacAlgorithm algorithm */
        1:
          message.algorithm = reader.int32();
          break;
        case /* bytes hmac */
        2:
          message.hmac = reader.bytes();
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.algorithm !== 0)
      writer.tag(1, WireType.Varint).int32(message.algorithm);
    if (message.hmac.length)
      writer.tag(2, WireType.LengthDelimited).bytes(message.hmac);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const Hmac = new Hmac$Type();
class Salt$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.Salt", [
      {
        no: 1,
        name: "hmac",
        kind: "enum",
        oneof: "algorithm",
        T: () => [
          "com.digitalasset.canton.crypto.v30.HmacAlgorithm",
          HmacAlgorithm,
          "HMAC_ALGORITHM_"
        ]
      },
      {
        no: 2,
        name: "salt",
        kind: "scalar",
        T: 12
        /*ScalarType.BYTES*/
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.algorithm = { oneofKind: void 0 };
    message.salt = new Uint8Array(0);
    if (value !== void 0)
      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.digitalasset.canton.crypto.v30.HmacAlgorithm hmac */
        1:
          message.algorithm = {
            oneofKind: "hmac",
            hmac: reader.int32()
          };
          break;
        case /* bytes salt */
        2:
          message.salt = reader.bytes();
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.algorithm.oneofKind === "hmac")
      writer.tag(1, WireType.Varint).int32(message.algorithm.hmac);
    if (message.salt.length)
      writer.tag(2, WireType.LengthDelimited).bytes(message.salt);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const Salt = new Salt$Type();
class Signature$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.Signature", [
      {
        no: 1,
        name: "format",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.SignatureFormat",
          SignatureFormat,
          "SIGNATURE_FORMAT_"
        ]
      },
      {
        no: 2,
        name: "signature",
        kind: "scalar",
        T: 12
      },
      {
        no: 3,
        name: "signed_by",
        kind: "scalar",
        T: 9
      },
      {
        no: 4,
        name: "signing_algorithm_spec",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.SigningAlgorithmSpec",
          SigningAlgorithmSpec,
          "SIGNING_ALGORITHM_SPEC_"
        ]
      },
      {
        no: 5,
        name: "signature_delegation",
        kind: "message",
        T: () => SignatureDelegation
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.format = 0;
    message.signature = new Uint8Array(0);
    message.signedBy = "";
    message.signingAlgorithmSpec = 0;
    if (value !== void 0)
      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.digitalasset.canton.crypto.v30.SignatureFormat format */
        1:
          message.format = reader.int32();
          break;
        case /* bytes signature */
        2:
          message.signature = reader.bytes();
          break;
        case /* string signed_by */
        3:
          message.signedBy = reader.string();
          break;
        case /* com.digitalasset.canton.crypto.v30.SigningAlgorithmSpec signing_algorithm_spec */
        4:
          message.signingAlgorithmSpec = reader.int32();
          break;
        case /* optional com.digitalasset.canton.crypto.v30.SignatureDelegation signature_delegation */
        5:
          message.signatureDelegation = SignatureDelegation.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.signatureDelegation
          );
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.format !== 0)
      writer.tag(1, WireType.Varint).int32(message.format);
    if (message.signature.length)
      writer.tag(2, WireType.LengthDelimited).bytes(message.signature);
    if (message.signedBy !== "")
      writer.tag(3, WireType.LengthDelimited).string(message.signedBy);
    if (message.signingAlgorithmSpec !== 0)
      writer.tag(4, WireType.Varint).int32(message.signingAlgorithmSpec);
    if (message.signatureDelegation)
      SignatureDelegation.internalBinaryWrite(
        message.signatureDelegation,
        writer.tag(5, WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const Signature = new Signature$Type();
class SignatureDelegation$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.SignatureDelegation", [
      {
        no: 1,
        name: "session_key",
        kind: "scalar",
        T: 12
      },
      {
        no: 2,
        name: "session_key_spec",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.SigningKeySpec",
          SigningKeySpec,
          "SIGNING_KEY_SPEC_"
        ]
      },
      {
        no: 3,
        name: "validity_period_from_inclusive",
        kind: "scalar",
        T: 3,
        L: 0
      },
      {
        no: 4,
        name: "validity_period_duration_seconds",
        kind: "scalar",
        T: 13
      },
      {
        no: 5,
        name: "format",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.SignatureFormat",
          SignatureFormat,
          "SIGNATURE_FORMAT_"
        ]
      },
      {
        no: 6,
        name: "signature",
        kind: "scalar",
        T: 12
      },
      {
        no: 7,
        name: "signing_algorithm_spec",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.SigningAlgorithmSpec",
          SigningAlgorithmSpec,
          "SIGNING_ALGORITHM_SPEC_"
        ]
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.sessionKey = new Uint8Array(0);
    message.sessionKeySpec = 0;
    message.validityPeriodFromInclusive = 0n;
    message.validityPeriodDurationSeconds = 0;
    message.format = 0;
    message.signature = new Uint8Array(0);
    message.signingAlgorithmSpec = 0;
    if (value !== void 0)
      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 /* bytes session_key */
        1:
          message.sessionKey = reader.bytes();
          break;
        case /* com.digitalasset.canton.crypto.v30.SigningKeySpec session_key_spec */
        2:
          message.sessionKeySpec = reader.int32();
          break;
        case /* int64 validity_period_from_inclusive */
        3:
          message.validityPeriodFromInclusive = reader.int64().toBigInt();
          break;
        case /* uint32 validity_period_duration_seconds */
        4:
          message.validityPeriodDurationSeconds = reader.uint32();
          break;
        case /* com.digitalasset.canton.crypto.v30.SignatureFormat format */
        5:
          message.format = reader.int32();
          break;
        case /* bytes signature */
        6:
          message.signature = reader.bytes();
          break;
        case /* com.digitalasset.canton.crypto.v30.SigningAlgorithmSpec signing_algorithm_spec */
        7:
          message.signingAlgorithmSpec = 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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.sessionKey.length)
      writer.tag(1, WireType.LengthDelimited).bytes(message.sessionKey);
    if (message.sessionKeySpec !== 0)
      writer.tag(2, WireType.Varint).int32(message.sessionKeySpec);
    if (message.validityPeriodFromInclusive !== 0n)
      writer.tag(3, WireType.Varint).int64(message.validityPeriodFromInclusive);
    if (message.validityPeriodDurationSeconds !== 0)
      writer.tag(4, WireType.Varint).uint32(message.validityPeriodDurationSeconds);
    if (message.format !== 0)
      writer.tag(5, WireType.Varint).int32(message.format);
    if (message.signature.length)
      writer.tag(6, WireType.LengthDelimited).bytes(message.signature);
    if (message.signingAlgorithmSpec !== 0)
      writer.tag(7, WireType.Varint).int32(message.signingAlgorithmSpec);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const SignatureDelegation = new SignatureDelegation$Type();
class PublicKey$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.PublicKey", [
      {
        no: 1,
        name: "signing_public_key",
        kind: "message",
        oneof: "key",
        T: () => SigningPublicKey
      },
      {
        no: 2,
        name: "encryption_public_key",
        kind: "message",
        oneof: "key",
        T: () => EncryptionPublicKey
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.key = { oneofKind: void 0 };
    if (value !== void 0)
      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.digitalasset.canton.crypto.v30.SigningPublicKey signing_public_key */
        1:
          message.key = {
            oneofKind: "signingPublicKey",
            signingPublicKey: SigningPublicKey.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.key.signingPublicKey
            )
          };
          break;
        case /* com.digitalasset.canton.crypto.v30.EncryptionPublicKey encryption_public_key */
        2:
          message.key = {
            oneofKind: "encryptionPublicKey",
            encryptionPublicKey: EncryptionPublicKey.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.key.encryptionPublicKey
            )
          };
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.key.oneofKind === "signingPublicKey")
      SigningPublicKey.internalBinaryWrite(
        message.key.signingPublicKey,
        writer.tag(1, WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.key.oneofKind === "encryptionPublicKey")
      EncryptionPublicKey.internalBinaryWrite(
        message.key.encryptionPublicKey,
        writer.tag(2, WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const PublicKey = new PublicKey$Type();
class PublicKeyWithName$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.PublicKeyWithName", [
      { no: 1, name: "public_key", kind: "message", T: () => PublicKey },
      {
        no: 2,
        name: "name",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.name = "";
    if (value !== void 0)
      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.digitalasset.canton.crypto.v30.PublicKey public_key */
        1:
          message.publicKey = PublicKey.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.publicKey
          );
          break;
        case /* string name */
        2:
          message.name = reader.string();
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.publicKey)
      PublicKey.internalBinaryWrite(
        message.publicKey,
        writer.tag(1, WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.name !== "")
      writer.tag(2, WireType.LengthDelimited).string(message.name);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const PublicKeyWithName = new PublicKeyWithName$Type();
class PrivateKey$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.PrivateKey", [
      {
        no: 1,
        name: "signing_private_key",
        kind: "message",
        oneof: "key",
        T: () => SigningPrivateKey
      },
      {
        no: 2,
        name: "encryption_private_key",
        kind: "message",
        oneof: "key",
        T: () => EncryptionPrivateKey
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.key = { oneofKind: void 0 };
    if (value !== void 0)
      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.digitalasset.canton.crypto.v30.SigningPrivateKey signing_private_key */
        1:
          message.key = {
            oneofKind: "signingPrivateKey",
            signingPrivateKey: SigningPrivateKey.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.key.signingPrivateKey
            )
          };
          break;
        case /* com.digitalasset.canton.crypto.v30.EncryptionPrivateKey encryption_private_key */
        2:
          message.key = {
            oneofKind: "encryptionPrivateKey",
            encryptionPrivateKey: EncryptionPrivateKey.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.key.encryptionPrivateKey
            )
          };
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.key.oneofKind === "signingPrivateKey")
      SigningPrivateKey.internalBinaryWrite(
        message.key.signingPrivateKey,
        writer.tag(1, WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.key.oneofKind === "encryptionPrivateKey")
      EncryptionPrivateKey.internalBinaryWrite(
        message.key.encryptionPrivateKey,
        writer.tag(2, WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const PrivateKey = new PrivateKey$Type();
class SigningPublicKey$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.SigningPublicKey", [
      {
        no: 2,
        name: "format",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.CryptoKeyFormat",
          CryptoKeyFormat,
          "CRYPTO_KEY_FORMAT_"
        ]
      },
      {
        no: 3,
        name: "public_key",
        kind: "scalar",
        T: 12
      },
      {
        no: 4,
        name: "scheme",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.SigningKeyScheme",
          SigningKeyScheme,
          "SIGNING_KEY_SCHEME_"
        ]
      },
      {
        no: 5,
        name: "usage",
        kind: "enum",
        repeat: 1,
        T: () => [
          "com.digitalasset.canton.crypto.v30.SigningKeyUsage",
          SigningKeyUsage,
          "SIGNING_KEY_USAGE_"
        ]
      },
      {
        no: 6,
        name: "key_spec",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.SigningKeySpec",
          SigningKeySpec,
          "SIGNING_KEY_SPEC_"
        ]
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.format = 0;
    message.publicKey = new Uint8Array(0);
    message.scheme = 0;
    message.usage = [];
    message.keySpec = 0;
    if (value !== void 0)
      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.digitalasset.canton.crypto.v30.CryptoKeyFormat format */
        2:
          message.format = reader.int32();
          break;
        case /* bytes public_key */
        3:
          message.publicKey = reader.bytes();
          break;
        case /* com.digitalasset.canton.crypto.v30.SigningKeyScheme scheme = 4 [deprecated = true] */
        4:
          message.scheme = reader.int32();
          break;
        case /* repeated com.digitalasset.canton.crypto.v30.SigningKeyUsage usage */
        5:
          if (wireType === WireType.LengthDelimited)
            for (let e = reader.int32() + reader.pos; reader.pos < e; )
              message.usage.push(reader.int32());
          else message.usage.push(reader.int32());
          break;
        case /* com.digitalasset.canton.crypto.v30.SigningKeySpec key_spec */
        6:
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.format !== 0)
      writer.tag(2, WireType.Varint).int32(message.format);
    if (message.publicKey.length)
      writer.tag(3, WireType.LengthDelimited).bytes(message.publicKey);
    if (message.scheme !== 0)
      writer.tag(4, WireType.Varint).int32(message.scheme);
    if (message.usage.length) {
      writer.tag(5, WireType.LengthDelimited).fork();
      for (let i = 0; i < message.usage.length; i++)
        writer.int32(message.usage[i]);
      writer.join();
    }
    if (message.keySpec !== 0)
      writer.tag(6, WireType.Varint).int32(message.keySpec);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const SigningPublicKey = new SigningPublicKey$Type();
class SigningPrivateKey$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.SigningPrivateKey", [
      {
        no: 1,
        name: "id",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      {
        no: 2,
        name: "format",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.CryptoKeyFormat",
          CryptoKeyFormat,
          "CRYPTO_KEY_FORMAT_"
        ]
      },
      {
        no: 3,
        name: "private_key",
        kind: "scalar",
        T: 12
      },
      {
        no: 4,
        name: "scheme",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.SigningKeyScheme",
          SigningKeyScheme,
          "SIGNING_KEY_SCHEME_"
        ]
      },
      {
        no: 5,
        name: "usage",
        kind: "enum",
        repeat: 1,
        T: () => [
          "com.digitalasset.canton.crypto.v30.SigningKeyUsage",
          SigningKeyUsage,
          "SIGNING_KEY_USAGE_"
        ]
      },
      {
        no: 6,
        name: "key_spec",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.SigningKeySpec",
          SigningKeySpec,
          "SIGNING_KEY_SPEC_"
        ]
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.id = "";
    message.format = 0;
    message.privateKey = new Uint8Array(0);
    message.scheme = 0;
    message.usage = [];
    message.keySpec = 0;
    if (value !== void 0)
      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 /* string id */
        1:
          message.id = reader.string();
          break;
        case /* com.digitalasset.canton.crypto.v30.CryptoKeyFormat format */
        2:
          message.format = reader.int32();
          break;
        case /* bytes private_key */
        3:
          message.privateKey = reader.bytes();
          break;
        case /* com.digitalasset.canton.crypto.v30.SigningKeyScheme scheme = 4 [deprecated = true] */
        4:
          message.scheme = reader.int32();
          break;
        case /* repeated com.digitalasset.canton.crypto.v30.SigningKeyUsage usage */
        5:
          if (wireType === WireType.LengthDelimited)
            for (let e = reader.int32() + reader.pos; reader.pos < e; )
              message.usage.push(reader.int32());
          else message.usage.push(reader.int32());
          break;
        case /* com.digitalasset.canton.crypto.v30.SigningKeySpec key_spec */
        6:
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.id !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.id);
    if (message.format !== 0)
      writer.tag(2, WireType.Varint).int32(message.format);
    if (message.privateKey.length)
      writer.tag(3, WireType.LengthDelimited).bytes(message.privateKey);
    if (message.scheme !== 0)
      writer.tag(4, WireType.Varint).int32(message.scheme);
    if (message.usage.length) {
      writer.tag(5, WireType.LengthDelimited).fork();
      for (let i = 0; i < message.usage.length; i++)
        writer.int32(message.usage[i]);
      writer.join();
    }
    if (message.keySpec !== 0)
      writer.tag(6, WireType.Varint).int32(message.keySpec);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const SigningPrivateKey = new SigningPrivateKey$Type();
class SigningKeyPair$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.SigningKeyPair", [
      {
        no: 1,
        name: "public_key",
        kind: "message",
        T: () => SigningPublicKey
      },
      {
        no: 2,
        name: "private_key",
        kind: "message",
        T: () => SigningPrivateKey
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      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.digitalasset.canton.crypto.v30.SigningPublicKey public_key */
        1:
          message.publicKey = SigningPublicKey.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.publicKey
          );
          break;
        case /* com.digitalasset.canton.crypto.v30.SigningPrivateKey private_key */
        2:
          message.privateKey = SigningPrivateKey.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.privateKey
          );
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.publicKey)
      SigningPublicKey.internalBinaryWrite(
        message.publicKey,
        writer.tag(1, WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.privateKey)
      SigningPrivateKey.internalBinaryWrite(
        message.privateKey,
        writer.tag(2, WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const SigningKeyPair = new SigningKeyPair$Type();
class RequiredSigningSpecs$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.RequiredSigningSpecs", [
      {
        no: 1,
        name: "algorithms",
        kind: "enum",
        repeat: 1,
        T: () => [
          "com.digitalasset.canton.crypto.v30.SigningAlgorithmSpec",
          SigningAlgorithmSpec,
          "SIGNING_ALGORITHM_SPEC_"
        ]
      },
      {
        no: 2,
        name: "keys",
        kind: "enum",
        repeat: 1,
        T: () => [
          "com.digitalasset.canton.crypto.v30.SigningKeySpec",
          SigningKeySpec,
          "SIGNING_KEY_SPEC_"
        ]
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.algorithms = [];
    message.keys = [];
    if (value !== void 0)
      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 /* repeated com.digitalasset.canton.crypto.v30.SigningAlgorithmSpec algorithms */
        1:
          if (wireType === WireType.LengthDelimited)
            for (let e = reader.int32() + reader.pos; reader.pos < e; )
              message.algorithms.push(reader.int32());
          else message.algorithms.push(reader.int32());
          break;
        case /* repeated com.digitalasset.canton.crypto.v30.SigningKeySpec keys */
        2:
          if (wireType === WireType.LengthDelimited)
            for (let e = reader.int32() + reader.pos; reader.pos < e; )
              message.keys.push(reader.int32());
          else message.keys.push(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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.algorithms.length) {
      writer.tag(1, WireType.LengthDelimited).fork();
      for (let i = 0; i < message.algorithms.length; i++)
        writer.int32(message.algorithms[i]);
      writer.join();
    }
    if (message.keys.length) {
      writer.tag(2, WireType.LengthDelimited).fork();
      for (let i = 0; i < message.keys.length; i++)
        writer.int32(message.keys[i]);
      writer.join();
    }
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const RequiredSigningSpecs = new RequiredSigningSpecs$Type();
class EncryptionPublicKey$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.EncryptionPublicKey", [
      {
        no: 2,
        name: "format",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.CryptoKeyFormat",
          CryptoKeyFormat,
          "CRYPTO_KEY_FORMAT_"
        ]
      },
      {
        no: 3,
        name: "public_key",
        kind: "scalar",
        T: 12
      },
      {
        no: 4,
        name: "scheme",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.EncryptionKeyScheme",
          EncryptionKeyScheme,
          "ENCRYPTION_KEY_SCHEME_"
        ]
      },
      {
        no: 5,
        name: "key_spec",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.EncryptionKeySpec",
          EncryptionKeySpec,
          "ENCRYPTION_KEY_SPEC_"
        ]
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.format = 0;
    message.publicKey = new Uint8Array(0);
    message.scheme = 0;
    message.keySpec = 0;
    if (value !== void 0)
      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.digitalasset.canton.crypto.v30.CryptoKeyFormat format */
        2:
          message.format = reader.int32();
          break;
        case /* bytes public_key */
        3:
          message.publicKey = reader.bytes();
          break;
        case /* com.digitalasset.canton.crypto.v30.EncryptionKeyScheme scheme = 4 [deprecated = true] */
        4:
          message.scheme = reader.int32();
          break;
        case /* com.digitalasset.canton.crypto.v30.EncryptionKeySpec key_spec */
        5:
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.format !== 0)
      writer.tag(2, WireType.Varint).int32(message.format);
    if (message.publicKey.length)
      writer.tag(3, WireType.LengthDelimited).bytes(message.publicKey);
    if (message.scheme !== 0)
      writer.tag(4, WireType.Varint).int32(message.scheme);
    if (message.keySpec !== 0)
      writer.tag(5, WireType.Varint).int32(message.keySpec);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const EncryptionPublicKey = new EncryptionPublicKey$Type();
class EncryptionPrivateKey$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.EncryptionPrivateKey", [
      {
        no: 1,
        name: "id",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      {
        no: 2,
        name: "format",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.CryptoKeyFormat",
          CryptoKeyFormat,
          "CRYPTO_KEY_FORMAT_"
        ]
      },
      {
        no: 3,
        name: "private_key",
        kind: "scalar",
        T: 12
      },
      {
        no: 4,
        name: "scheme",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.EncryptionKeyScheme",
          EncryptionKeyScheme,
          "ENCRYPTION_KEY_SCHEME_"
        ]
      },
      {
        no: 5,
        name: "key_spec",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.EncryptionKeySpec",
          EncryptionKeySpec,
          "ENCRYPTION_KEY_SPEC_"
        ]
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.id = "";
    message.format = 0;
    message.privateKey = new Uint8Array(0);
    message.scheme = 0;
    message.keySpec = 0;
    if (value !== void 0)
      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 /* string id */
        1:
          message.id = reader.string();
          break;
        case /* com.digitalasset.canton.crypto.v30.CryptoKeyFormat format */
        2:
          message.format = reader.int32();
          break;
        case /* bytes private_key */
        3:
          message.privateKey = reader.bytes();
          break;
        case /* com.digitalasset.canton.crypto.v30.EncryptionKeyScheme scheme = 4 [deprecated = true] */
        4:
          message.scheme = reader.int32();
          break;
        case /* com.digitalasset.canton.crypto.v30.EncryptionKeySpec key_spec */
        5:
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.id !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.id);
    if (message.format !== 0)
      writer.tag(2, WireType.Varint).int32(message.format);
    if (message.privateKey.length)
      writer.tag(3, WireType.LengthDelimited).bytes(message.privateKey);
    if (message.scheme !== 0)
      writer.tag(4, WireType.Varint).int32(message.scheme);
    if (message.keySpec !== 0)
      writer.tag(5, WireType.Varint).int32(message.keySpec);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const EncryptionPrivateKey = new EncryptionPrivateKey$Type();
class EncryptionKeyPair$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.EncryptionKeyPair", [
      {
        no: 1,
        name: "public_key",
        kind: "message",
        T: () => EncryptionPublicKey
      },
      {
        no: 2,
        name: "private_key",
        kind: "message",
        T: () => EncryptionPrivateKey
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      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.digitalasset.canton.crypto.v30.EncryptionPublicKey public_key */
        1:
          message.publicKey = EncryptionPublicKey.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.publicKey
          );
          break;
        case /* com.digitalasset.canton.crypto.v30.EncryptionPrivateKey private_key */
        2:
          message.privateKey = EncryptionPrivateKey.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.privateKey
          );
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.publicKey)
      EncryptionPublicKey.internalBinaryWrite(
        message.publicKey,
        writer.tag(1, WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.privateKey)
      EncryptionPrivateKey.internalBinaryWrite(
        message.privateKey,
        writer.tag(2, WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const EncryptionKeyPair = new EncryptionKeyPair$Type();
class RequiredEncryptionSpecs$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.RequiredEncryptionSpecs", [
      {
        no: 1,
        name: "algorithms",
        kind: "enum",
        repeat: 1,
        T: () => [
          "com.digitalasset.canton.crypto.v30.EncryptionAlgorithmSpec",
          EncryptionAlgorithmSpec,
          "ENCRYPTION_ALGORITHM_SPEC_"
        ]
      },
      {
        no: 2,
        name: "keys",
        kind: "enum",
        repeat: 1,
        T: () => [
          "com.digitalasset.canton.crypto.v30.EncryptionKeySpec",
          EncryptionKeySpec,
          "ENCRYPTION_KEY_SPEC_"
        ]
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.algorithms = [];
    message.keys = [];
    if (value !== void 0)
      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 /* repeated com.digitalasset.canton.crypto.v30.EncryptionAlgorithmSpec algorithms */
        1:
          if (wireType === WireType.LengthDelimited)
            for (let e = reader.int32() + reader.pos; reader.pos < e; )
              message.algorithms.push(reader.int32());
          else message.algorithms.push(reader.int32());
          break;
        case /* repeated com.digitalasset.canton.crypto.v30.EncryptionKeySpec keys */
        2:
          if (wireType === WireType.LengthDelimited)
            for (let e = reader.int32() + reader.pos; reader.pos < e; )
              message.keys.push(reader.int32());
          else message.keys.push(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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.algorithms.length) {
      writer.tag(1, WireType.LengthDelimited).fork();
      for (let i = 0; i < message.algorithms.length; i++)
        writer.int32(message.algorithms[i]);
      writer.join();
    }
    if (message.keys.length) {
      writer.tag(2, WireType.LengthDelimited).fork();
      for (let i = 0; i < message.keys.length; i++)
        writer.int32(message.keys[i]);
      writer.join();
    }
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const RequiredEncryptionSpecs = new RequiredEncryptionSpecs$Type();
class CryptoKeyPair$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.CryptoKeyPair", [
      {
        no: 1,
        name: "signing_key_pair",
        kind: "message",
        oneof: "pair",
        T: () => SigningKeyPair
      },
      {
        no: 2,
        name: "encryption_key_pair",
        kind: "message",
        oneof: "pair",
        T: () => EncryptionKeyPair
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.pair = { oneofKind: void 0 };
    if (value !== void 0)
      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.digitalasset.canton.crypto.v30.SigningKeyPair signing_key_pair */
        1:
          message.pair = {
            oneofKind: "signingKeyPair",
            signingKeyPair: SigningKeyPair.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.pair.signingKeyPair
            )
          };
          break;
        case /* com.digitalasset.canton.crypto.v30.EncryptionKeyPair encryption_key_pair */
        2:
          message.pair = {
            oneofKind: "encryptionKeyPair",
            encryptionKeyPair: EncryptionKeyPair.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.pair.encryptionKeyPair
            )
          };
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.pair.oneofKind === "signingKeyPair")
      SigningKeyPair.internalBinaryWrite(
        message.pair.signingKeyPair,
        writer.tag(1, WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.pair.oneofKind === "encryptionKeyPair")
      EncryptionKeyPair.internalBinaryWrite(
        message.pair.encryptionKeyPair,
        writer.tag(2, WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const CryptoKeyPair = new CryptoKeyPair$Type();
class SymmetricKey$Type extends MessageType {
  constructor() {
    super(
      "com.digitalasset.canton.crypto.v30.SymmetricKey",
      [
        {
          no: 1,
          name: "format",
          kind: "enum",
          T: () => [
            "com.digitalasset.canton.crypto.v30.CryptoKeyFormat",
            CryptoKeyFormat,
            "CRYPTO_KEY_FORMAT_"
          ]
        },
        {
          no: 2,
          name: "key",
          kind: "scalar",
          T: 12
        },
        {
          no: 3,
          name: "scheme",
          kind: "enum",
          T: () => [
            "com.digitalasset.canton.crypto.v30.SymmetricKeyScheme",
            SymmetricKeyScheme,
            "SYMMETRIC_KEY_SCHEME_"
          ]
        }
      ],
      {
        "scalapb.message": {
          companionExtends: [
            "com.digitalasset.canton.version.StableProtoVersion"
          ]
        }
      }
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.format = 0;
    message.key = new Uint8Array(0);
    message.scheme = 0;
    if (value !== void 0)
      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.digitalasset.canton.crypto.v30.CryptoKeyFormat format */
        1:
          message.format = reader.int32();
          break;
        case /* bytes key */
        2:
          message.key = reader.bytes();
          break;
        case /* com.digitalasset.canton.crypto.v30.SymmetricKeyScheme scheme */
        3:
          message.scheme = 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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.format !== 0)
      writer.tag(1, WireType.Varint).int32(message.format);
    if (message.key.length)
      writer.tag(2, WireType.LengthDelimited).bytes(message.key);
    if (message.scheme !== 0)
      writer.tag(3, WireType.Varint).int32(message.scheme);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const SymmetricKey = new SymmetricKey$Type();
class PasswordBasedEncrypted$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.PasswordBasedEncrypted", [
      {
        no: 1,
        name: "ciphertext",
        kind: "scalar",
        T: 12
      },
      {
        no: 2,
        name: "symmetric_key_scheme",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.SymmetricKeyScheme",
          SymmetricKeyScheme,
          "SYMMETRIC_KEY_SCHEME_"
        ]
      },
      {
        no: 3,
        name: "pbkdf_scheme",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.PbkdfScheme",
          PbkdfScheme,
          "PBKDF_SCHEME_"
        ]
      },
      {
        no: 4,
        name: "salt",
        kind: "scalar",
        T: 12
        /*ScalarType.BYTES*/
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.ciphertext = new Uint8Array(0);
    message.symmetricKeyScheme = 0;
    message.pbkdfScheme = 0;
    message.salt = new Uint8Array(0);
    if (value !== void 0)
      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 /* bytes ciphertext */
        1:
          message.ciphertext = reader.bytes();
          break;
        case /* com.digitalasset.canton.crypto.v30.SymmetricKeyScheme symmetric_key_scheme */
        2:
          message.symmetricKeyScheme = reader.int32();
          break;
        case /* com.digitalasset.canton.crypto.v30.PbkdfScheme pbkdf_scheme */
        3:
          message.pbkdfScheme = reader.int32();
          break;
        case /* bytes salt */
        4:
          message.salt = reader.bytes();
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.ciphertext.length)
      writer.tag(1, WireType.LengthDelimited).bytes(message.ciphertext);
    if (message.symmetricKeyScheme !== 0)
      writer.tag(2, WireType.Varint).int32(message.symmetricKeyScheme);
    if (message.pbkdfScheme !== 0)
      writer.tag(3, WireType.Varint).int32(message.pbkdfScheme);
    if (message.salt.length)
      writer.tag(4, WireType.LengthDelimited).bytes(message.salt);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const PasswordBasedEncrypted = new PasswordBasedEncrypted$Type();
class AsymmetricEncrypted$Type extends MessageType {
  constructor() {
    super("com.digitalasset.canton.crypto.v30.AsymmetricEncrypted", [
      {
        no: 1,
        name: "ciphertext",
        kind: "scalar",
        T: 12
      },
      {
        no: 2,
        name: "encryption_algorithm_spec",
        kind: "enum",
        T: () => [
          "com.digitalasset.canton.crypto.v30.EncryptionAlgorithmSpec",
          EncryptionAlgorithmSpec,
          "ENCRYPTION_ALGORITHM_SPEC_"
        ]
      },
      {
        no: 3,
        name: "fingerprint",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.ciphertext = new Uint8Array(0);
    message.encryptionAlgorithmSpec = 0;
    message.fingerprint = "";
    if (value !== void 0)
      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 /* bytes ciphertext */
        1:
          message.ciphertext = reader.bytes();
          break;
        case /* com.digitalasset.canton.crypto.v30.EncryptionAlgorithmSpec encryption_algorithm_spec */
        2:
          message.encryptionAlgorithmSpec = reader.int32();
          break;
        case /* string fingerprint */
        3:
          message.fingerprint = reader.string();
          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 ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.ciphertext.length)
      writer.tag(1, WireType.LengthDelimited).bytes(message.ciphertext);
    if (message.encryptionAlgorithmSpec !== 0)
      writer.tag(2, WireType.Varint).int32(message.encryptionAlgorithmSpec);
    if (message.fingerprint !== "")
      writer.tag(3, WireType.LengthDelimited).string(message.fingerprint);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const AsymmetricEncrypted = new AsymmetricEncrypted$Type();
export {
  AsymmetricEncrypted,
  CryptoKeyFormat,
  CryptoKeyPair,
  EncryptionAlgorithmSpec,
  EncryptionKeyPair,
  EncryptionKeyScheme,
  EncryptionKeySpec,
  EncryptionPrivateKey,
  EncryptionPublicKey,
  HashAlgorithm,
  Hmac,
  HmacAlgorithm,
  KeyPurpose,
  PasswordBasedEncrypted,
  PbkdfScheme,
  PrivateKey,
  PublicKey,
  PublicKeyWithName,
  RequiredEncryptionSpecs,
  RequiredSigningSpecs,
  Salt,
  Signature,
  SignatureDelegation,
  SignatureFormat,
  SigningAlgorithmSpec,
  SigningKeyPair,
  SigningKeyScheme,
  SigningKeySpec,
  SigningKeyUsage,
  SigningPrivateKey,
  SigningPublicKey,
  SymmetricKey,
  SymmetricKeyScheme
};
//# sourceMappingURL=crypto.js.map