{-# LANGUAGE TypeApplications #-}

module Test.Crypto.Vector.StringConstants (
  invalidEcdsaSigLengthError,
  invalidSchnorrVerKeyLengthError,
  invalidEcdsaVerKeyLengthError,
  invalidSchnorrSigLengthError,
  cannotDecodeVerificationKeyError,
  unexpectedDecodingError,
)
where

import Cardano.Crypto.SECP256K1.Constants (
  SECP256K1_ECDSA_PUBKEY_BYTES,
  SECP256K1_ECDSA_SIGNATURE_BYTES,
  SECP256K1_SCHNORR_PUBKEY_BYTES,
  SECP256K1_SCHNORR_SIGNATURE_BYTES,
 )
import Data.Data (Proxy (Proxy))
import GHC.TypeLits (natVal)

invalidEcdsaVerKeyLengthError :: Integer -> String
invalidEcdsaVerKeyLengthError :: Integer -> String
invalidEcdsaVerKeyLengthError = Integer -> Integer -> String
invalidVerKeyLengthError forall a b. (a -> b) -> a -> b
$ forall (n :: Nat) (proxy :: Nat -> *).
KnownNat n =>
proxy n -> Integer
natVal forall a b. (a -> b) -> a -> b
$ forall {k} (t :: k). Proxy t
Proxy @SECP256K1_ECDSA_PUBKEY_BYTES

invalidSchnorrVerKeyLengthError :: Integer -> String
invalidSchnorrVerKeyLengthError :: Integer -> String
invalidSchnorrVerKeyLengthError = Integer -> Integer -> String
invalidVerKeyLengthError forall a b. (a -> b) -> a -> b
$ forall (n :: Nat) (proxy :: Nat -> *).
KnownNat n =>
proxy n -> Integer
natVal forall a b. (a -> b) -> a -> b
$ forall {k} (t :: k). Proxy t
Proxy @SECP256K1_SCHNORR_PUBKEY_BYTES

invalidVerKeyLengthError :: Integer -> Integer -> String
invalidVerKeyLengthError :: Integer -> Integer -> String
invalidVerKeyLengthError Integer
expectedLength Integer
actualLength =
  String
"decodeVerKeyDSIGN: wrong length, expected "
    forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Integer
expectedLength
    forall a. [a] -> [a] -> [a]
++ String
" bytes but got "
    forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Integer
actualLength

invalidEcdsaSigLengthError :: Integer -> String
invalidEcdsaSigLengthError :: Integer -> String
invalidEcdsaSigLengthError = Integer -> Integer -> String
invalidSigLengthError forall a b. (a -> b) -> a -> b
$ forall (n :: Nat) (proxy :: Nat -> *).
KnownNat n =>
proxy n -> Integer
natVal forall a b. (a -> b) -> a -> b
$ forall {k} (t :: k). Proxy t
Proxy @SECP256K1_ECDSA_SIGNATURE_BYTES

invalidSchnorrSigLengthError :: Integer -> String
invalidSchnorrSigLengthError :: Integer -> String
invalidSchnorrSigLengthError = Integer -> Integer -> String
invalidSigLengthError forall a b. (a -> b) -> a -> b
$ forall (n :: Nat) (proxy :: Nat -> *).
KnownNat n =>
proxy n -> Integer
natVal forall a b. (a -> b) -> a -> b
$ forall {k} (t :: k). Proxy t
Proxy @SECP256K1_SCHNORR_SIGNATURE_BYTES

invalidSigLengthError :: Integer -> Integer -> String
invalidSigLengthError :: Integer -> Integer -> String
invalidSigLengthError Integer
expectedLength Integer
actualLength =
  String
"decodeSigDSIGN: wrong length, expected "
    forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Integer
expectedLength
    forall a. [a] -> [a] -> [a]
++ String
" bytes but got "
    forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Integer
actualLength

cannotDecodeVerificationKeyError :: String
cannotDecodeVerificationKeyError :: String
cannotDecodeVerificationKeyError = String
"decodeVerKeyDSIGN: cannot decode key"

unexpectedDecodingError :: String
unexpectedDecodingError :: String
unexpectedDecodingError = String
"Test failed. Unexpected decoding error encountered."