///
/// HybridEcKeyPairSpec.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///

#pragma once

#if __has_include(<NitroModules/HybridObject.hpp>)
#include <NitroModules/HybridObject.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif

// Forward declaration of `KeyObject` to properly resolve imports.
namespace margelo::nitro::crypto { struct KeyObject; }

#include <NitroModules/Promise.hpp>
#include "KeyObject.hpp"
#include <string>
#include <NitroModules/ArrayBuffer.hpp>
#include <vector>

namespace margelo::nitro::crypto {

  using namespace margelo::nitro;

  /**
   * An abstract base class for `EcKeyPair`
   * Inherit this class to create instances of `HybridEcKeyPairSpec` in C++.
   * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
   * @example
   * ```cpp
   * class HybridEcKeyPair: public HybridEcKeyPairSpec {
   * public:
   *   HybridEcKeyPair(...): HybridObject(TAG) { ... }
   *   // ...
   * };
   * ```
   */
  class HybridEcKeyPairSpec: public virtual HybridObject {
    public:
      // Constructor
      explicit HybridEcKeyPairSpec(): HybridObject(TAG) { }

      // Destructor
      ~HybridEcKeyPairSpec() override = default;

    public:
      // Properties
      

    public:
      // Methods
      virtual std::shared_ptr<Promise<void>> generateKeyPair() = 0;
      virtual void generateKeyPairSync() = 0;
      virtual KeyObject importKey(const std::string& format, const std::shared_ptr<ArrayBuffer>& keyData, const std::string& algorithm, bool extractable, const std::vector<std::string>& keyUsages) = 0;
      virtual std::shared_ptr<ArrayBuffer> exportKey(const KeyObject& key, const std::string& format) = 0;
      virtual std::shared_ptr<ArrayBuffer> getPublicKey() = 0;
      virtual std::shared_ptr<ArrayBuffer> getPrivateKey() = 0;
      virtual void setCurve(const std::string& curve) = 0;
      virtual std::shared_ptr<ArrayBuffer> sign(const std::shared_ptr<ArrayBuffer>& data, const std::string& hashAlgorithm) = 0;
      virtual bool verify(const std::shared_ptr<ArrayBuffer>& data, const std::shared_ptr<ArrayBuffer>& signature, const std::string& hashAlgorithm) = 0;
      virtual std::vector<std::string> getSupportedCurves() = 0;

    protected:
      // Hybrid Setup
      void loadHybridMethods() override;

    protected:
      // Tag for logging
      static constexpr auto TAG = "EcKeyPair";
  };

} // namespace margelo::nitro::crypto
