'use strict';

var types_generic_typedEnum = require('../../generic/typed-enum.cjs');
require('../../generic/typed-bytes.cjs');
require('../../generic/typed-string.cjs');
var utils_interfaces = require('../../../utils/interfaces.cjs');
require('../../generic/typed-array.cjs');
require('../../generic/typed-tuple.cjs');
require('../../generic/typed-null.cjs');
var types_generic_option = require('../../generic/option.cjs');
require('../../../utils/types/array.cjs');
require('crypto');
require('bs58');
require('multiformats/bases/base58');
require('varint');
require('../../../utils/encoding/ss-58.cjs');
require('../../generic/typed-number.cjs');
require('../../generic/typed-set.cjs');
require('../../generic/typed-map.cjs');
require('../../generic/typed-struct.cjs');
require('uuid');
require('js-sha256');
var types_generic_withProp = require('../../generic/with-prop.cjs');
require('../../../vc/crypto/Bls12381BBDT16KeyPairDock2024.cjs');
require('../../../vc/crypto/Bls12381BBDT16MACDock2024.cjs');
require('../../../vc/crypto/Bls12381BBDT16MACProofDock2024.cjs');
require('../../../vc/crypto/Bls12381BBSKeyPairDock2023.cjs');
require('../../../vc/crypto/Bls12381BBSSignatureDock2022.cjs');
require('../../../vc/crypto/Bls12381BBSSignatureDock2023.cjs');
require('../../../vc/crypto/Bls12381BBSSignatureProofDock2022.cjs');
require('../../../vc/crypto/Bls12381BBSSignatureProofDock2023.cjs');
require('../../../vc/crypto/Bls12381BDDT16KeyPairDock2024.cjs');
require('../../../vc/crypto/Bls12381BDDT16MACDock2024.cjs');
require('../../../vc/crypto/Bls12381BDDT16MACProofDock2024.cjs');
require('../../../vc/crypto/Bls12381G2KeyPairDock2022.cjs');
require('../../../vc/crypto/Bls12381PSKeyPairDock2023.cjs');
require('../../../vc/crypto/Bls12381PSSignatureDock2023.cjs');
require('../../../vc/crypto/Bls12381PSSignatureProofDock2023.cjs');
var vc_crypto_constants = require('../../../vc/crypto/constants.cjs');
require('@juanelas/base64');
require('../../../keypairs/keypair-secp256k1.cjs');
require('../../../vc/crypto/common/CustomLinkedDataSignature.cjs');
require('@stablelib/ed25519');
require('../../public-keys/public-key.cjs');
require('../../public-keys/public-key-sr25519-value.cjs');
require('../../public-keys/public-key-ed25519-value.cjs');
require('../../public-keys/public-key-secp256k1-value.cjs');
require('../../public-keys/public-key-x25519-value.cjs');
require('../../signatures/signature-value.cjs');
require('../../signatures/signature.cjs');
require('../../../keypairs/dock-keypair.cjs');
require('@transmute/json-web-signature');
var types_offchainSignatures_publicKeys_value = require('./value.cjs');
var types_offchainSignatures_publicKeys_ref = require('./ref.cjs');
var types_offchainSignatures_params_index = require('../params/index.cjs');
var types_offchainSignatures_publicKeys_id = require('./id.cjs');
require('../../../utils/types/iterable.cjs');
require('../../../utils/types/object.cjs');
require('../../../utils/inheritance.cjs');
require('../../../utils/types/set.cjs');
require('../../generic/with-base.cjs');
require('../../../utils/types/bytes.cjs');
require('../../../utils/types/string.cjs');
require('../../../utils/assert.cjs');
require('../../../utils/error.cjs');
require('../../generic/with-catch-null.cjs');
require('../../generic/with-eq.cjs');
require('../../generic/any-of.cjs');
require('../../generic/with-from.cjs');
require('../../generic/with-from-json-bytes.cjs');
require('blake2b');
require('../../generic/create-placeholder.cjs');
require('../../generic/with-props.cjs');
require('@docknetwork/crypto-wasm-ts');
require('../../../vc/crypto/common/DockCryptoKeyPair.cjs');
require('@docknetwork/crypto-wasm-ts/lib/index.js');
require('../../../vc/crypto/common/DockCryptoSignature.cjs');
require('jsonld-signatures');
require('json-stringify-deterministic');
require('semver/preload.js');
require('../../../vc/crypto/common/DockCryptoSignatureProof.cjs');
require('elliptic');
require('base64url');
require('jsonld');
require('../../did/document/verification-method-ref.cjs');
require('../../generic/with-qualifier.cjs');
require('../../generic/utils.cjs');
require('../../generic/typed-bytes-array.cjs');
require('../../did/onchain/typed-did/index.cjs');
require('../../did/onchain/typed-did/did-method-key/did-method-key-public-key.cjs');
require('../../../utils/encoding/base-58-btc.cjs');
require('../../generic/sized.cjs');
require('../../../utils/types/number.cjs');
require('../../did/onchain/constants.cjs');
require('../../did/onchain/typed-did/signature.cjs');
require('../../did/onchain/typed-did/did-method-key/did-method-key-signature.cjs');
require('../../signatures/signature-ed25519-value.cjs');
require('../../signatures/signature-secp256k1-value.cjs');
require('../../did/onchain/typed-did/dock-did-value.cjs');
require('../../generic/typed-uuid.cjs');
require('../../did/onchain/typed-did/cheqd-did.cjs');
require('../../signatures/signature-sr25519-value.cjs');
require('../../../vc/jws.cjs');
require('../curve-type.cjs');
require('../params/id.cjs');
require('../../generic/with-from-dock-id.cjs');
require('../params/value.cjs');

class OffchainSignaturePublicKey extends types_generic_typedEnum {
  get bytes() {
    return this.value.bytes;
  }

  get paramsRef() {
    return this.value.paramsRef;
  }

  get curveType() {
    return this.value.curveType;
  }

  get participantId() {
    return this.value.participantId;
  }

  get params() {
    return this.value.params;
  }

  setParams(params) {
    const WithParams = types_generic_withProp(
      this.constructor,
      'params',
      types_generic_option(this.constructor.Params),
    );

    const withParams = WithParams.from(this);
    withParams.value.params = params;

    return withParams;
  }

  async withParams(paramsModule) {
    let params = null;
    if (this.paramsRef != null) {
      params = await paramsModule.getParams(...this.paramsRef);

      if (params == null) {
        throw new Error(
          `Parameters with reference (${utils_interfaces.maybeToJSONString(
            this.paramsRef,
          )}) not found on chain`,
        );
      }
    }

    return this.setParams(params);
  }
}
class BBSPublicKey extends OffchainSignaturePublicKey {
  static Class = types_offchainSignatures_publicKeys_value.BBSPublicKeyValue;

  static Params = types_offchainSignatures_params_index.BBSParams;

  static Type = 'bbs';

  static VerKeyType = vc_crypto_constants.Bls12381BBS23DockVerKeyName;
}
class BBSPlusPublicKey extends OffchainSignaturePublicKey {
  static Class = types_offchainSignatures_publicKeys_value.BBSPlusPublicKeyValue;

  static Params = types_offchainSignatures_params_index.BBSPlusParams;

  static Type = 'bbsPlus';

  static VerKeyType = vc_crypto_constants.Bls12381BBSDockVerKeyName;
}
class PSPublicKey extends OffchainSignaturePublicKey {
  static Class = types_offchainSignatures_publicKeys_value.PSPublicKeyValue;

  static Params = types_offchainSignatures_params_index.PSParams;

  static Type = 'ps';

  static VerKeyType = vc_crypto_constants.Bls12381PSDockVerKeyName;
}
class BBDT16PublicKey extends OffchainSignaturePublicKey {
  static Class = types_offchainSignatures_publicKeys_value.BBDT16PublicKeyValue;

  static Params = types_offchainSignatures_params_index.BBDT16Params;

  static Type = 'bbdt16';

  static VerKeyType = vc_crypto_constants.Bls12381BBDT16DockVerKeyName;
}

OffchainSignaturePublicKey.bindVariants(
  BBSPublicKey,
  BBSPlusPublicKey,
  PSPublicKey,
  BBDT16PublicKey,
);

class DockOffchainSignaturePublicKey extends types_generic_withProp(
  OffchainSignaturePublicKey,
  'paramsRef',
  types_generic_option(types_offchainSignatures_publicKeys_ref.DockOffchainSignatureParamsRef),
) {}

class CheqdOffchainSignaturePublicKey extends types_generic_withProp(
  OffchainSignaturePublicKey,
  'paramsRef',
  types_generic_option(types_offchainSignatures_publicKeys_ref.CheqdOffchainSignatureParamsRef),
) {}

class CheqdTestnetOffchainSignaturePublicKey extends types_generic_withProp(
  OffchainSignaturePublicKey,
  'paramsRef',
  types_generic_option(types_offchainSignatures_publicKeys_ref.CheqdTestnetOffchainSignatureParamsRef),
) {}
class CheqdMainnetOffchainSignaturePublicKey extends types_generic_withProp(
  OffchainSignaturePublicKey,
  'paramsRef',
  types_generic_option(types_offchainSignatures_publicKeys_ref.CheqdMainnetOffchainSignatureParamsRef),
) {}

exports.BBDT16PublicKeyValue = types_offchainSignatures_publicKeys_value.BBDT16PublicKeyValue;
exports.BBSPlusPublicKeyValue = types_offchainSignatures_publicKeys_value.BBSPlusPublicKeyValue;
exports.BBSPublicKeyValue = types_offchainSignatures_publicKeys_value.BBSPublicKeyValue;
exports.CheqdMainnetOffchainSignaturePublicKeyValue = types_offchainSignatures_publicKeys_value.CheqdMainnetOffchainSignaturePublicKeyValue;
exports.CheqdOffchainSignaturePublicKeyValue = types_offchainSignatures_publicKeys_value.CheqdOffchainSignaturePublicKeyValue;
exports.CheqdTestnetOffchainSignaturePublicKeyValue = types_offchainSignatures_publicKeys_value.CheqdTestnetOffchainSignaturePublicKeyValue;
exports.DockOffchainSignaturePublicKeyValue = types_offchainSignatures_publicKeys_value.DockOffchainSignaturePublicKeyValue;
exports.OffchainSignaturePublicKeyValue = types_offchainSignatures_publicKeys_value.OffchainSignaturePublicKeyValue;
exports.PSPublicKeyValue = types_offchainSignatures_publicKeys_value.PSPublicKeyValue;
exports.CheqdMainnetOffchainSignatureKeyRef = types_offchainSignatures_publicKeys_ref.CheqdMainnetOffchainSignatureKeyRef;
exports.CheqdMainnetOffchainSignatureParamsRef = types_offchainSignatures_publicKeys_ref.CheqdMainnetOffchainSignatureParamsRef;
exports.CheqdOffchainSignatureKeyRef = types_offchainSignatures_publicKeys_ref.CheqdOffchainSignatureKeyRef;
exports.CheqdOffchainSignatureParamsRef = types_offchainSignatures_publicKeys_ref.CheqdOffchainSignatureParamsRef;
exports.CheqdTestnetOffchainSignatureKeyRef = types_offchainSignatures_publicKeys_ref.CheqdTestnetOffchainSignatureKeyRef;
exports.CheqdTestnetOffchainSignatureParamsRef = types_offchainSignatures_publicKeys_ref.CheqdTestnetOffchainSignatureParamsRef;
exports.DockOffchainSignatureKeyRef = types_offchainSignatures_publicKeys_ref.DockOffchainSignatureKeyRef;
exports.DockOffchainSignatureParamsRef = types_offchainSignatures_publicKeys_ref.DockOffchainSignatureParamsRef;
exports.DockOrCheqdOffchainSignatureParamsRef = types_offchainSignatures_publicKeys_ref.DockOrCheqdOffchainSignatureParamsRef;
exports.CheqdPublicKeyId = types_offchainSignatures_publicKeys_id.CheqdPublicKeyId;
exports.DockOrCheqdPublicKeyId = types_offchainSignatures_publicKeys_id.DockOrCheqdPublicKeyId;
exports.DockPublicKeyId = types_offchainSignatures_publicKeys_id.DockPublicKeyId;
exports.BBDT16PublicKey = BBDT16PublicKey;
exports.BBSPlusPublicKey = BBSPlusPublicKey;
exports.BBSPublicKey = BBSPublicKey;
exports.CheqdMainnetOffchainSignaturePublicKey = CheqdMainnetOffchainSignaturePublicKey;
exports.CheqdOffchainSignaturePublicKey = CheqdOffchainSignaturePublicKey;
exports.CheqdTestnetOffchainSignaturePublicKey = CheqdTestnetOffchainSignaturePublicKey;
exports.DockOffchainSignaturePublicKey = DockOffchainSignaturePublicKey;
exports.OffchainSignaturePublicKey = OffchainSignaturePublicKey;
exports.PSPublicKey = PSPublicKey;
//# sourceMappingURL=index.cjs.map
