mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Fix build
This commit is contained in:
parent
92aba98cb7
commit
f7fc92cc0a
2 changed files with 4 additions and 4 deletions
|
@ -123,7 +123,9 @@ internal enum OnionRequestAPI {
|
|||
}
|
||||
|
||||
/// Returns a `Path` to be used for building an onion request. Builds new paths as needed.
|
||||
private static func getPath(excluding snode: LokiAPITarget) -> Promise<Path> {
|
||||
///
|
||||
/// - Note: Exposed for testing purposes.
|
||||
internal static func getPath(excluding snode: LokiAPITarget) -> Promise<Path> {
|
||||
guard pathSize >= 1 else { preconditionFailure("Cannot build path of size zero.") }
|
||||
// randomElement() uses the system's default random generator, which is cryptographically secure
|
||||
if paths.count >= pathCount {
|
||||
|
@ -199,10 +201,8 @@ internal enum OnionRequestAPI {
|
|||
let gcm = GCM(iv: iv.bytes, tagLength: Int(gcmTagSize), mode: .combined)
|
||||
let aes = try AES(key: targetSnodeSymmetricKey.bytes, blockMode: gcm, padding: .pkcs7)
|
||||
let result = try aes.decrypt(ciphertext.bytes)
|
||||
print("[Loki] [Onion Request API] Succeeded with result: \(String(data: Data(bytes: result), encoding: .utf8)!).")
|
||||
seal.fulfill(Data(bytes: result))
|
||||
} catch (let error) {
|
||||
print("[Loki] [Onion Request API] Decryption failed.")
|
||||
seal.reject(error)
|
||||
}
|
||||
}.catch(on: workQueue) { error in
|
||||
|
|
|
@ -9,7 +9,7 @@ class OnionRequestAPITests : XCTestCase {
|
|||
func testOnionRequestSending() {
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
LokiAPI.getRandomSnode().then(on: OnionRequestAPI.workQueue) { snode -> Promise<LokiAPITarget> in
|
||||
return OnionRequestAPI.getPath().map(on: OnionRequestAPI.workQueue) { _ in snode }
|
||||
return OnionRequestAPI.getPath(excluding: snode).map(on: OnionRequestAPI.workQueue) { _ in snode }
|
||||
}.done(on: OnionRequestAPI.workQueue) { snode in
|
||||
var successCount = 0
|
||||
var failureCount = 0
|
||||
|
|
Loading…
Reference in a new issue