Fix macOS demo not connecting
Missing keychain sharing capabilities.
This commit is contained in:
parent
92fd620771
commit
d977c3317c
|
@ -143,24 +143,24 @@ class ViewController: UIViewController, URLSessionDataDelegate {
|
|||
}
|
||||
|
||||
private func testFetchRef() {
|
||||
// let keychain = Keychain(group: ViewController.APP_GROUP)
|
||||
// let username = "foo"
|
||||
// let password = "bar"
|
||||
//
|
||||
// guard let _ = try? keychain.set(password: password, for: username) else {
|
||||
// print("Couldn't set password")
|
||||
// return
|
||||
// }
|
||||
// guard let passwordReference = try? keychain.passwordReference(for: username) else {
|
||||
// print("Couldn't get password reference")
|
||||
// return
|
||||
// }
|
||||
// guard let fetchedPassword = try? Keychain.password(for: username, reference: passwordReference) else {
|
||||
// print("Couldn't fetch password")
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// print("\(username) -> \(password)")
|
||||
// print("\(username) -> \(fetchedPassword)")
|
||||
let keychain = Keychain(group: appGroup)
|
||||
let username = "foo"
|
||||
let password = "bar"
|
||||
|
||||
guard let _ = try? keychain.set(password: password, for: username, context: tunnelIdentifier) else {
|
||||
print("Couldn't set password")
|
||||
return
|
||||
}
|
||||
guard let passwordReference = try? keychain.passwordReference(for: username, context: tunnelIdentifier) else {
|
||||
print("Couldn't get password reference")
|
||||
return
|
||||
}
|
||||
guard let fetchedPassword = try? keychain.password(for: username, reference: passwordReference, context: tunnelIdentifier) else {
|
||||
print("Couldn't fetch password")
|
||||
return
|
||||
}
|
||||
|
||||
print("\(username) -> \(password)")
|
||||
print("\(username) -> \(fetchedPassword)")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,5 +14,9 @@
|
|||
</array>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>$(AppIdentifierPrefix)group.com.algoritmico.TunnelKit.Demo</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -14,5 +14,9 @@
|
|||
</array>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>$(AppIdentifierPrefix)group.com.algoritmico.TunnelKit.Demo</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -128,25 +128,25 @@ class ViewController: NSViewController {
|
|||
}
|
||||
|
||||
private func testFetchRef() {
|
||||
// let keychain = Keychain(group: ViewController.APP_GROUP)
|
||||
// let username = "foo"
|
||||
// let password = "bar"
|
||||
//
|
||||
// guard let _ = try? keychain.set(password: password, for: username) else {
|
||||
// print("Couldn't set password")
|
||||
// return
|
||||
// }
|
||||
// guard let passwordReference = try? keychain.passwordReference(for: username) else {
|
||||
// print("Couldn't get password reference")
|
||||
// return
|
||||
// }
|
||||
// guard let fetchedPassword = try? Keychain.password(for: username, reference: passwordReference) else {
|
||||
// print("Couldn't fetch password")
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// print("\(username) -> \(password)")
|
||||
// print("\(username) -> \(fetchedPassword)")
|
||||
let keychain = Keychain(group: appGroup)
|
||||
let username = "foo"
|
||||
let password = "bar"
|
||||
|
||||
guard let _ = try? keychain.set(password: password, for: username, context: tunnelIdentifier) else {
|
||||
print("Couldn't set password")
|
||||
return
|
||||
}
|
||||
guard let passwordReference = try? keychain.passwordReference(for: username, context: tunnelIdentifier) else {
|
||||
print("Couldn't get password reference")
|
||||
return
|
||||
}
|
||||
guard let fetchedPassword = try? keychain.password(for: username, reference: passwordReference, context: tunnelIdentifier) else {
|
||||
print("Couldn't fetch password")
|
||||
return
|
||||
}
|
||||
|
||||
print("\(username) -> \(password)")
|
||||
print("\(username) -> \(fetchedPassword)")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue