James
James

Reputation: 18379

Trying to build the open source Signal iOS app and connect to my own server

I'm trying to build the Signal iOS app to connect to my own Signal server.

I have already successfully built the Signal Android app to connect to my own server.

For both I followed the article, https://github.com/madeindra/setup-guide/tree/master/signal-ios

Using Signal iOS build 3.13.2.6 XCode 12

I was able to get the app to build in XCode after some effort. The app ran, got through the verify phone number screen (so I assume was able to hit our server successfully and I got the SMS message through Twilio) Next was the User info screen asking for name, this crashed with this error,

**Fatal error: [OWSUploadV2.swift:78 upload(data:uploadForm:uploadUrlPath:progressBlock:)]: Error: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://xxx.cloudfront.net/, NSErrorFailingURLKey=https://xxx.cloudfront.net/, _NSURLErrorRelatedURLSessionTaskErrorKey=(**
**"LocalUploadTask <2455BE4E-077E-4FD5-B8FA-7F03FD733F70>.<1>"**
**), _NSURLErrorFailingURLSessionTaskErrorKey=LocalUploadTask <2455BE4E-077E-4FD5-B8FA-7F03FD733F70>.<1>, NSLocalizedDescription=cancelled}: file SignalCoreKit/OWSSwiftUtils.swift, line 35**

This seemed to be some kind of SSL issue, although opening the cloudfront URL in a browser or in the Android app did not have any issues.

I added the code to OWSUploadV2.swift,

class func upload(data: Data,... {
        var uploadSessionManager = self.uploadSessionManager
        let securityPolicy = AFSecurityPolicy(pinningMode: AFSSLPinningMode.none)
            securityPolicy.validatesDomainName = false
            securityPolicy.allowInvalidCertificates = true
        uploadSessionManager.securityPolicy = securityPolicy

and this seemed to solve the issue, but not sure why the issue occurred...

so this gets me to the next screen for entering a PIN, but this crashed with the error,

**2020-10-08 14:22:10:284 Signal[4202:2191958]** đź’› **[OWSWebSocket.m:605 -[OWSWebSocket processWebSocketResponseMessageAsync:]]: received WebSocket response requestId: 7765599138296075969, status: 200**
**2020-10-08 14:22:10:287 Signal[4202:2191848]** ❤️ **[VersionedProfilesImpl.swift:234 didFetchProfile(profile:profileRequest:)]: Invalid credential: VerificationFailed.**
**Fatal error: [VersionedProfilesImpl.swift:234 didFetchProfile(profile:profileRequest:)]: Invalid credential: VerificationFailed.: file SignalCoreKit/OWSSwiftUtils.swift, line 35**

This is where I am stuck. Anyone have any ideas? Has anyone else successfully got Signal iOS connecting to their own server?

*** some more info

So this error occurs in line 234 of VersionedProfilesImpl.swift didFetchProfile()

in receiveProfileKeyCredential()

let credentialResponse = try ProfileKeyCredentialResponse(contents: UInt8)
let clientZkProfileOperations = try self.clientZkProfileOperations()
let profileKeyCredential = try clientZkProfileOperations.receiveProfileKeyCredential(profileKeyCredentialRequestContext: requestContext, profileKeyCredentialResponse: credentialResponse)

In the server logs I see,

127.0.0.1 - - [16/Oct/2020:14:40:50 +0000] “GET /v1/accounts/apn/preauth/3d80bda824920abd18b41aee5bb2559e01545705d52e7e00da49f3a43a745d96/+16137966017 HTTP/1.1” 200 0 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 9
127.0.0.1 - - [16/Oct/2020:14:40:50 +0000] “GET /v1/accounts/sms/code/+16137966017?client=ios HTTP/1.1” 200 0 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 11
127.0.0.1 - - [16/Oct/2020:14:41:21 +0000] “PUT /v1/accounts/code/443388?transfer=true HTTP/1.1” 200 70 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 153
127.0.0.1 - - [16/Oct/2020:14:41:21 +0000] “PUT /v1/accounts/attributes/ HTTP/1.1” 204 0 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 96
127.0.0.1 - - [16/Oct/2020:14:41:21 +0000] “PUT /v2/keys HTTP/1.1” 204 0 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 24
127.0.0.1 - - [16/Oct/2020:14:41:22 +0000] “PUT /v1/accounts/apn HTTP/1.1” 204 0 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 111
127.0.0.1 - - [16/Oct/2020:14:41:22 +0000] “GET /v1/profile/1337589b-38e8-4d09-9ae1-0c362b94ef42/af9e332d7ad279230a009d6ceb08928ce016207edd535d9fcfd5b1a34c76b9e1/0092959035165afc50b3e02c63520618462daec7f9fbe0a33a0fa2a4b5f84b5e4e78a149606a4b2b3e3221dc266093d337bf2cbbd38029bfc0d8d608a4e3945a02f83663dcb4a504c717f63bcdbf89cc86a22aaaa88b15d792fd0a9c6328eb1a475ab4612763ec95b77cf3227bd07b601f9a5b3e3b976987b2d14282227e33dc5b1695eadb513c99c047bb0f5568265d9279b21dc49c9acf7de0f6393fd1230d56a0000000000000007fad1caa1ea858ce6ca91e4db5ab60e2d4b5dba0d561ca1f8da2bbdbefed7c0ed1d630313e05e474b42c95cb6fe42ea38e27a13510ab99170b147372f4270200fc41ae958ed04c10b3fb182f34bb7d27ab030df1ee2aa01bb3da848a6fb14a0e3bc5e1583dadaefa66d3b9232e9ac0f33cc651b7ac01e21320d3d413041ffb091a3756f0eda2cf8ec4d0a2280bffbb40741db358ad4d29ef3be1542aeb59ad0a HTTP/1.1” 200 281 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 110
127.0.0.1 - - [16/Oct/2020:14:41:22 +0000] “GET /v1/config/ HTTP/1.1” 200 13 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 140
127.0.0.1 - - [16/Oct/2020:14:41:22 +0000] “GET /v1/websocket/?login=1337589B-38E8-4D09-9AE1-0C362B94EF42&password=0f9a8ed6a5909226b76f520fe7181447 HTTP/1.1” 101 0 “-” “-” 6
127.0.0.1 - - [16/Oct/2020:14:41:22 +0000] “GET /v1/certificate/delivery?includeUuid=true HTTP/1.1” 200 386 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 2
127.0.0.1 - - [16/Oct/2020:14:41:22 +0000] “PUT /v1/directory/tokens HTTP/1.1” 200 173 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 9
127.0.0.1 - - [16/Oct/2020:14:41:22 +0000] “GET /v2/attachments/form/upload HTTP/1.1” 200 908 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 117
174.112.230.123 - - [16/Oct/2020:14:41:23 +0000] “GET /v2/attachments/form/upload WS” 200 911 “-” “-”
127.0.0.1 - - [16/Oct/2020:14:41:23 +0000] “GET /v1/certificate/delivery?includeUuid=true HTTP/1.1” 200 386 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 3
174.112.230.123 - - [16/Oct/2020:14:41:23 +0000] “PUT /v1/messages/1337589B-38E8-4D09-9AE1-0C362B94EF42 WS” 200 19 “-” “-”
174.112.230.123 - - [16/Oct/2020:14:41:23 +0000] “GET /v2/attachments/form/upload WS” 200 911 “-” “-”
127.0.0.1 - - [16/Oct/2020:14:41:23 +0000] “GET /v1/certificate/delivery?includeUuid=true HTTP/1.1” 200 386 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 9
127.0.0.1 - - [16/Oct/2020:14:41:24 +0000] “GET /v1/certificate/delivery?includeUuid=true HTTP/1.1” 200 386 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 3
174.112.230.123 - - [16/Oct/2020:14:41:30 +0000] “GET /v2/attachments/form/upload WS” 200 911 “-” “-”
127.0.0.1 - - [16/Oct/2020:14:41:30 +0000] “PUT /v1/profile/ HTTP/1.1” 200 0 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 123
127.0.0.1 - - [16/Oct/2020:14:41:30 +0000] “GET /v1/certificate/delivery?includeUuid=true HTTP/1.1” 200 386 “-” “Signal/3.13.2 (iPhone; iOS 13.7; Scale/2.00)” 6
174.112.230.123 - - [16/Oct/2020:14:41:30 +0000] “GET /v1/profile/1337589b-38e8-4d09-9ae1-0c362b94ef42/af9e332d7ad279230a009d6ceb08928ce016207edd535d9fcfd5b1a34c76b9e1/00bc7024e8593f2ca3665200bc3c71dee84f3524d883fd22edbddc6559efa13618ac2a3736c8086c1aa1bf5751eee2f888889fffc6e1c69f780cc8f3c17a6c1e11dc7f701c382d730165315b30030135fe3f7ff3a3ef8130415ce32af84961022a02f28cea455dd5ab797d27a1387e84c8a9ef67e9f8e643d403f070953402941ea0476ff62c5c035790b6498859327a70700655658cc0c219dcd2e28c2561ac25a000000000000000ed8bc9223598e010648d19f3d3687763ab922475a3359056df73fa88f0652901213e131a46dd57be49160d2b303b724d579d1dabc51f01acb74e2e8976a1d4053787f9c02d5f37535e8fdc0cec7a06fda935f679a479b13bb6e4eb37923ded00bf9dadf786813b400dbad61886132030d881c99860392ddafc33c5bd85bd4f0b4e0165418bb91896a73c726624ee6759c732543d6287ec7162d781532dde1200 WS” 200 997 “-” “-”

Any idea what the cause could be? I can connect from Android to the same server with the same settings.

Upvotes: 6

Views: 1265

Answers (2)

James
James

Reputation: 18379

So I was able to get it to work in the latest XCode. I think it was meant for XCode 11, so just to get it to compile I had to make changes in,

DebugUIStress.swift

BlurHashEncode.swift

(but if anyone has correct updates to these classes please post)

To get the app to run I made changes in,

OWSUploadV2.swift

  • ignored SSL certificate error

ClientZkProfileOperations.swift

  • ignored profile credential errors

KeyBackupService.swift

  • ignored errors

It is now running, and I can send messages, but still having some issues.

Upvotes: 1

Alvaro Artano
Alvaro Artano

Reputation: 116

It seems like there's a problem uploading something to aws cloudfront. It gives you a -999 error. The -999 error is this one:

-999 is caused by ErrorCancelled. This means: another request is made before the previous request is completed.

Is the program making a request before uploading the profile details to the server?

Upvotes: 0

Related Questions