iPhone client for network-computer: see and drive a remote Linux/Mac desktop over WebRTC, phone as trackpad and keyboard, desktop on a TV via AirPlay.

0 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/network-computer-ios.git
HTTPS
https://gitstable.com/git/askrobots/network-computer-ios.git
SSH
ssh://git@gitstable.com:2222/askrobots/network-computer-ios.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Dan Quellhorst First cut of the iPhone client cc1f67f 2 months ago History
Keychain.swift · 1.4 KB · 32 lines
1import Foundation
2import Security
3
4/// Minimal Keychain wrapper. Passwords and PINs live here, never in UserDefaults or code.
5enum Keychain {
6 private static let service = "com.askrobots.networkcomputer"
7
8 static func set(_ value: String, for key: String) {
9 let data = Data(value.utf8)
10 let query: [String: Any] = [kSecClass as String: kSecClassGenericPassword,
11 kSecAttrService as String: service,
12 kSecAttrAccount as String: key]
13 SecItemDelete(query as CFDictionary)
14 if value.isEmpty { return }
15 var add = query
16 add[kSecValueData as String] = data
17 add[kSecAttrAccessible as String] = kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
18 SecItemAdd(add as CFDictionary, nil)
19 }
20
21 static func get(_ key: String) -> String {
22 let query: [String: Any] = [kSecClass as String: kSecClassGenericPassword,
23 kSecAttrService as String: service,
24 kSecAttrAccount as String: key,
25 kSecReturnData as String: true,
26 kSecMatchLimit as String: kSecMatchLimitOne]
27 var out: AnyObject?
28 guard SecItemCopyMatching(query as CFDictionary, &out) == errSecSuccess,
29 let data = out as? Data else { return "" }
30 return String(decoding: data, as: UTF8.self)
31 }
32}