some fixes
This commit is contained in:
1 parent
e1f27cd8b2
commit
95a1c62b54
16 files changed
+137
-51
No files matched your search
@@ -3,7 +3,7 @@ import Combine
|
||||
import CommonCrypto
|
||||
import CryptoKit
|
||||
import os
|
||||
import Martin
|
||||
@preconcurrency import Martin
|
||||
import MartinOMEMO
|
||||
|
||||
extension XmppModuleIdentifier {
|
||||
@@ -22,7 +22,7 @@ extension XmppModuleIdentifier {
|
||||
/// `<bundle>` with `<spk>/<spks>/<ik>/<prekeys><pk>`).
|
||||
/// The Double Ratchet sessions are shared with the legacy OMEMO module
|
||||
/// through the same SignalStorage.
|
||||
final class LumaOMEMO2Module: AbstractPEPModule, XmppModule {
|
||||
final class LumaOMEMO2Module: AbstractPEPModule, XmppModule, @unchecked Sendable {
|
||||
public static let ID = "omemo2"
|
||||
public static let IDENTIFIER = XmppModuleIdentifier<LumaOMEMO2Module>()
|
||||
public static let XMLNS = "urn:xmpp:omemo:2"
|
||||
@@ -98,7 +98,8 @@ final class LumaOMEMO2Module: AbstractPEPModule, XmppModule {
|
||||
return
|
||||
}
|
||||
let known = listEl.mapChildren(transform: { $0.getAttribute("id").flatMap(Int32.init) })
|
||||
self.devicesQueue.async { self.devices[jid] = known }
|
||||
let jidString = jid.stringValue
|
||||
self.devicesQueue.async { self.devices[BareJID(jidString)] = known }
|
||||
continuation.resume(returning: known)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ final class LumaSaslFailureModule: XmppModuleBase, XmppModule {
|
||||
}
|
||||
|
||||
func process(stanza: Stanza) throws {
|
||||
let condition = stanza.findChild()?.name
|
||||
let condition = stanza.firstChild(where: { _ in true })?.name
|
||||
let text = stanza.firstChild(name: "text")?.value
|
||||
lock.lock()
|
||||
stored = Failure(condition: condition, text: text)
|
||||
|
||||
@@ -61,7 +61,7 @@ enum SCRAMHash {
|
||||
|
||||
func hash(data: Data) -> Data {
|
||||
var output = [UInt8](repeating: 0, count: digestLength)
|
||||
data.withUnsafeBytes { bytes in
|
||||
_ = data.withUnsafeBytes { bytes in
|
||||
switch self {
|
||||
case .sha1:
|
||||
CC_SHA1(bytes.baseAddress, CC_LONG(bytes.count), &output)
|
||||
|
||||
@@ -201,7 +201,7 @@ final class LumaTLSNetworkProcessor: SocketConnector.NetworkProcessor, SSLNetwor
|
||||
override func read(data: Data) {
|
||||
guard !handshakeFailed else { return }
|
||||
ensureTLS()
|
||||
guard let ssl, let readBIO else { return }
|
||||
guard ssl != nil, let readBIO else { return }
|
||||
data.withUnsafeBytes { raw in
|
||||
_ = BIO_write(readBIO, raw.baseAddress, Int32(raw.count))
|
||||
}
|
||||
@@ -415,9 +415,7 @@ final class LumaTLSNetworkProcessor: SocketConnector.NetworkProcessor, SSLNetwor
|
||||
switch certificateValidation {
|
||||
case .default:
|
||||
SecTrustSetPolicies(trust, SecPolicyCreateSSL(true, domain as CFString))
|
||||
var result = SecTrustResultType.invalid
|
||||
SecTrustEvaluate(trust, &result)
|
||||
validated = result == .proceed || result == .unspecified
|
||||
validated = SecTrustEvaluateWithError(trust, nil)
|
||||
case .fingerprint(let fingerprint):
|
||||
validated = Self.matchesFingerprint(leafDER, fingerprint: fingerprint)
|
||||
case .customValidator(let validator):
|
||||
|
||||
Reference in new issue
Block a user