finish simple "add password function"
This commit is contained in:
parent
cbbb631e08
commit
b954a4dcab
13 changed files with 314 additions and 26 deletions
|
|
@ -15,6 +15,9 @@
|
||||||
DC037CAE1E4C9B9B00609409 /* PasswordRepositorySettingsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC037CAD1E4C9B9B00609409 /* PasswordRepositorySettingsTableViewController.swift */; };
|
DC037CAE1E4C9B9B00609409 /* PasswordRepositorySettingsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC037CAD1E4C9B9B00609409 /* PasswordRepositorySettingsTableViewController.swift */; };
|
||||||
DC037CB01E4CA51F00609409 /* GeneralSettingsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC037CAF1E4CA51F00609409 /* GeneralSettingsTableViewController.swift */; };
|
DC037CB01E4CA51F00609409 /* GeneralSettingsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC037CAF1E4CA51F00609409 /* GeneralSettingsTableViewController.swift */; };
|
||||||
DC037CB21E4CAB1700609409 /* AboutRepositoryTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC037CB11E4CAB1700609409 /* AboutRepositoryTableViewController.swift */; };
|
DC037CB21E4CAB1700609409 /* AboutRepositoryTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC037CB11E4CAB1700609409 /* AboutRepositoryTableViewController.swift */; };
|
||||||
|
DC037CB81E4DD1A500609409 /* AddPasswordTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC037CB71E4DD1A500609409 /* AddPasswordTableViewController.swift */; };
|
||||||
|
DC037CBB1E4DD47B00609409 /* TextFieldTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC037CB91E4DD47B00609409 /* TextFieldTableViewCell.swift */; };
|
||||||
|
DC037CBC1E4DD47B00609409 /* TextFieldTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = DC037CBA1E4DD47B00609409 /* TextFieldTableViewCell.xib */; };
|
||||||
DC1208581E35EBE60042942E /* ObjectiveGit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC1208571E35EBE60042942E /* ObjectiveGit.framework */; };
|
DC1208581E35EBE60042942E /* ObjectiveGit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC1208571E35EBE60042942E /* ObjectiveGit.framework */; };
|
||||||
DC193FFA1E49B4430077E0A3 /* AdvancedSettingsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC193FF91E49B4430077E0A3 /* AdvancedSettingsTableViewController.swift */; };
|
DC193FFA1E49B4430077E0A3 /* AdvancedSettingsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC193FF91E49B4430077E0A3 /* AdvancedSettingsTableViewController.swift */; };
|
||||||
DC193FFC1E49E0340077E0A3 /* PasscodeLock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC193FFB1E49E0340077E0A3 /* PasscodeLock.framework */; };
|
DC193FFC1E49E0340077E0A3 /* PasscodeLock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC193FFB1E49E0340077E0A3 /* PasscodeLock.framework */; };
|
||||||
|
|
@ -58,6 +61,9 @@
|
||||||
DC037CAD1E4C9B9B00609409 /* PasswordRepositorySettingsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordRepositorySettingsTableViewController.swift; sourceTree = "<group>"; };
|
DC037CAD1E4C9B9B00609409 /* PasswordRepositorySettingsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordRepositorySettingsTableViewController.swift; sourceTree = "<group>"; };
|
||||||
DC037CAF1E4CA51F00609409 /* GeneralSettingsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralSettingsTableViewController.swift; sourceTree = "<group>"; };
|
DC037CAF1E4CA51F00609409 /* GeneralSettingsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralSettingsTableViewController.swift; sourceTree = "<group>"; };
|
||||||
DC037CB11E4CAB1700609409 /* AboutRepositoryTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AboutRepositoryTableViewController.swift; sourceTree = "<group>"; };
|
DC037CB11E4CAB1700609409 /* AboutRepositoryTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AboutRepositoryTableViewController.swift; sourceTree = "<group>"; };
|
||||||
|
DC037CB71E4DD1A500609409 /* AddPasswordTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddPasswordTableViewController.swift; sourceTree = "<group>"; };
|
||||||
|
DC037CB91E4DD47B00609409 /* TextFieldTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldTableViewCell.swift; sourceTree = "<group>"; };
|
||||||
|
DC037CBA1E4DD47B00609409 /* TextFieldTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TextFieldTableViewCell.xib; sourceTree = "<group>"; };
|
||||||
DC1208571E35EBE60042942E /* ObjectiveGit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ObjectiveGit.framework; path = Carthage/Build/iOS/ObjectiveGit.framework; sourceTree = "<group>"; };
|
DC1208571E35EBE60042942E /* ObjectiveGit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ObjectiveGit.framework; path = Carthage/Build/iOS/ObjectiveGit.framework; sourceTree = "<group>"; };
|
||||||
DC193FF91E49B4430077E0A3 /* AdvancedSettingsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdvancedSettingsTableViewController.swift; sourceTree = "<group>"; };
|
DC193FF91E49B4430077E0A3 /* AdvancedSettingsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdvancedSettingsTableViewController.swift; sourceTree = "<group>"; };
|
||||||
DC193FFB1E49E0340077E0A3 /* PasscodeLock.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PasscodeLock.framework; path = Carthage/Build/iOS/PasscodeLock.framework; sourceTree = "<group>"; };
|
DC193FFB1E49E0340077E0A3 /* PasscodeLock.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PasscodeLock.framework; path = Carthage/Build/iOS/PasscodeLock.framework; sourceTree = "<group>"; };
|
||||||
|
|
@ -123,6 +129,7 @@
|
||||||
DC19400C1E4B39400077E0A3 /* Controllers */ = {
|
DC19400C1E4B39400077E0A3 /* Controllers */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
DC037CB71E4DD1A500609409 /* AddPasswordTableViewController.swift */,
|
||||||
DC037CB11E4CAB1700609409 /* AboutRepositoryTableViewController.swift */,
|
DC037CB11E4CAB1700609409 /* AboutRepositoryTableViewController.swift */,
|
||||||
DC037CAF1E4CA51F00609409 /* GeneralSettingsTableViewController.swift */,
|
DC037CAF1E4CA51F00609409 /* GeneralSettingsTableViewController.swift */,
|
||||||
DC962CDE1E4B62C10033B5D8 /* AboutTableViewController.swift */,
|
DC962CDE1E4B62C10033B5D8 /* AboutTableViewController.swift */,
|
||||||
|
|
@ -168,6 +175,8 @@
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
DC4914941E434301007FF592 /* LabelTableViewCell.swift */,
|
DC4914941E434301007FF592 /* LabelTableViewCell.swift */,
|
||||||
|
DC037CB91E4DD47B00609409 /* TextFieldTableViewCell.swift */,
|
||||||
|
DC037CBA1E4DD47B00609409 /* TextFieldTableViewCell.xib */,
|
||||||
DCDDEAB11E4896BF00F68193 /* PasswordDetailTitleTableViewCell.swift */,
|
DCDDEAB11E4896BF00F68193 /* PasswordDetailTitleTableViewCell.swift */,
|
||||||
);
|
);
|
||||||
path = Views;
|
path = Views;
|
||||||
|
|
@ -289,6 +298,7 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
DC917BE11E2E8231000FDF54 /* LaunchScreen.storyboard in Resources */,
|
DC917BE11E2E8231000FDF54 /* LaunchScreen.storyboard in Resources */,
|
||||||
|
DC037CBC1E4DD47B00609409 /* TextFieldTableViewCell.xib in Resources */,
|
||||||
DC917BDE1E2E8231000FDF54 /* Assets.xcassets in Resources */,
|
DC917BDE1E2E8231000FDF54 /* Assets.xcassets in Resources */,
|
||||||
DCDDEAB41E4896BF00F68193 /* PasswordDetailTitleTableViewCell.xib in Resources */,
|
DCDDEAB41E4896BF00F68193 /* PasswordDetailTitleTableViewCell.xib in Resources */,
|
||||||
DCDDEAB01E4639F300F68193 /* LabelTableViewCell.xib in Resources */,
|
DCDDEAB01E4639F300F68193 /* LabelTableViewCell.xib in Resources */,
|
||||||
|
|
@ -390,8 +400,10 @@
|
||||||
DC037CB21E4CAB1700609409 /* AboutRepositoryTableViewController.swift in Sources */,
|
DC037CB21E4CAB1700609409 /* AboutRepositoryTableViewController.swift in Sources */,
|
||||||
DC037CB01E4CA51F00609409 /* GeneralSettingsTableViewController.swift in Sources */,
|
DC037CB01E4CA51F00609409 /* GeneralSettingsTableViewController.swift in Sources */,
|
||||||
DC8963BE1E38AD8300828B09 /* GitRepositoryAuthenticationSettingTableViewController.swift in Sources */,
|
DC8963BE1E38AD8300828B09 /* GitRepositoryAuthenticationSettingTableViewController.swift in Sources */,
|
||||||
|
DC037CB81E4DD1A500609409 /* AddPasswordTableViewController.swift in Sources */,
|
||||||
DC1940001E49E1A60077E0A3 /* PasscodeLockConfiguration.swift in Sources */,
|
DC1940001E49E1A60077E0A3 /* PasscodeLockConfiguration.swift in Sources */,
|
||||||
DC917BD71E2E8231000FDF54 /* AppDelegate.swift in Sources */,
|
DC917BD71E2E8231000FDF54 /* AppDelegate.swift in Sources */,
|
||||||
|
DC037CBB1E4DD47B00609409 /* TextFieldTableViewCell.swift in Sources */,
|
||||||
DC193FFE1E49E0760077E0A3 /* PasscodeLockRepository.swift in Sources */,
|
DC193FFE1E49E0760077E0A3 /* PasscodeLockRepository.swift in Sources */,
|
||||||
DCA049981E33586A00522E8F /* DefaultsKeys.swift in Sources */,
|
DCA049981E33586A00522E8F /* DefaultsKeys.swift in Sources */,
|
||||||
DC19400B1E4B36B60077E0A3 /* Utils.swift in Sources */,
|
DC19400B1E4B36B60077E0A3 /* Utils.swift in Sources */,
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
SVProgressHUD.setMinimumSize(CGSize(width: 150, height: 100))
|
SVProgressHUD.setMinimumSize(CGSize(width: 150, height: 100))
|
||||||
passcodeLockPresenter.present()
|
passcodeLockPresenter.present()
|
||||||
if let shortcutItem = launchOptions?[UIApplicationLaunchOptionsKey.shortcutItem] as? UIApplicationShortcutItem {
|
if let shortcutItem = launchOptions?[UIApplicationLaunchOptionsKey.shortcutItem] as? UIApplicationShortcutItem {
|
||||||
print(shortcutItem.type)
|
|
||||||
if shortcutItem.type == "me.mssun.pass.search" {
|
if shortcutItem.type == "me.mssun.pass.search" {
|
||||||
self.perform(#selector(postSearchNotification), with: nil, afterDelay: 0.4)
|
self.perform(#selector(postSearchNotification), with: nil, afterDelay: 0.4)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,11 @@
|
||||||
</view>
|
</view>
|
||||||
<navigationItem key="navigationItem" title="Password Store" id="Cio-ZG-zCS">
|
<navigationItem key="navigationItem" title="Password Store" id="Cio-ZG-zCS">
|
||||||
<barButtonItem key="backBarButtonItem" title="Back" id="New-sD-9Z1"/>
|
<barButtonItem key="backBarButtonItem" title="Back" id="New-sD-9Z1"/>
|
||||||
|
<barButtonItem key="rightBarButtonItem" systemItem="add" id="qVW-c1-xgh">
|
||||||
|
<connections>
|
||||||
|
<segue destination="fyR-Cj-h6o" kind="show" id="zhp-fK-Zwp"/>
|
||||||
|
</connections>
|
||||||
|
</barButtonItem>
|
||||||
</navigationItem>
|
</navigationItem>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="tableView" destination="Tn1-q5-vaJ" id="UHc-AS-gXh"/>
|
<outlet property="tableView" destination="Tn1-q5-vaJ" id="UHc-AS-gXh"/>
|
||||||
|
|
@ -507,14 +512,14 @@
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="51"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="51"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PGP Key URL" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dWi-eh-7Eq">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Public Key URL" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dWi-eh-7Eq">
|
||||||
<rect key="frame" x="15" y="8" width="391" height="15"/>
|
<rect key="frame" x="15" y="8" width="391" height="15"/>
|
||||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||||
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="PGP Key URL" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="Rb8-zs-TGa">
|
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Public Key URL" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="Rb8-zs-TGa">
|
||||||
<rect key="frame" x="15" y="22.666666666666664" width="391" height="20.999999999999993"/>
|
<rect key="frame" x="15" y="23" width="391" height="21"/>
|
||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="URL"/>
|
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="URL"/>
|
||||||
|
|
@ -530,9 +535,39 @@
|
||||||
</constraints>
|
</constraints>
|
||||||
</tableViewCellContentView>
|
</tableViewCellContentView>
|
||||||
</tableViewCell>
|
</tableViewCell>
|
||||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="passphraseTableViewCell" rowHeight="52" id="qrQ-bd-sV8">
|
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="pgpKeyURLTableViewCell" rowHeight="52" id="vpk-J8-j7t">
|
||||||
<rect key="frame" x="0.0" y="87" width="414" height="52"/>
|
<rect key="frame" x="0.0" y="87" width="414" height="52"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="vpk-J8-j7t" id="1td-qT-6ts">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="414" height="51"/>
|
||||||
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
<subviews>
|
||||||
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Private Key URL" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Qht-RC-Yeg">
|
||||||
|
<rect key="frame" x="15" y="8" width="391" height="15"/>
|
||||||
|
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||||
|
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
|
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Private Key URL" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="cGJ-1g-Ztc">
|
||||||
|
<rect key="frame" x="15" y="23" width="391" height="21"/>
|
||||||
|
<nil key="textColor"/>
|
||||||
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
|
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="URL"/>
|
||||||
|
</textField>
|
||||||
|
</subviews>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="topMargin" secondItem="Qht-RC-Yeg" secondAttribute="top" id="62r-G1-4dm"/>
|
||||||
|
<constraint firstItem="cGJ-1g-Ztc" firstAttribute="top" secondItem="Qht-RC-Yeg" secondAttribute="bottom" id="EkJ-SV-G4q"/>
|
||||||
|
<constraint firstAttribute="trailingMargin" secondItem="Qht-RC-Yeg" secondAttribute="trailing" id="G77-HF-QDd"/>
|
||||||
|
<constraint firstItem="Qht-RC-Yeg" firstAttribute="leading" secondItem="1td-qT-6ts" secondAttribute="leadingMargin" constant="7" id="Idd-V5-IDA"/>
|
||||||
|
<constraint firstAttribute="trailingMargin" secondItem="cGJ-1g-Ztc" secondAttribute="trailing" id="PCt-qz-Q4p"/>
|
||||||
|
<constraint firstItem="cGJ-1g-Ztc" firstAttribute="leading" secondItem="Qht-RC-Yeg" secondAttribute="leading" id="wih-Ox-YM5"/>
|
||||||
|
</constraints>
|
||||||
|
</tableViewCellContentView>
|
||||||
|
</tableViewCell>
|
||||||
|
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="passphraseTableViewCell" rowHeight="52" id="qrQ-bd-sV8">
|
||||||
|
<rect key="frame" x="0.0" y="139" width="414" height="52"/>
|
||||||
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="qrQ-bd-sV8" id="7ts-YH-1tP">
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="qrQ-bd-sV8" id="7ts-YH-1tP">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="51"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="51"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
|
@ -544,7 +579,7 @@
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Passphrase" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="Nkx-gN-jNA">
|
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Passphrase" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="Nkx-gN-jNA">
|
||||||
<rect key="frame" x="15" y="22.666666666666664" width="391" height="20.999999999999993"/>
|
<rect key="frame" x="15" y="23" width="391" height="21"/>
|
||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="alphabet" keyboardAppearance="alert" secureTextEntry="YES"/>
|
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="alphabet" keyboardAppearance="alert" secureTextEntry="YES"/>
|
||||||
|
|
@ -582,7 +617,8 @@
|
||||||
</navigationItem>
|
</navigationItem>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="pgpKeyPassphraseTextField" destination="Nkx-gN-jNA" id="ylV-LG-ibS"/>
|
<outlet property="pgpKeyPassphraseTextField" destination="Nkx-gN-jNA" id="ylV-LG-ibS"/>
|
||||||
<outlet property="pgpKeyURLTextField" destination="Rb8-zs-TGa" id="A6a-ny-iuX"/>
|
<outlet property="pgpPrivateKeyURLTextField" destination="cGJ-1g-Ztc" id="0K9-93-BKy"/>
|
||||||
|
<outlet property="pgpPublicKeyURLTextField" destination="Rb8-zs-TGa" id="ERy-Ui-ASZ"/>
|
||||||
</connections>
|
</connections>
|
||||||
</tableViewController>
|
</tableViewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="hbx-RC-qg1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="hbx-RC-qg1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
|
@ -590,6 +626,38 @@
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="5638" y="3511"/>
|
<point key="canvasLocation" x="5638" y="3511"/>
|
||||||
</scene>
|
</scene>
|
||||||
|
<!--Add Password-->
|
||||||
|
<scene sceneID="738-Zk-wRb">
|
||||||
|
<objects>
|
||||||
|
<tableViewController id="FgE-RV-izf" customClass="AddPasswordTableViewController" customModule="pass" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
|
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="xyq-V7-x1G">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
||||||
|
<sections/>
|
||||||
|
<connections>
|
||||||
|
<outlet property="dataSource" destination="FgE-RV-izf" id="Dis-iC-JWi"/>
|
||||||
|
<outlet property="delegate" destination="FgE-RV-izf" id="DyH-cS-8or"/>
|
||||||
|
</connections>
|
||||||
|
</tableView>
|
||||||
|
<navigationItem key="navigationItem" title="Add Password" id="KOg-Gn-Buk">
|
||||||
|
<barButtonItem key="leftBarButtonItem" systemItem="cancel" id="hWX-Dx-Xxi">
|
||||||
|
<connections>
|
||||||
|
<segue destination="rRf-7l-IGe" kind="unwind" unwindAction="cancelAddPasswordWithSegue:" id="G4F-ci-BmD"/>
|
||||||
|
</connections>
|
||||||
|
</barButtonItem>
|
||||||
|
<barButtonItem key="rightBarButtonItem" systemItem="save" id="FtF-nT-zRJ">
|
||||||
|
<connections>
|
||||||
|
<segue destination="rRf-7l-IGe" kind="unwind" unwindAction="saveAddPasswordWithSegue:" id="eVU-Kz-JU0"/>
|
||||||
|
</connections>
|
||||||
|
</barButtonItem>
|
||||||
|
</navigationItem>
|
||||||
|
</tableViewController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="6R0-BP-wo8" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
<exit id="rRf-7l-IGe" userLabel="Exit" sceneMemberID="exit"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="4869.5652173913049" y="268.20652173913044"/>
|
||||||
|
</scene>
|
||||||
<!--Password Detail Table View Controller-->
|
<!--Password Detail Table View Controller-->
|
||||||
<scene sceneID="9wY-d0-fB1">
|
<scene sceneID="9wY-d0-fB1">
|
||||||
<objects>
|
<objects>
|
||||||
|
|
@ -607,7 +675,7 @@
|
||||||
</tableViewController>
|
</tableViewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="9sC-44-OKL" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="9sC-44-OKL" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="3961" y="993"/>
|
<point key="canvasLocation" x="3961" y="982"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--Password-->
|
<!--Password-->
|
||||||
<scene sceneID="ACd-rk-Zf3">
|
<scene sceneID="ACd-rk-Zf3">
|
||||||
|
|
@ -990,6 +1058,24 @@
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="5638" y="6273"/>
|
<point key="canvasLocation" x="5638" y="6273"/>
|
||||||
</scene>
|
</scene>
|
||||||
|
<!--Navigation Controller-->
|
||||||
|
<scene sceneID="zfZ-pX-bff">
|
||||||
|
<objects>
|
||||||
|
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="fyR-Cj-h6o" sceneMemberID="viewController">
|
||||||
|
<toolbarItems/>
|
||||||
|
<navigationBar key="navigationBar" contentMode="scaleToFill" id="jtR-Sj-1XE">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
|
||||||
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
</navigationBar>
|
||||||
|
<nil name="viewControllers"/>
|
||||||
|
<connections>
|
||||||
|
<segue destination="FgE-RV-izf" kind="relationship" relationship="rootViewController" id="yEo-bX-uA0"/>
|
||||||
|
</connections>
|
||||||
|
</navigationController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="Zq0-iH-LGe" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="3962.3188405797105" y="268.20652173913044"/>
|
||||||
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="Lock" width="25" height="25"/>
|
<image name="Lock" width="25" height="25"/>
|
||||||
|
|
|
||||||
51
pass/Controllers/AddPasswordTableViewController.swift
Normal file
51
pass/Controllers/AddPasswordTableViewController.swift
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
//
|
||||||
|
// AddPasswordTableViewController.swift
|
||||||
|
// pass
|
||||||
|
//
|
||||||
|
// Created by Mingshen Sun on 10/2/2017.
|
||||||
|
// Copyright © 2017 Bob Sun. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
class AddPasswordTableViewController: UITableViewController {
|
||||||
|
let tableTitles = ["name", "password"]
|
||||||
|
var password: Password?
|
||||||
|
|
||||||
|
override func viewDidLoad() {
|
||||||
|
super.viewDidLoad()
|
||||||
|
tableView.register(UINib(nibName: "TextFieldTableViewCell", bundle: nil), forCellReuseIdentifier: "textFieldCell")
|
||||||
|
tableView.rowHeight = UITableViewAutomaticDimension
|
||||||
|
tableView.estimatedRowHeight = 52
|
||||||
|
tableView.allowsSelection = false
|
||||||
|
}
|
||||||
|
|
||||||
|
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||||
|
return tableTitles.count
|
||||||
|
}
|
||||||
|
|
||||||
|
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||||
|
let cell = tableView.dequeueReusableCell(withIdentifier: "textFieldCell", for: indexPath) as! TextFieldTableViewCell
|
||||||
|
cell.titleLabel.text = tableTitles[indexPath.row]
|
||||||
|
return cell
|
||||||
|
}
|
||||||
|
|
||||||
|
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||||
|
let name = getCellForName(name: "name")!.contentTextField.text ?? ""
|
||||||
|
let passwordText = getCellForName(name: "password")!.contentTextField.text ?? ""
|
||||||
|
// let additions = getCellForName(name: "additions")!.contentTextField.text ?? ""
|
||||||
|
// let additionSplit = additions.characters.split(separator: ":").map(String.init)
|
||||||
|
// print(additionSplit)
|
||||||
|
// let additionField = AdditionField(title: additionSplit[0], content: additionSplit[1])
|
||||||
|
password = Password(name: name, username: "", password: passwordText, additions: [])
|
||||||
|
}
|
||||||
|
|
||||||
|
func getCellAt(row: Int) -> TextFieldTableViewCell? {
|
||||||
|
return tableView.cellForRow(at: IndexPath(row: row, section: 0)) as? TextFieldTableViewCell
|
||||||
|
}
|
||||||
|
|
||||||
|
func getCellForName(name: String) -> TextFieldTableViewCell? {
|
||||||
|
let index = tableTitles.index(of: name)!
|
||||||
|
return getCellAt(row: Int(index))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,18 +11,21 @@ import SwiftyUserDefaults
|
||||||
|
|
||||||
class PGPKeySettingTableViewController: UITableViewController {
|
class PGPKeySettingTableViewController: UITableViewController {
|
||||||
|
|
||||||
@IBOutlet weak var pgpKeyURLTextField: UITextField!
|
@IBOutlet weak var pgpPublicKeyURLTextField: UITextField!
|
||||||
|
@IBOutlet weak var pgpPrivateKeyURLTextField: UITextField!
|
||||||
@IBOutlet weak var pgpKeyPassphraseTextField: UITextField!
|
@IBOutlet weak var pgpKeyPassphraseTextField: UITextField!
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
pgpKeyURLTextField.text = Defaults[.pgpKeyURL]?.absoluteString
|
pgpPublicKeyURLTextField.text = Defaults[.pgpPublicKeyURL]?.absoluteString
|
||||||
|
pgpPrivateKeyURLTextField.text = Defaults[.pgpPrivateKeyURL]?.absoluteString
|
||||||
pgpKeyPassphraseTextField.text = Defaults[.pgpKeyPassphrase]
|
pgpKeyPassphraseTextField.text = Defaults[.pgpKeyPassphrase]
|
||||||
}
|
}
|
||||||
|
|
||||||
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
|
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
|
||||||
if identifier == "savePGPKeySegue" {
|
if identifier == "savePGPKeySegue" {
|
||||||
if URL(string: pgpKeyURLTextField.text!)!.scheme! == "http" {
|
if URL(string: pgpPublicKeyURLTextField.text!)!.scheme! == "http" &&
|
||||||
|
URL(string: pgpPrivateKeyURLTextField.text!)!.scheme! == "http" {
|
||||||
let alertMessage = "HTTP connection is not supported."
|
let alertMessage = "HTTP connection is not supported."
|
||||||
let alert = UIAlertController(title: "Cannot Save Settings", message: alertMessage, preferredStyle: UIAlertControllerStyle.alert)
|
let alert = UIAlertController(title: "Cannot Save Settings", message: alertMessage, preferredStyle: UIAlertControllerStyle.alert)
|
||||||
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
|
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,15 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
|
|
||||||
@IBOutlet weak var tableView: UITableView!
|
@IBOutlet weak var tableView: UITableView!
|
||||||
|
|
||||||
|
@IBAction func cancelAddPassword(segue: UIStoryboardSegue) {
|
||||||
|
|
||||||
|
}
|
||||||
|
@IBAction func saveAddPassword(segue: UIStoryboardSegue) {
|
||||||
|
if let controller = segue.source as? AddPasswordTableViewController {
|
||||||
|
PasswordStore.shared.add(password: controller.password!)
|
||||||
|
NotificationCenter.default.post(Notification(name: Notification.Name("passwordUpdated")))
|
||||||
|
}
|
||||||
|
}
|
||||||
func syncPasswords() {
|
func syncPasswords() {
|
||||||
SVProgressHUD.setDefaultMaskType(.black)
|
SVProgressHUD.setDefaultMaskType(.black)
|
||||||
SVProgressHUD.setDefaultStyle(.light)
|
SVProgressHUD.setDefaultStyle(.light)
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,11 @@ class SettingsTableViewController: UITableViewController {
|
||||||
@IBAction func save(segue: UIStoryboardSegue) {
|
@IBAction func save(segue: UIStoryboardSegue) {
|
||||||
if let controller = segue.source as? PGPKeySettingTableViewController {
|
if let controller = segue.source as? PGPKeySettingTableViewController {
|
||||||
|
|
||||||
if Defaults[.pgpKeyURL] != URL(string: controller.pgpKeyURLTextField.text!) ||
|
if Defaults[.pgpPrivateKeyURL] != URL(string: controller.pgpPrivateKeyURLTextField.text!) ||
|
||||||
|
Defaults[.pgpPublicKeyURL] != URL(string: controller.pgpPublicKeyURLTextField.text!) ||
|
||||||
Defaults[.pgpKeyPassphrase] != controller.pgpKeyPassphraseTextField.text! {
|
Defaults[.pgpKeyPassphrase] != controller.pgpKeyPassphraseTextField.text! {
|
||||||
Defaults[.pgpKeyURL] = URL(string: controller.pgpKeyURLTextField.text!)
|
Defaults[.pgpPrivateKeyURL] = URL(string: controller.pgpPrivateKeyURLTextField.text!)
|
||||||
|
Defaults[.pgpPublicKeyURL] = URL(string: controller.pgpPublicKeyURLTextField.text!)
|
||||||
Defaults[.pgpKeyPassphrase] = controller.pgpKeyPassphraseTextField.text!
|
Defaults[.pgpKeyPassphrase] = controller.pgpKeyPassphraseTextField.text!
|
||||||
|
|
||||||
SVProgressHUD.setDefaultMaskType(.black)
|
SVProgressHUD.setDefaultMaskType(.black)
|
||||||
|
|
@ -36,7 +38,10 @@ class SettingsTableViewController: UITableViewController {
|
||||||
SVProgressHUD.show(withStatus: "Fetching PGP Key")
|
SVProgressHUD.show(withStatus: "Fetching PGP Key")
|
||||||
DispatchQueue.global(qos: .userInitiated).async { [unowned self] in
|
DispatchQueue.global(qos: .userInitiated).async { [unowned self] in
|
||||||
do {
|
do {
|
||||||
try PasswordStore.shared.initPGP(pgpKeyURL: Defaults[.pgpKeyURL]!, pgpKeyLocalPath: Globals.secringPath)
|
try PasswordStore.shared.initPGP(pgpPublicKeyURL: Defaults[.pgpPublicKeyURL]!,
|
||||||
|
pgpPublicKeyLocalPath: Globals.pgpPublicKeyPath,
|
||||||
|
pgpPrivateKeyURL: Defaults[.pgpPrivateKeyURL]!,
|
||||||
|
pgpPrivateKeyLocalPath: Globals.pgpPrivateKeyPath)
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.pgpKeyTableViewCell.detailTextLabel?.text = Defaults[.pgpKeyID]
|
self.pgpKeyTableViewCell.detailTextLabel?.text = Defaults[.pgpKeyID]
|
||||||
SVProgressHUD.showSuccess(withStatus: "Success. Remember to remove the key from the server.")
|
SVProgressHUD.showSuccess(withStatus: "Success. Remember to remove the key from the server.")
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,9 @@ import Foundation
|
||||||
import SwiftyUserDefaults
|
import SwiftyUserDefaults
|
||||||
|
|
||||||
extension DefaultsKeys {
|
extension DefaultsKeys {
|
||||||
static let pgpKeyURL = DefaultsKey<URL?>("pgpKeyURL")
|
// static let pgpKeyURL = DefaultsKey<URL?>("pgpKeyURL")
|
||||||
|
static let pgpPublicKeyURL = DefaultsKey<URL?>("pgpPublicKeyURL")
|
||||||
|
static let pgpPrivateKeyURL = DefaultsKey<URL?>("pgpPrivateKeyURL")
|
||||||
|
|
||||||
static let pgpKeyPassphrase = DefaultsKey<String>("pgpKeyPassphrase")
|
static let pgpKeyPassphrase = DefaultsKey<String>("pgpKeyPassphrase")
|
||||||
static let pgpKeyID = DefaultsKey<String>("pgpKeyID")
|
static let pgpKeyID = DefaultsKey<String>("pgpKeyID")
|
||||||
|
|
@ -31,7 +33,8 @@ extension DefaultsKeys {
|
||||||
|
|
||||||
extension Utils {
|
extension Utils {
|
||||||
static func eraseAllUserDefaults() {
|
static func eraseAllUserDefaults() {
|
||||||
Defaults.remove(.pgpKeyURL)
|
Defaults.remove(.pgpPublicKeyURL)
|
||||||
|
Defaults.remove(.pgpPrivateKeyURL)
|
||||||
|
|
||||||
Defaults.remove(.pgpKeyPassphrase)
|
Defaults.remove(.pgpKeyPassphrase)
|
||||||
Defaults.remove(.pgpKeyID)
|
Defaults.remove(.pgpKeyID)
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,13 @@ import Foundation
|
||||||
|
|
||||||
class Globals {
|
class Globals {
|
||||||
static let documentPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0];
|
static let documentPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0];
|
||||||
static let secringPath = "\(documentPath)/secring.gpg"
|
static let pgpPublicKeyPath = "\(documentPath)/gpg_key.pub"
|
||||||
|
static let pgpPrivateKeyPath = "\(documentPath)/gpg_key"
|
||||||
|
|
||||||
static let sshPublicKeyURL = URL(fileURLWithPath: "\(documentPath)/ssh_key.pub")
|
static let sshPublicKeyURL = URL(fileURLWithPath: "\(documentPath)/ssh_key.pub")
|
||||||
static let sshPrivateKeyURL = URL(fileURLWithPath: "\(documentPath)/ssh_key")
|
static let sshPrivateKeyURL = URL(fileURLWithPath: "\(documentPath)/ssh_key")
|
||||||
|
|
||||||
|
static let repositoryPath = "\(documentPath)/password-store"
|
||||||
static var passcodeConfiguration = PasscodeLockConfiguration()
|
static var passcodeConfiguration = PasscodeLockConfiguration()
|
||||||
static let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
|
static let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
|
||||||
private init() { }
|
private init() { }
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class Password {
|
||||||
extension PasswordEntity {
|
extension PasswordEntity {
|
||||||
func decrypt() throws -> Password? {
|
func decrypt() throws -> Password? {
|
||||||
var password: Password?
|
var password: Password?
|
||||||
let encryptedDataPath = URL(fileURLWithPath: "\(Globals.documentPath)/\(rawPath!)")
|
let encryptedDataPath = URL(fileURLWithPath: "\(Globals.repositoryPath)/\(rawPath!)")
|
||||||
let encryptedData = try Data(contentsOf: encryptedDataPath)
|
let encryptedData = try Data(contentsOf: encryptedDataPath)
|
||||||
let decryptedData = try PasswordStore.shared.pgp.decryptData(encryptedData, passphrase: Defaults[.pgpKeyPassphrase])
|
let decryptedData = try PasswordStore.shared.pgp.decryptData(encryptedData, passphrase: Defaults[.pgpKeyPassphrase])
|
||||||
let plain = String(data: decryptedData, encoding: .ascii) ?? ""
|
let plain = String(data: decryptedData, encoding: .ascii) ?? ""
|
||||||
|
|
@ -82,4 +82,15 @@ extension PasswordEntity {
|
||||||
password = Password(name: name!, username: username, password: decrypted_password, additions: decrypted_addtions)
|
password = Password(name: name!, username: username, password: decrypted_password, additions: decrypted_addtions)
|
||||||
return password
|
return password
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func encrypt(password: Password) throws -> Data {
|
||||||
|
name = password.name
|
||||||
|
rawPath = ""
|
||||||
|
let plainPassword = password.password
|
||||||
|
// let plainAdditions = password.additions.map { "\($0.title): \($0.content)" }.joined(separator: "\n")
|
||||||
|
let plainData = "\(plainPassword)\n".data(using: .ascii)!
|
||||||
|
let pgp = PasswordStore.shared.pgp
|
||||||
|
let encryptedData = try pgp.encryptData(plainData, usingPublicKey: pgp.getKeysOf(.public)[0], armored: false)
|
||||||
|
return encryptedData
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,9 @@ class PasswordStore {
|
||||||
print(error)
|
print(error)
|
||||||
}
|
}
|
||||||
if Defaults[.pgpKeyID] != "" {
|
if Defaults[.pgpKeyID] != "" {
|
||||||
pgp.importKeys(fromFile: Globals.secringPath, allowDuplicates: false)
|
pgp.importKeys(fromFile: Globals.pgpPublicKeyPath, allowDuplicates: false)
|
||||||
|
pgp.importKeys(fromFile: Globals.pgpPrivateKeyPath, allowDuplicates: false)
|
||||||
|
|
||||||
}
|
}
|
||||||
if Defaults[.gitRepositoryAuthenticationMethod] == "Password" {
|
if Defaults[.gitRepositoryAuthenticationMethod] == "Password" {
|
||||||
gitCredential = GitCredential(credential: GitCredential.Credential.http(userName: Defaults[.gitRepositoryUsername], password: Defaults[.gitRepositoryPassword]))
|
gitCredential = GitCredential(credential: GitCredential.Credential.http(userName: Defaults[.gitRepositoryUsername], password: Defaults[.gitRepositoryPassword]))
|
||||||
|
|
@ -70,11 +72,17 @@ class PasswordStore {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func initPGP(pgpKeyURL: URL, pgpKeyLocalPath: String) throws {
|
func initPGP(pgpPublicKeyURL: URL, pgpPublicKeyLocalPath: String, pgpPrivateKeyURL: URL, pgpPrivateKeyLocalPath: String) throws {
|
||||||
let pgpData = try Data(contentsOf: pgpKeyURL)
|
let pgpPublicData = try Data(contentsOf: pgpPublicKeyURL)
|
||||||
try pgpData.write(to: URL(fileURLWithPath: pgpKeyLocalPath), options: .atomic)
|
try pgpPublicData.write(to: URL(fileURLWithPath: pgpPublicKeyLocalPath), options: .atomic)
|
||||||
pgp.importKeys(fromFile: pgpKeyLocalPath, allowDuplicates: false)
|
|
||||||
let key = pgp.keys[0]
|
let pgpPrivateData = try Data(contentsOf: pgpPrivateKeyURL)
|
||||||
|
try pgpPrivateData.write(to: URL(fileURLWithPath: pgpPrivateKeyLocalPath), options: .atomic)
|
||||||
|
|
||||||
|
pgp.importKeys(fromFile: pgpPublicKeyLocalPath, allowDuplicates: false)
|
||||||
|
pgp.importKeys(fromFile: pgpPrivateKeyLocalPath, allowDuplicates: false)
|
||||||
|
|
||||||
|
let key = pgp.getKeysOf(.public)[0]
|
||||||
Defaults[.pgpKeyID] = key.keyID!.shortKeyString
|
Defaults[.pgpKeyID] = key.keyID!.shortKeyString
|
||||||
if let gpgUser = key.users[0] as? PGPUser {
|
if let gpgUser = key.users[0] as? PGPUser {
|
||||||
Defaults[.pgpKeyUserID] = gpgUser.userID
|
Defaults[.pgpKeyUserID] = gpgUser.userID
|
||||||
|
|
@ -130,7 +138,7 @@ class PasswordStore {
|
||||||
let passwordEntity = PasswordEntity(context: context)
|
let passwordEntity = PasswordEntity(context: context)
|
||||||
let endIndex = url.lastPathComponent.index(url.lastPathComponent.endIndex, offsetBy: -4)
|
let endIndex = url.lastPathComponent.index(url.lastPathComponent.endIndex, offsetBy: -4)
|
||||||
passwordEntity.name = url.lastPathComponent.substring(to: endIndex)
|
passwordEntity.name = url.lastPathComponent.substring(to: endIndex)
|
||||||
passwordEntity.rawPath = "password-store/\(url.path)"
|
passwordEntity.rawPath = "\(url.path)"
|
||||||
let items = url.path.characters.split(separator: "/").map(String.init)
|
let items = url.path.characters.split(separator: "/").map(String.init)
|
||||||
for i in 0 ..< items.count - 1 {
|
for i in 0 ..< items.count - 1 {
|
||||||
let passwordCategoryEntity = PasswordCategoryEntity(context: context)
|
let passwordCategoryEntity = PasswordCategoryEntity(context: context)
|
||||||
|
|
@ -173,6 +181,23 @@ class PasswordStore {
|
||||||
func updateRemoteRepo() {
|
func updateRemoteRepo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func commitChange() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func add(password: Password) {
|
||||||
|
let passwordEntity = NSEntityDescription.insertNewObject(forEntityName: "PasswordEntity", into: context) as! PasswordEntity
|
||||||
|
do {
|
||||||
|
let encryptedData = try passwordEntity.encrypt(password: password)
|
||||||
|
let saveURL = storeURL.appendingPathComponent("\(password.name).gpg")
|
||||||
|
try encryptedData.write(to: saveURL)
|
||||||
|
passwordEntity.rawPath = "\(password.name).gpg"
|
||||||
|
try context.save()
|
||||||
|
} catch {
|
||||||
|
print(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func deleteCoreData(entityName: String) {
|
func deleteCoreData(entityName: String) {
|
||||||
let deleteFetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: entityName)
|
let deleteFetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: entityName)
|
||||||
let deleteRequest = NSBatchDeleteRequest(fetchRequest: deleteFetchRequest)
|
let deleteRequest = NSBatchDeleteRequest(fetchRequest: deleteFetchRequest)
|
||||||
|
|
@ -186,7 +211,8 @@ class PasswordStore {
|
||||||
|
|
||||||
func erase() {
|
func erase() {
|
||||||
Utils.removeFileIfExists(at: storeURL)
|
Utils.removeFileIfExists(at: storeURL)
|
||||||
Utils.removeFileIfExists(atPath: Globals.secringPath)
|
Utils.removeFileIfExists(atPath: Globals.pgpPublicKeyPath)
|
||||||
|
Utils.removeFileIfExists(atPath: Globals.pgpPrivateKeyPath)
|
||||||
Utils.removeFileIfExists(at: Globals.sshPrivateKeyURL)
|
Utils.removeFileIfExists(at: Globals.sshPrivateKeyURL)
|
||||||
Utils.removeFileIfExists(at: Globals.sshPublicKeyURL)
|
Utils.removeFileIfExists(at: Globals.sshPublicKeyURL)
|
||||||
|
|
||||||
|
|
|
||||||
27
pass/Views/TextFieldTableViewCell.swift
Normal file
27
pass/Views/TextFieldTableViewCell.swift
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
//
|
||||||
|
// TextFieldTableViewCell.swift
|
||||||
|
// pass
|
||||||
|
//
|
||||||
|
// Created by Mingshen Sun on 10/2/2017.
|
||||||
|
// Copyright © 2017 Bob Sun. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
class TextFieldTableViewCell: UITableViewCell {
|
||||||
|
|
||||||
|
@IBOutlet weak var titleLabel: UILabel!
|
||||||
|
@IBOutlet weak var contentTextField: UITextField!
|
||||||
|
|
||||||
|
override func awakeFromNib() {
|
||||||
|
super.awakeFromNib()
|
||||||
|
// Initialization code
|
||||||
|
}
|
||||||
|
|
||||||
|
override func setSelected(_ selected: Bool, animated: Bool) {
|
||||||
|
super.setSelected(selected, animated: animated)
|
||||||
|
|
||||||
|
// Configure the view for the selected state
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
52
pass/Views/TextFieldTableViewCell.xib
Normal file
52
pass/Views/TextFieldTableViewCell.xib
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||||
|
<device id="retina4_7" orientation="portrait">
|
||||||
|
<adaptation id="fullscreen"/>
|
||||||
|
</device>
|
||||||
|
<dependencies>
|
||||||
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
|
||||||
|
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||||
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
|
</dependencies>
|
||||||
|
<objects>
|
||||||
|
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||||
|
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="56" id="KGk-i7-Jjw" customClass="TextFieldTableViewCell" customModule="pass" customModuleProvider="target">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="320" height="56"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="320" height="55.5"/>
|
||||||
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
<subviews>
|
||||||
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HPC-rQ-39b">
|
||||||
|
<rect key="frame" x="15" y="8" width="297" height="15"/>
|
||||||
|
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||||
|
<color key="textColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
|
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="8Ky-UZ-sLu">
|
||||||
|
<rect key="frame" x="15" y="26" width="297" height="21.5"/>
|
||||||
|
<nil key="textColor"/>
|
||||||
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
|
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" returnKeyType="next"/>
|
||||||
|
</textField>
|
||||||
|
</subviews>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="bottomMargin" secondItem="8Ky-UZ-sLu" secondAttribute="bottom" id="11n-KG-zy6"/>
|
||||||
|
<constraint firstItem="8Ky-UZ-sLu" firstAttribute="trailing" secondItem="HPC-rQ-39b" secondAttribute="trailing" id="42z-vE-AsJ"/>
|
||||||
|
<constraint firstItem="8Ky-UZ-sLu" firstAttribute="leading" secondItem="HPC-rQ-39b" secondAttribute="leading" id="8F6-w6-BDY"/>
|
||||||
|
<constraint firstAttribute="trailingMargin" secondItem="HPC-rQ-39b" secondAttribute="trailing" id="Ayv-Bg-JxT"/>
|
||||||
|
<constraint firstItem="HPC-rQ-39b" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" id="JN2-lI-0ZY"/>
|
||||||
|
<constraint firstItem="8Ky-UZ-sLu" firstAttribute="top" secondItem="HPC-rQ-39b" secondAttribute="bottom" constant="3" id="Pqs-gm-93j"/>
|
||||||
|
<constraint firstItem="HPC-rQ-39b" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" constant="7" id="vfA-M9-FEp"/>
|
||||||
|
</constraints>
|
||||||
|
</tableViewCellContentView>
|
||||||
|
<connections>
|
||||||
|
<outlet property="contentTextField" destination="8Ky-UZ-sLu" id="pdS-Nl-e9s"/>
|
||||||
|
<outlet property="titleLabel" destination="HPC-rQ-39b" id="yPo-dZ-cth"/>
|
||||||
|
</connections>
|
||||||
|
<point key="canvasLocation" x="34" y="60"/>
|
||||||
|
</tableViewCell>
|
||||||
|
</objects>
|
||||||
|
</document>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue