Skip to content

Commit b4ca433

Browse files
authored
Merge pull request #23 from sacOO7/develop
Library upgrades and SSL pinning methods
2 parents dacebaa + 404278a commit b4ca433

File tree

5 files changed

+40
-22
lines changed

5 files changed

+40
-22
lines changed

Package.resolved

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ let package = Package(
1212
],
1313
dependencies: [
1414
// Dependencies declare other packages that this package depends on.
15-
.package(url: "https://github.com/daltoniam/Starscream.git", .exact("3.0.4")),
16-
.package(url: "https://github.com/alibaba/HandyJSON.git", .exact("4.1.0")),
15+
.package(url: "https://github.com/daltoniam/Starscream.git", .exact("3.0.5")),
16+
.package(url: "https://github.com/alibaba/HandyJSON.git", .exact("4.2.0")),
1717
],
1818
targets: [
1919
.target(

ScClient.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "ScClient"
19-
s.version = "1.0.7"
19+
s.version = "1.0.8"
2020
s.summary = "A socketcluster client for iOS and OSX."
2121
s.swift_version = '3.2'
2222

@@ -136,6 +136,6 @@ Pod::Spec.new do |s|
136136
s.requires_arc = true
137137

138138
# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
139-
s.dependency "Starscream", "~> 3.0.4"
140-
s.dependency "HandyJSON", "~> 4.1.0"
139+
s.dependency "Starscream", "~> 3.0.5"
140+
s.dependency "HandyJSON", "~> 4.2.0"
141141
end

Sources/ScClient/client.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,23 @@ public class ScClient : Listener, WebSocketDelegate {
196196
public func disableSSLVerification(value : Bool) {
197197
socket.disableSSLCertValidation = value
198198
}
199+
200+
/**
201+
Uses the .cer files in your app's bundle
202+
*/
203+
public func useSSLCertificate() {
204+
socket.security = SSLSecurity()
205+
}
206+
207+
/**
208+
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.
209+
- Parameters:
210+
- data: Data blob of your certificate.
211+
- usePublicKeys: The usePublicKeys bool is whether to use the certificates for validation or the public keys.
212+
*/
213+
public func loadSSLCertificateFromData(data : Data, usePublicKeys : Bool = false) {
214+
socket.security = SSLSecurity(certs: [SSLCert(data: data)], usePublicKeys: usePublicKeys)
215+
}
216+
199217
}
200218

Tests/ScClientTests/MiscellaneousTest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class MiscellaneousTest: XCTestCase {
1111

1212
func testShouldSerializeData() {
1313
let emitEvent = Model.getEmitEventObject(eventName: "chat", data: "My Sample Data" as AnyObject, messageId: 2)
14-
let expectedData = "{\"cid\":2,\"event\":\"chat\",\"data\":\"My Sample Data\"}"
14+
let expectedData = "{\"data\":\"My Sample Data\",\"event\":\"chat\",\"cid\":2}"
1515
XCTAssertEqual(expectedData, emitEvent.toJSONString())
1616
}
1717

0 commit comments

Comments
 (0)