@@ -65,6 +65,7 @@ module Simplex.Messaging.Agent
6565 setConnShortLink ,
6666 deleteConnShortLink ,
6767 getConnShortLink ,
68+ getConnLinkPrivKey ,
6869 deleteLocalInvShortLink ,
6970 changeConnectionUser ,
7071 prepareConnectionToJoin ,
@@ -439,6 +440,10 @@ getConnShortLink :: AgentClient -> NetworkRequestMode -> UserId -> ConnShortLink
439440getConnShortLink c = withAgentEnv c .:. getConnShortLink' c
440441{-# INLINE getConnShortLink #-}
441442
443+ getConnLinkPrivKey :: AgentClient -> ConnId -> AE (Maybe C. PrivateKeyEd25519 )
444+ getConnLinkPrivKey c = withAgentEnv c . getConnLinkPrivKey' c
445+ {-# INLINE getConnLinkPrivKey #-}
446+
442447-- | This irreversibly deletes short link data, and it won't be retrievable again
443448deleteLocalInvShortLink :: AgentClient -> ConnShortLink 'CMInvitation -> AE ()
444449deleteLocalInvShortLink c = withAgentEnv c . deleteLocalInvShortLink' c
@@ -1127,6 +1132,14 @@ deleteConnShortLink' c nm connId cMode =
11271132 (RcvConnection _ rq, SCMInvitation ) -> deleteQueueLink c nm rq
11281133 _ -> throwE $ CMD PROHIBITED " deleteConnShortLink: not contact address"
11291134
1135+ getConnLinkPrivKey' :: AgentClient -> ConnId -> AM (Maybe C. PrivateKeyEd25519 )
1136+ getConnLinkPrivKey' c connId = do
1137+ SomeConn _ conn <- withStore c (`getConn` connId)
1138+ pure $ case conn of
1139+ ContactConnection _ rq -> linkPrivSigKey <$> shortLink rq
1140+ RcvConnection _ rq -> linkPrivSigKey <$> shortLink rq
1141+ _ -> Nothing
1142+
11301143-- TODO [short links] remove 1-time invitation data and link ID from the server after the message is sent.
11311144getConnShortLink' :: forall c . AgentClient -> NetworkRequestMode -> UserId -> ConnShortLink c -> AM (FixedLinkData c , ConnLinkData c )
11321145getConnShortLink' c nm userId = \ case
0 commit comments