Skip to content

Commit 305d89b

Browse files
chore(phone-as-device): app-481 get private key from Keychain
1 parent c745403 commit 305d89b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ios/MqttClient.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ class MqttClient : RCTEventEmitter {
6161
String(kSecAttrApplicationTag): keyTag as AnyObject,
6262
String(kSecReturnRef) : true as AnyObject
6363
]
64-
64+
6565
if #available(iOS 10, *) {
6666
query[String(kSecAttrKeyType)] = kSecAttrKeyTypeECSECPrimeRandom
6767
} else {
6868
// Fallback on earlier versions
6969
query[String(kSecAttrKeyType)] = kSecAttrKeyTypeEC
7070
}
71-
71+
7272
var result : AnyObject?
73-
73+
7474
let status = SecItemCopyMatching(query as CFDictionary, &result)
75-
75+
7676
if status == errSecSuccess {
7777
print("\(keyTag) Key existed!")
7878
block((result as! SecKey?)!)
@@ -99,7 +99,7 @@ class MqttClient : RCTEventEmitter {
9999
reject("RANGE_ERROR", "invalid certificate", nil)
100100
return
101101
}
102-
102+
103103
let block: SecKeyPerformBlock = { privateKey in
104104
do {
105105
// adds the private key to the keychain
@@ -162,7 +162,7 @@ class MqttClient : RCTEventEmitter {
162162
self.certArray = [identity!, caCert] as CFArray
163163
resolve(nil)
164164
}
165-
165+
166166
self.loadPrivateKeyFromKeychain(keyTag: keyTag, reject: reject, block: block)
167167
}
168168

0 commit comments

Comments
 (0)