<commit_before>module Integration (tests) where

import Protolude hiding (stdin, stdout)

import Crypto.Hash (SHA256(..))
import Data.ByteArray.Encoding (convertFromBase, convertToBase, Base(Base16))
import qualified Data.ByteString as ByteString
import qualified Data.ByteString.Char8 as Char8
import qualified System.IO as IO
import qualified System.Process as Process
import Test.Tasty (TestTree)
import Test.Tasty.Hspec (testSpec, describe, it, shouldBe)

import qualified Crypto.Spake2 as Spake2
import Crypto.Spake2.Group (Group(arbitraryElement))
import Crypto.Spake2.Groups (Ed25519(..))

import qualified Paths_spake2

tests :: IO TestTree
tests = testSpec "Integration" $
  describe "python-spake2" $ do
    it "Generates the same SPAKE2 session key (symmetric)" $ do
      let sideID = "treebeard"
      let password = "<PASSWORD>"
      let protocol = Spake2.makeSymmetricProtocol SHA256 Ed25519 blindS (Spake2.SideID sideID)
      exchangeWithPython protocol password
        [ "--side=S"
        , "--side-id=" <> toS sideID
        ]<commit_msg>fix integration tests<commit_after>module Integration (tests) where

import Protolude hiding (stdin, stdout, toS)
import Protolude.Conv (toS)

import Crypto.Hash (SHA256(..))
import Data.ByteArray.Encoding (convertFromBase, convertToBase, Base(Base16))
import qualified Data.ByteString as ByteString
import qualified Data.ByteString.Char8 as Char8
import qualified System.IO as IO
import qualified System.Process as Process
import Test.Tasty (TestTree)
import Test.Tasty.Hspec (testSpec, describe, it, shouldBe)

import qualified Crypto.Spake2 as Spake2
import Crypto.Spake2.Group (Group(arbitraryElement))
import Crypto.Spake2.Groups (Ed25519(..))

import qualified Paths_spake2

tests :: IO TestTree
tests = testSpec "Integration" $
  describe "python-spake2" $ do
    it "Generates the same SPAKE2 session key (symmetric)" $ do
      let sideID = "treebeard"
      let password = "<PASSWORD>"
      let protocol = Spake2.makeSymmetricProtocol SHA256 Ed25519 blindS (Spake2.SideID sideID)
      exchangeWithPython protocol password
        [ "--side=S"
        , "--side-id=" <> toS sideID
        ]
{'fraction_non_alphanumeric': 0.09162424803331791, 'fraction_numerical': 0.026839426191577972, 'mean_word_length': 4.378109452736318, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7280116', 'n_tokens_mistral': 687, 'n_tokens_neox': 653, 'n_words': 204}