Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 0fafaae

Browse files
committed
Initial commit
0 parents  commit 0fafaae

File tree

137 files changed

+6554
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+6554
-0
lines changed

.DS_Store

8 KB
Binary file not shown.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.developer.authentication-services.autofill-credential-provider</key>
6+
<true/>
7+
<key>com.apple.security.application-groups</key>
8+
<array>
9+
<string>group.OpenSesame.ethanlipnik</string>
10+
</array>
11+
<key>keychain-access-groups</key>
12+
<array>
13+
<string>$(AppIdentifierPrefix)OpenSesame</string>
14+
<string>$(AppIdentifierPrefix)com.ethanlipnik.OpenSesame</string>
15+
</array>
16+
</dict>
17+
</plist>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19158" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Xki-Si-B7m">
3+
<device id="retina4_7" orientation="portrait" appearance="light"/>
4+
<dependencies>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19141"/>
6+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
7+
<capability name="System colors in document resources" minToolsVersion="11.0"/>
8+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
9+
</dependencies>
10+
<scenes>
11+
<!--Credential Provider View Controller-->
12+
<scene sceneID="Uma-9u-xWV">
13+
<objects>
14+
<viewController id="Xki-Si-B7m" customClass="CredentialProviderViewController" customModule="AutoFill_iOS" customModuleProvider="target" sceneMemberID="viewController">
15+
<view key="view" contentMode="scaleToFill" id="BuU-Ak-iZz">
16+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
17+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18+
<subviews>
19+
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="insetGrouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" estimatedSectionHeaderHeight="-1" sectionFooterHeight="18" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="1bA-AU-EX3">
20+
<rect key="frame" x="0.0" y="44" width="375" height="623"/>
21+
<prototypes>
22+
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="cell" textLabel="rO2-ll-Zkn" detailTextLabel="QA8-Sd-jfk" style="IBUITableViewCellStyleSubtitle" id="BI2-kO-Thi">
23+
<rect key="frame" x="16" y="49.5" width="343" height="53.5"/>
24+
<autoresizingMask key="autoresizingMask"/>
25+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="BI2-kO-Thi" id="iGP-w8-BVV">
26+
<rect key="frame" x="0.0" y="0.0" width="343" height="53.5"/>
27+
<autoresizingMask key="autoresizingMask"/>
28+
<subviews>
29+
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Website" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" id="rO2-ll-Zkn">
30+
<rect key="frame" x="16" y="7.5" width="55" height="17"/>
31+
<autoresizingMask key="autoresizingMask"/>
32+
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
33+
<nil key="textColor"/>
34+
<nil key="highlightedColor"/>
35+
</label>
36+
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Username or Email" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" id="QA8-Sd-jfk">
37+
<rect key="frame" x="16" y="27" width="121.5" height="17"/>
38+
<autoresizingMask key="autoresizingMask"/>
39+
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
40+
<color key="textColor" systemColor="secondaryLabelColor"/>
41+
<nil key="highlightedColor"/>
42+
</label>
43+
</subviews>
44+
</tableViewCellContentView>
45+
</tableViewCell>
46+
</prototypes>
47+
</tableView>
48+
<navigationBar contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tm6-qG-uHm">
49+
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
50+
<items>
51+
<navigationItem title="OpenSesame" id="HfY-ib-6qt">
52+
<barButtonItem key="leftBarButtonItem" systemItem="cancel" id="bEZ-MG-jDy">
53+
<connections>
54+
<action selector="cancel:" destination="Xki-Si-B7m" id="6ap-3Q-iEX"/>
55+
</connections>
56+
</barButtonItem>
57+
</navigationItem>
58+
</items>
59+
</navigationBar>
60+
</subviews>
61+
<viewLayoutGuide key="safeArea" id="Ky8-vK-JVj"/>
62+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
63+
<constraints>
64+
<constraint firstItem="1bA-AU-EX3" firstAttribute="leading" secondItem="Ky8-vK-JVj" secondAttribute="leading" id="Jcc-6j-eF7"/>
65+
<constraint firstItem="tm6-qG-uHm" firstAttribute="leading" secondItem="Ky8-vK-JVj" secondAttribute="leading" id="Oyi-gA-lN0"/>
66+
<constraint firstItem="tm6-qG-uHm" firstAttribute="top" secondItem="Ky8-vK-JVj" secondAttribute="top" id="P51-c8-dkn"/>
67+
<constraint firstItem="1bA-AU-EX3" firstAttribute="trailing" secondItem="Ky8-vK-JVj" secondAttribute="trailing" id="auJ-ET-46P"/>
68+
<constraint firstItem="1bA-AU-EX3" firstAttribute="bottom" secondItem="Ky8-vK-JVj" secondAttribute="bottom" id="nLw-td-12b"/>
69+
<constraint firstItem="tm6-qG-uHm" firstAttribute="trailing" secondItem="Ky8-vK-JVj" secondAttribute="trailing" id="rDd-9x-EO6"/>
70+
<constraint firstItem="1bA-AU-EX3" firstAttribute="top" secondItem="tm6-qG-uHm" secondAttribute="bottom" id="scf-gN-CkY"/>
71+
</constraints>
72+
</view>
73+
<connections>
74+
<outlet property="tableView" destination="1bA-AU-EX3" id="Um5-Hd-nAk"/>
75+
</connections>
76+
</viewController>
77+
<placeholder placeholderIdentifier="IBFirstResponder" id="RwB-HB-TSk" userLabel="First Responder" sceneMemberID="firstResponder"/>
78+
</objects>
79+
<point key="canvasLocation" x="928.79999999999995" y="97.601199400299862"/>
80+
</scene>
81+
</scenes>
82+
<resources>
83+
<systemColor name="secondaryLabelColor">
84+
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
85+
</systemColor>
86+
<systemColor name="systemBackgroundColor">
87+
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
88+
</systemColor>
89+
</resources>
90+
</document>
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
//
2+
// CredentialProviderViewController.swift
3+
// AutoFill iOS
4+
//
5+
// Created by Ethan Lipnik on 8/18/21.
6+
//
7+
8+
import AuthenticationServices
9+
import DomainParser
10+
import KeychainAccess
11+
12+
class CredentialProviderViewController: ASCredentialProviderViewController {
13+
@IBOutlet weak var tableView: UITableView!
14+
15+
let viewContext = PersistenceController.shared.container.viewContext
16+
var accounts: [Account] = []
17+
var allAccounts: [Account] = []
18+
19+
/*
20+
Implement this method if your extension supports showing credentials in the QuickType bar.
21+
When the user selects a credential from your app, this method will be called with the
22+
ASPasswordCredentialIdentity your app has previously saved to the ASCredentialIdentityStore.
23+
Provide the password by completing the extension request with the associated ASPasswordCredential.
24+
If using the credential would require showing custom UI for authenticating the user, cancel
25+
the request with error code ASExtensionError.userInteractionRequired.
26+
27+
override func provideCredentialWithoutUserInteraction(for credentialIdentity: ASPasswordCredentialIdentity) {
28+
let databaseIsUnlocked = true
29+
if (databaseIsUnlocked) {
30+
let passwordCredential = ASPasswordCredential(user: "j_appleseed", password: "apple1234")
31+
self.extensionContext.completeRequest(withSelectedCredential: passwordCredential, completionHandler: nil)
32+
} else {
33+
self.extensionContext.cancelRequest(withError: NSError(domain: ASExtensionErrorDomain, code:ASExtensionError.userInteractionRequired.rawValue))
34+
}
35+
}
36+
*/
37+
38+
/*
39+
Implement this method if provideCredentialWithoutUserInteraction(for:) can fail with
40+
ASExtensionError.userInteractionRequired. In this case, the system may present your extension's
41+
UI and call this method. Show appropriate UI for authenticating the user then provide the password
42+
by completing the extension request with the associated ASPasswordCredential.
43+
44+
override func prepareInterfaceToProvideCredential(for credentialIdentity: ASPasswordCredentialIdentity) {
45+
}
46+
*/
47+
48+
override func prepareInterfaceToProvideCredential(for credentialIdentity: ASPasswordCredentialIdentity) {
49+
50+
}
51+
52+
@IBAction func cancel(_ sender: AnyObject?) {
53+
self.extensionContext.cancelRequest(withError: NSError(domain: ASExtensionErrorDomain, code: ASExtensionError.userCanceled.rawValue))
54+
}
55+
}
56+
57+
extension CredentialProviderViewController: UITableViewDelegate, UITableViewDataSource {
58+
59+
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
60+
return section == 0 ? nil : "All Accounts"
61+
}
62+
63+
func numberOfSections(in tableView: UITableView) -> Int {
64+
return accounts.isEmpty ? 1 : 2
65+
}
66+
67+
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
68+
if section == 0 && !accounts.isEmpty {
69+
return accounts.count
70+
} else {
71+
return allAccounts.count
72+
}
73+
}
74+
75+
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
76+
var account: Account!
77+
if indexPath.section == 0 && !accounts.isEmpty {
78+
account = accounts[indexPath.item]
79+
} else {
80+
account = allAccounts[indexPath.item]
81+
}
82+
83+
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
84+
85+
cell.textLabel?.text = account.domain
86+
cell.detailTextLabel?.text = account.username
87+
88+
return cell
89+
}
90+
91+
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
92+
var account: Account!
93+
if indexPath.section == 0 && !accounts.isEmpty {
94+
account = accounts[indexPath.item]
95+
} else {
96+
account = allAccounts[indexPath.item]
97+
}
98+
99+
do {
100+
let decryptedAccount = try decryptedAccount(account)
101+
let passwordCredential = ASPasswordCredential(user: decryptedAccount.username, password: decryptedAccount.password)
102+
self.extensionContext.completeRequest(withSelectedCredential: passwordCredential, completionHandler: nil)
103+
} catch {
104+
self.extensionContext.cancelRequest(withError: error)
105+
}
106+
}
107+
}

AutoFill iOS/Info.plist

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>NSExtension</key>
6+
<dict>
7+
<key>NSExtensionMainStoryboard</key>
8+
<string>MainInterface</string>
9+
<key>NSExtensionPointIdentifier</key>
10+
<string>com.apple.authentication-services-credential-provider-ui</string>
11+
</dict>
12+
</dict>
13+
</plist>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.developer.authentication-services.autofill-credential-provider</key>
6+
<true/>
7+
<key>com.apple.security.application-groups</key>
8+
<array>
9+
<string>group.OpenSesame.ethanlipnik</string>
10+
</array>
11+
<key>keychain-access-groups</key>
12+
<array>
13+
<string>$(AppIdentifierPrefix)com.ethanlipnik.OpenSesame</string>
14+
<string>$(AppIdentifierPrefix)OpenSesame</string>
15+
</array>
16+
</dict>
17+
</plist>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17021" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17021"/>
5+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
6+
</dependencies>
7+
<objects>
8+
<customObject id="-2" userLabel="File's Owner" customClass="CredentialProviderViewController" customModuleProvider="target">
9+
<connections>
10+
<outlet property="view" destination="1" id="2"/>
11+
</connections>
12+
</customObject>
13+
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
14+
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
15+
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1">
16+
<rect key="frame" x="0.0" y="0.0" width="378" height="94"/>
17+
<subviews>
18+
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1uM-r7-H1c">
19+
<rect key="frame" x="177" y="3" width="197" height="32"/>
20+
<buttonCell key="cell" type="push" title="Return Example Password" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="2l4-PO-we5">
21+
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
22+
<font key="font" metaFont="system"/>
23+
<string key="keyEquivalent">D</string>
24+
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
25+
</buttonCell>
26+
<connections>
27+
<action selector="passwordSelected:" target="-2" id="yic-EC-GGk"/>
28+
</connections>
29+
</button>
30+
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NVE-vN-dkz">
31+
<rect key="frame" x="99" y="3" width="82" height="32"/>
32+
<constraints>
33+
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="60" id="cP1-hK-9ZX"/>
34+
</constraints>
35+
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="6Up-t3-mwm">
36+
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
37+
<font key="font" metaFont="system"/>
38+
<string key="keyEquivalent" base64-UTF8="YES">
39+
Gw
40+
</string>
41+
</buttonCell>
42+
<connections>
43+
<action selector="cancel:" target="-2" id="Qav-AK-DGt"/>
44+
</connections>
45+
</button>
46+
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aNc-0i-CWK">
47+
<rect key="frame" x="135" y="63" width="108" height="16"/>
48+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="AutoFill macOS" id="0xp-rC-2gr">
49+
<font key="font" metaFont="systemBold"/>
50+
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
51+
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
52+
</textFieldCell>
53+
</textField>
54+
</subviews>
55+
<constraints>
56+
<constraint firstItem="1uM-r7-H1c" firstAttribute="leading" secondItem="NVE-vN-dkz" secondAttribute="trailing" constant="8" id="1UO-J1-LbJ"/>
57+
<constraint firstItem="NVE-vN-dkz" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="3N9-qo-UfS"/>
58+
<constraint firstAttribute="bottom" secondItem="1uM-r7-H1c" secondAttribute="bottom" constant="10" id="4wH-De-nMF"/>
59+
<constraint firstItem="NVE-vN-dkz" firstAttribute="firstBaseline" secondItem="aNc-0i-CWK" secondAttribute="baseline" constant="50" id="Dpq-cK-cPE"/>
60+
<constraint firstAttribute="bottom" secondItem="NVE-vN-dkz" secondAttribute="bottom" constant="10" id="USG-Gg-of3"/>
61+
<constraint firstItem="1uM-r7-H1c" firstAttribute="leading" secondItem="NVE-vN-dkz" secondAttribute="trailing" constant="8" id="a8N-vS-Ew9"/>
62+
<constraint firstAttribute="trailing" secondItem="1uM-r7-H1c" secondAttribute="trailing" constant="10" id="qfT-cw-QQ2"/>
63+
<constraint firstAttribute="centerX" secondItem="aNc-0i-CWK" secondAttribute="centerX" id="uV3-Wn-RA3"/>
64+
<constraint firstItem="aNc-0i-CWK" firstAttribute="top" secondItem="1" secondAttribute="top" constant="15" id="vpR-tf-ebx"/>
65+
</constraints>
66+
<point key="canvasLocation" x="162" y="146"/>
67+
</customView>
68+
</objects>
69+
</document>

0 commit comments

Comments
 (0)