import { EcdsaSecp256k1SigName, EcdsaSecp256k1VerKeyName } from './constants.js';
import EcdsaSecp256k1VerificationKey2019 from './EcdsaSecp256k1VerificationKey2019.js';
import CustomLinkedDataSignature from './common/CustomLinkedDataSignature.js';
import 'bs58';
import '@juanelas/base64';
import '../../utils/types/bytes.js';
import 'crypto';
import '../../utils/interfaces.js';
import '../../utils/assert.js';
import '../../utils/error.js';
import '../../utils/types/string.js';
import '../../utils/types/iterable.js';
import '../../utils/types/object.js';
import '../../utils/inheritance.js';
import '../../utils/types/set.js';
import '../../keypairs/keypair-secp256k1.js';
import 'elliptic';
import 'js-sha256';
import '../../types/public-keys/public-key.js';
import '../../types/generic/typed-enum.js';
import '../../utils/types/array.js';
import 'multiformats/bases/base58';
import 'varint';
import '../../utils/encoding/ss-58.js';
import 'blake2b';
import '../../types/generic/with-base.js';
import '../../types/generic/with-catch-null.js';
import '../../types/generic/with-eq.js';
import '../../types/generic/any-of.js';
import '../../types/generic/with-from.js';
import '../../types/generic/with-from-json-bytes.js';
import '../../types/generic/typed-null.js';
import '../../types/generic/create-placeholder.js';
import '../../types/generic/typed-bytes.js';
import '../../types/generic/typed-string.js';
import '../../types/generic/typed-array.js';
import '../../types/generic/typed-tuple.js';
import '../../types/generic/typed-number.js';
import '../../types/generic/typed-set.js';
import '../../types/generic/typed-map.js';
import '../../types/generic/typed-struct.js';
import 'uuid';
import '../../types/public-keys/public-key-x25519-value.js';
import '../../types/generic/sized.js';
import '../../utils/types/number.js';
import '../../types/public-keys/public-key-ed25519-value.js';
import '../../types/public-keys/public-key-secp256k1-value.js';
import '../../types/public-keys/public-key-sr25519-value.js';
import '../../types/signatures/signature-value.js';
import '../../types/signatures/signature.js';
import '../../types/signatures/signature-ed25519-value.js';
import '../../types/signatures/signature-secp256k1-value.js';
import '../../types/signatures/signature-sr25519-value.js';
import '../../keypairs/dock-keypair.js';
import '../../utils/encoding/multibase.js';
import 'jsonld-signatures';
import 'base64url';
import 'jsonld';
import '../../types/did/document/verification-method-ref.js';
import '../../types/generic/with-qualifier.js';
import '../../types/generic/utils.js';
import '../../types/generic/typed-bytes-array.js';
import '../../types/did/onchain/typed-did/index.js';
import '../../types/did/onchain/typed-did/did-method-key/did-method-key-public-key.js';
import '../../utils/encoding/base-58-btc.js';
import '../../types/did/onchain/constants.js';
import '../../types/did/onchain/typed-did/signature.js';
import '../../types/did/onchain/typed-did/did-method-key/did-method-key-signature.js';
import '../../types/did/onchain/typed-did/dock-did-value.js';
import '../../types/generic/typed-uuid.js';
import '../../types/did/onchain/typed-did/cheqd-did.js';
import '../jws.js';

const SUITE_CONTEXT_URL = 'https://www.w3.org/2018/credentials/v1';

class EcdsaSecp256k1Signature2019 extends CustomLinkedDataSignature {
  /**
   * Creates a new EcdsaSecp256k1Signature2019 instance
   * @constructor
   * @param {object} config - Configuration options
   */
  constructor({
    keypair,
    verificationMethod,
    verifier,
    signer,
    useProofValue,
  } = {}) {
    super({
      type: EcdsaSecp256k1SigName,
      LDKeyClass: EcdsaSecp256k1VerificationKey2019,
      contextUrl: SUITE_CONTEXT_URL,
      alg: 'ES256K',
      signer:
        signer
        || EcdsaSecp256k1Signature2019.signerFactory(keypair, verificationMethod),
      verifier,
      useProofValue,
    });
    this.requiredKeyType = EcdsaSecp256k1VerKeyName;
  }

  /**
   * Generate object with `sign` method
   * @param keypair
   * @param verificationMethod
   * @returns {object}
   */
  static signerFactory(keypair, verificationMethod) {
    return {
      id: verificationMethod,
      async sign({ data }) {
        return new Uint8Array(
          keypair.keyPair.sign(keypair.constructor.hash(data)).toDER(),
        );
      },
    };
  }
}

export { EcdsaSecp256k1Signature2019 as default };
//# sourceMappingURL=EcdsaSecp256k1Signature2019.js.map
