@@ -64,6 +64,7 @@ module Simplex.Messaging.Agent
6464 setConnShortLink ,
6565 deleteConnShortLink ,
6666 getConnShortLink ,
67+ getConnLinkPrivKey ,
6768 deleteLocalInvShortLink ,
6869 changeConnectionUser ,
6970 prepareConnectionToJoin ,
@@ -428,6 +429,10 @@ getConnShortLink :: AgentClient -> NetworkRequestMode -> UserId -> ConnShortLink
428429getConnShortLink c = withAgentEnv c .:. getConnShortLink' c
429430{-# INLINE getConnShortLink #-}
430431
432+ getConnLinkPrivKey :: AgentClient -> ConnId -> AE (Maybe C. PrivateKeyEd25519 )
433+ getConnLinkPrivKey c = withAgentEnv c . getConnLinkPrivKey' c
434+ {-# INLINE getConnLinkPrivKey #-}
435+
431436-- | This irreversibly deletes short link data, and it won't be retrievable again
432437deleteLocalInvShortLink :: AgentClient -> ConnShortLink 'CMInvitation -> AE ()
433438deleteLocalInvShortLink c = withAgentEnv c . deleteLocalInvShortLink' c
@@ -1087,6 +1092,14 @@ deleteConnShortLink' c nm connId cMode =
10871092 (RcvConnection _ rq, SCMInvitation ) -> deleteQueueLink c nm rq
10881093 _ -> throwE $ CMD PROHIBITED " deleteConnShortLink: not contact address"
10891094
1095+ getConnLinkPrivKey' :: AgentClient -> ConnId -> AM (Maybe C. PrivateKeyEd25519 )
1096+ getConnLinkPrivKey' c connId = do
1097+ SomeConn _ conn <- withStore c (`getConn` connId)
1098+ pure $ case conn of
1099+ ContactConnection _ rq -> linkPrivSigKey <$> shortLink rq
1100+ RcvConnection _ rq -> linkPrivSigKey <$> shortLink rq
1101+ _ -> Nothing
1102+
10901103-- TODO [short links] remove 1-time invitation data and link ID from the server after the message is sent.
10911104getConnShortLink' :: forall c . AgentClient -> NetworkRequestMode -> UserId -> ConnShortLink c -> AM (FixedLinkData c , ConnLinkData c )
10921105getConnShortLink' c nm userId = \ case
0 commit comments