xftp: add basic auth (#653)

This commit is contained in:
Evgeny Poberezkin authored and GitHub committed 2023-02-24 17:40:26 +04:00
1 parent 202922bceb
commit 8c8a984c1c
7 files changed
+94 -49

No files matched your search

+5 -3
View File
@@ -33,7 +33,8 @@ import Simplex.Messaging.Client
import qualified Simplex.Messaging.Crypto as C
import qualified Simplex.Messaging.Crypto.Lazy as LC
import Simplex.Messaging.Protocol
( Protocol (..),
( BasicAuth,
Protocol (..),
ProtocolServer (..),
RecipientId,
SenderId,
@@ -128,9 +129,10 @@ createXFTPChunk ::
C.APrivateSignKey ->
FileInfo ->
NonEmpty C.APublicVerifyKey ->
Maybe BasicAuth ->
ExceptT XFTPClientError IO (SenderId, NonEmpty RecipientId)
createXFTPChunk c spKey file rsps =
sendXFTPCommand c spKey "" (FNEW file rsps) Nothing >>= \case
createXFTPChunk c spKey file rsps auth_ =
sendXFTPCommand c spKey "" (FNEW file rsps auth_) Nothing >>= \case
(FRSndIds sId rIds, body) -> noFile body (sId, rIds)
(r, _) -> throwError . PCEUnexpectedResponse $ bshow r