@@ -48,15 +48,17 @@ data TestRunSelection a where
48
48
-> All
49
49
-> TestRunSelection [Fact TestRun (TestRunState 'RunningT)]
50
50
TestRunDone
51
- :: [TestRunId ]
51
+ :: Maybe (SSHClient 'WithSelector)
52
+ -> [TestRunId ]
52
53
-> All
53
54
-> TestRunSelection [Fact TestRun (TestRunState 'DoneT)]
54
55
TestRunRejected
55
56
:: [TestRunId ]
56
57
-> All
57
58
-> TestRunSelection [Fact TestRun (TestRunState 'DoneT)]
58
59
AnyTestRuns
59
- :: [TestRunId ]
60
+ :: Maybe (SSHClient 'WithSelector)
61
+ -> [TestRunId ]
60
62
-> All
61
63
-> TestRunSelection [Fact TestRun JSValue ]
62
64
data FactsSelection a where
@@ -95,20 +97,20 @@ whoseFilter whose facts = filterOn facts factKey
95
97
factsCmd
96
98
:: forall m a
97
99
. Monad m
98
- => Maybe (SSHClient 'WithSelector, Validation m )
100
+ => Maybe (Validation m )
99
101
-> MPFS m
100
102
-> TokenId
101
103
-> FactsSelection a
102
104
-> m a
103
- factsCmd mDecrypt mpfs tokenId selection = do
104
- decrypt <- case mDecrypt of
105
- Nothing -> pure id
106
- Just (ssh, validation) -> do
107
- users :: [RegisterUserKey ] <-
108
- fmap factKey <$> retrieveAnyFacts @ _ @ () mpfs tokenId
109
- mk <- decodePrivateSSHFile validation ssh
110
- let decrypt = tryDecryption users mk
111
- pure decrypt
105
+ factsCmd mValidation mpfs tokenId selection = do
106
+ let mkDecrypt mDecrypt = case (,) <$> mDecrypt <*> mValidation of
107
+ Nothing -> pure id
108
+ Just (ssh, validation) -> do
109
+ users :: [RegisterUserKey ] <-
110
+ fmap factKey <$> retrieveAnyFacts @ _ @ () mpfs tokenId
111
+ mk <- decodePrivateSSHFile validation ssh
112
+ let decrypt = tryDecryption users mk
113
+ pure decrypt
112
114
let
113
115
testRunCommon
114
116
:: FromJSON Maybe x => [TestRunId ] -> All -> m [Fact TestRun x ]
@@ -122,7 +124,8 @@ factsCmd mDecrypt mpfs tokenId selection = do
122
124
testRunCommon ids whose
123
125
core (TestRunFacts (TestRunRunning ids whose)) = do
124
126
testRunCommon ids whose
125
- core (TestRunFacts (TestRunDone ids whose)) = do
127
+ core (TestRunFacts (TestRunDone mDecrypt ids whose)) = do
128
+ decrypt <- mkDecrypt mDecrypt
126
129
facts <-
127
130
testRunCommon ids whose <&> fmap decrypt
128
131
pure $ filterOn facts factValue $ \ case
@@ -134,7 +137,8 @@ factsCmd mDecrypt mpfs tokenId selection = do
134
137
pure $ filterOn facts factValue $ \ case
135
138
Rejected {} -> True
136
139
_ -> False
137
- core (TestRunFacts (AnyTestRuns ids whose)) =
140
+ core (TestRunFacts (AnyTestRuns mDecrypt ids whose)) = do
141
+ decrypt <- mkDecrypt mDecrypt
138
142
testRunCommon ids whose <&> fmap (parseDecrypt decrypt)
139
143
core ConfigFact = retrieveAnyFacts mpfs tokenId
140
144
core WhiteListedFacts = retrieveAnyFacts mpfs tokenId
0 commit comments