Skip to content

Commit

Permalink
Add webAuthnSignatureTest
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundnoble committed Dec 22, 2024
1 parent 5299bff commit fc1ad2f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/unit/Chainweb/Test/Pact5/RemotePactTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ tests rdb = withResource' (evaluate httpManager >> evaluate cert) $ \_ ->
, invalidTxsTest rdb
, testCaseSteps "caplistTest" (caplistTest rdb)
, testCaseSteps "allocationTest" (allocationTest rdb)
, testCaseSteps "webAuthnSignatureTest" (webAuthnSignatureTest rdb)
]

pollingInvalidRequestKeyTest :: RocksDb -> Step -> IO ()
Expand Down Expand Up @@ -638,6 +639,23 @@ _PEPact5Error = prism' (PEPact5Error . uncurry3 PactErrorCode) $ \case
Just (_peCode, _peMsg, _peInfo)
_ -> Nothing

-- Test that transactions signed with (mock) WebAuthn keypairs are accepted
-- by the pact service.
webAuthnSignatureTest :: RocksDb -> Step -> IO ()
webAuthnSignatureTest rdb _step = runResourceT $ do
let v = pact5InstantCpmTestVersion petersonChainGraph
let cid = unsafeChainId 0
fixture <- mkFixture v rdb
withFixture fixture $ liftIO $ do
cmd <- buildTextCmd v
$ set cbSigners [mkWebAuthnSigner' sender02WebAuthn [], mkEd25519Signer' sender00 []]
$ set cbRPC (mkExec' "(concat [\"chainweb-\" \"node\"])")
$ defaultCmd
send v cid [cmd]
advanceAllChains_
poll v cid [cmdToRequestKey cmd] >>=
P.propful [P.match _Just successfulTx]

{-
recvPwos <- runCutWithTx v pacts targetMempoolRef blockDb $ \_n _bHeight _bHash bHeader -> do
buildCwCmd "transfer-crosschain" v
Expand Down

0 comments on commit fc1ad2f

Please sign in to comment.