diff --git a/Package.resolved b/Package.resolved index dec3528..3c5301b 100644 --- a/Package.resolved +++ b/Package.resolved @@ -2,39 +2,39 @@ "object": { "pins": [ { - "package": "HandyJSON", - "repositoryURL": "https://github.com/alibaba/HandyJSON.git", + "package": "SSCommonCrypto", + "repositoryURL": "https://github.com/daltoniam/common-crypto-spm", "state": { "branch": null, - "revision": "a8b42d8d989803a1f376aa3456f44b5efc445161", - "version": "4.1.0" + "revision": "2eb3aff0fb57f92f5722fac5d6d20bf64669ca66", + "version": "1.1.0" } }, { - "package": "SSCZLib", - "repositoryURL": "https://github.com/daltoniam/zlib-spm.git", + "package": "HandyJSON", + "repositoryURL": "https://github.com/alibaba/HandyJSON.git", "state": { "branch": null, - "revision": "83ac8d719a2f3aa775dbdf116a57f56fb2c49abb", - "version": "1.1.0" + "revision": "0eaec774ff559c50bf290c2c457de2320a9dbcfe", + "version": "4.2.0" } }, { - "package": "SSCommonCrypto", - "repositoryURL": "https://github.com/daltoniam/common-crypto-spm", + "package": "Starscream", + "repositoryURL": "https://github.com/daltoniam/Starscream.git", "state": { "branch": null, - "revision": "2eb3aff0fb57f92f5722fac5d6d20bf64669ca66", - "version": "1.1.0" + "revision": "114e5df9b6251970a069e8f1c0cbb5802759f0a9", + "version": "3.0.5" } }, { - "package": "Starscream", - "repositoryURL": "https://github.com/daltoniam/Starscream.git", + "package": "SSCZLib", + "repositoryURL": "https://github.com/daltoniam/zlib-spm.git", "state": { "branch": null, - "revision": "6e10c04c8387d00f41a17450fa45b51427971022", - "version": "3.0.4" + "revision": "83ac8d719a2f3aa775dbdf116a57f56fb2c49abb", + "version": "1.1.0" } } ] diff --git a/Package.swift b/Package.swift index f8d340d..174b5d9 100644 --- a/Package.swift +++ b/Package.swift @@ -12,8 +12,8 @@ let package = Package( ], dependencies: [ // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/daltoniam/Starscream.git", .exact("3.0.4")), - .package(url: "https://github.com/alibaba/HandyJSON.git", .exact("4.1.0")), + .package(url: "https://github.com/daltoniam/Starscream.git", .exact("3.0.5")), + .package(url: "https://github.com/alibaba/HandyJSON.git", .exact("4.2.0")), ], targets: [ .target( diff --git a/ScClient.podspec b/ScClient.podspec index 4506e2d..b25ecd4 100644 --- a/ScClient.podspec +++ b/ScClient.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |s| # s.name = "ScClient" - s.version = "1.0.7" + s.version = "1.0.8" s.summary = "A socketcluster client for iOS and OSX." s.swift_version = '3.2' @@ -136,6 +136,6 @@ Pod::Spec.new do |s| s.requires_arc = true # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } - s.dependency "Starscream", "~> 3.0.4" - s.dependency "HandyJSON", "~> 4.1.0" + s.dependency "Starscream", "~> 3.0.5" + s.dependency "HandyJSON", "~> 4.2.0" end diff --git a/Sources/ScClient/client.swift b/Sources/ScClient/client.swift index e5d949a..34bcc48 100644 --- a/Sources/ScClient/client.swift +++ b/Sources/ScClient/client.swift @@ -196,5 +196,23 @@ public class ScClient : Listener, WebSocketDelegate { public func disableSSLVerification(value : Bool) { socket.disableSSLCertValidation = value } + + /** + Uses the .cer files in your app's bundle + */ + public func useSSLCertificate() { + socket.security = SSLSecurity() + } + + /** + You load either a Data blob of your certificate or you can use a SecKeyRef if you have a public key you want to use. + - Parameters: + - data: Data blob of your certificate. + - usePublicKeys: The usePublicKeys bool is whether to use the certificates for validation or the public keys. + */ + public func loadSSLCertificateFromData(data : Data, usePublicKeys : Bool = false) { + socket.security = SSLSecurity(certs: [SSLCert(data: data)], usePublicKeys: usePublicKeys) + } + } diff --git a/Tests/ScClientTests/MiscellaneousTest.swift b/Tests/ScClientTests/MiscellaneousTest.swift index 112f191..f78669e 100644 --- a/Tests/ScClientTests/MiscellaneousTest.swift +++ b/Tests/ScClientTests/MiscellaneousTest.swift @@ -11,7 +11,7 @@ class MiscellaneousTest: XCTestCase { func testShouldSerializeData() { let emitEvent = Model.getEmitEventObject(eventName: "chat", data: "My Sample Data" as AnyObject, messageId: 2) - let expectedData = "{\"cid\":2,\"event\":\"chat\",\"data\":\"My Sample Data\"}" + let expectedData = "{\"data\":\"My Sample Data\",\"event\":\"chat\",\"cid\":2}" XCTAssertEqual(expectedData, emitEvent.toJSONString()) }