iOS: Finish support for key files
This commit is contained in:
parent
fa21a9d8f3
commit
e5b90b856a
24 changed files with 225 additions and 27 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
@property (nonatomic, retain) IBOutlet UITextField *nameField;
|
@property (nonatomic, retain) IBOutlet UITextField *nameField;
|
||||||
@property (nonatomic, retain) IBOutlet UITextField *lengthField;
|
@property (nonatomic, retain) IBOutlet UITextField *lengthField;
|
||||||
@property (nonatomic, retain) IBOutlet UISwitch *legacySwitch;
|
@property (nonatomic, retain) IBOutlet UISwitch *legacySwitch;
|
||||||
|
@property (nonatomic, copy) NSString *keyFile;
|
||||||
@property (nonatomic, retain) IBOutlet UILabel *keyFileLabel;
|
@property (nonatomic, retain) IBOutlet UILabel *keyFileLabel;
|
||||||
@property (retain) MainViewController *mainViewController;
|
@property (retain) MainViewController *mainViewController;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
#import <ObjFW_Bridge/ObjFW_Bridge.h>
|
#import <ObjFW_Bridge/ObjFW_Bridge.h>
|
||||||
|
|
||||||
#import "AddSiteController.h"
|
#import "AddSiteController.h"
|
||||||
|
#import "SelectKeyFileController.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
showAlert(UIViewController *controller, NSString *title, NSString *message)
|
showAlert(UIViewController *controller, NSString *title, NSString *message)
|
||||||
|
@ -47,6 +48,7 @@ showAlert(UIViewController *controller, NSString *title, NSString *message)
|
||||||
[_nameField release];
|
[_nameField release];
|
||||||
[_lengthField release];
|
[_lengthField release];
|
||||||
[_legacySwitch release];
|
[_legacySwitch release];
|
||||||
|
[_keyFile release];
|
||||||
[_keyFileLabel release];
|
[_keyFileLabel release];
|
||||||
[_mainViewController release];
|
[_mainViewController release];
|
||||||
|
|
||||||
|
@ -60,7 +62,8 @@ showAlert(UIViewController *controller, NSString *title, NSString *message)
|
||||||
animated: YES];
|
animated: YES];
|
||||||
|
|
||||||
if (indexPath.section == 1 && indexPath.row == 1)
|
if (indexPath.section == 1 && indexPath.row == 1)
|
||||||
[self selectKeyFile];
|
[self performSegueWithIdentifier: @"selectKeyFile"
|
||||||
|
sender: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSIndexPath *)tableView: (UITableView *)tableView
|
- (NSIndexPath *)tableView: (UITableView *)tableView
|
||||||
|
@ -72,11 +75,6 @@ showAlert(UIViewController *controller, NSString *title, NSString *message)
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)selectKeyFile
|
|
||||||
{
|
|
||||||
showAlert(self, @"Not Supported", @"Key files are not supported yet");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)done: (id)sender
|
- (IBAction)done: (id)sender
|
||||||
{
|
{
|
||||||
OFString *name = self.nameField.text.OFObject;
|
OFString *name = self.nameField.text.OFObject;
|
||||||
|
@ -113,7 +111,7 @@ showAlert(UIViewController *controller, NSString *title, NSString *message)
|
||||||
[self.mainViewController.siteStorage setSite: name
|
[self.mainViewController.siteStorage setSite: name
|
||||||
length: length
|
length: length
|
||||||
legacy: self.legacySwitch.on
|
legacy: self.legacySwitch.on
|
||||||
keyFile: nil];
|
keyFile: self.keyFile.OFObject];
|
||||||
[self.mainViewController reset];
|
[self.mainViewController reset];
|
||||||
|
|
||||||
[self.navigationController popViewControllerAnimated: YES];
|
[self.navigationController popViewControllerAnimated: YES];
|
||||||
|
@ -123,4 +121,11 @@ showAlert(UIViewController *controller, NSString *title, NSString *message)
|
||||||
{
|
{
|
||||||
[self.navigationController popViewControllerAnimated: YES];
|
[self.navigationController popViewControllerAnimated: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)prepareForSegue: (UIStoryboardSegue *)segue
|
||||||
|
sender: (id)sender
|
||||||
|
{
|
||||||
|
if ([segue.identifier isEqual: @"selectKeyFile"])
|
||||||
|
[segue.destinationViewController setAddSiteController: self];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -293,6 +293,7 @@
|
||||||
<outlet property="legacySwitch" destination="jcs-6K-Sbe" id="sCo-l6-9n7"/>
|
<outlet property="legacySwitch" destination="jcs-6K-Sbe" id="sCo-l6-9n7"/>
|
||||||
<outlet property="lengthField" destination="KQA-JL-1zl" id="tdI-mj-8Ng"/>
|
<outlet property="lengthField" destination="KQA-JL-1zl" id="tdI-mj-8Ng"/>
|
||||||
<outlet property="nameField" destination="AXY-MA-LhE" id="Noo-It-VNV"/>
|
<outlet property="nameField" destination="AXY-MA-LhE" id="Noo-It-VNV"/>
|
||||||
|
<segue destination="4bs-rP-TxE" kind="show" identifier="selectKeyFile" id="wen-iK-VNb"/>
|
||||||
</connections>
|
</connections>
|
||||||
</tableViewController>
|
</tableViewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="6ti-F1-srK" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="6ti-F1-srK" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
@ -302,6 +303,37 @@
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="1992.8" y="-1102.3988005997003"/>
|
<point key="canvasLocation" x="1992.8" y="-1102.3988005997003"/>
|
||||||
</scene>
|
</scene>
|
||||||
|
<!--Select Key File Controller-->
|
||||||
|
<scene sceneID="fKq-Aa-JNA">
|
||||||
|
<objects>
|
||||||
|
<tableViewController id="4bs-rP-TxE" customClass="SelectKeyFileController" sceneMemberID="viewController">
|
||||||
|
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="SYH-wm-J8Z">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
|
<prototypes>
|
||||||
|
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="QAR-8T-qhV">
|
||||||
|
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
|
||||||
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="QAR-8T-qhV" id="u3r-6g-c9v">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
|
||||||
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
</tableViewCellContentView>
|
||||||
|
</tableViewCell>
|
||||||
|
</prototypes>
|
||||||
|
<connections>
|
||||||
|
<outlet property="dataSource" destination="4bs-rP-TxE" id="ETv-7q-fl3"/>
|
||||||
|
<outlet property="delegate" destination="4bs-rP-TxE" id="Tnz-0X-Y4f"/>
|
||||||
|
</connections>
|
||||||
|
</tableView>
|
||||||
|
<toolbarItems/>
|
||||||
|
<navigationItem key="navigationItem" id="bWa-Dd-f4f"/>
|
||||||
|
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||||
|
</tableViewController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="hBM-t2-PD9" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="2935" y="-1234"/>
|
||||||
|
</scene>
|
||||||
<!--Show Details Controller-->
|
<!--Show Details Controller-->
|
||||||
<scene sceneID="rn9-fJ-mg7">
|
<scene sceneID="rn9-fJ-mg7">
|
||||||
<objects>
|
<objects>
|
||||||
|
|
|
@ -35,5 +35,7 @@
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
</array>
|
</array>
|
||||||
|
<key>UIFileSharingEnabled</key>
|
||||||
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
- (NSInteger)tableView: (UITableView *)tableView
|
- (NSInteger)tableView: (UITableView *)tableView
|
||||||
numberOfRowsInSection: (NSInteger)section
|
numberOfRowsInSection: (NSInteger)section
|
||||||
{
|
{
|
||||||
return [self.sites count];
|
return self.sites.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UITableViewCell *)tableView: (UITableView *)tableView
|
- (UITableViewCell *)tableView: (UITableView *)tableView
|
||||||
|
|
34
iOS/SelectKeyFileController.h
Normal file
34
iOS/SelectKeyFileController.h
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
|
*
|
||||||
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice is present in all copies.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
#import "AddSiteController.h"
|
||||||
|
|
||||||
|
@interface SelectKeyFileController: UITableViewController <UITableViewDelegate,
|
||||||
|
UITableViewDataSource>
|
||||||
|
{
|
||||||
|
NSArray<NSString *> *_keyFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property (retain) AddSiteController *addSiteController;
|
||||||
|
@end
|
95
iOS/SelectKeyFileController.m
Normal file
95
iOS/SelectKeyFileController.m
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
|
*
|
||||||
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice is present in all copies.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import "SelectKeyFileController.h"
|
||||||
|
|
||||||
|
@implementation SelectKeyFileController
|
||||||
|
- (void)viewDidLoad
|
||||||
|
{
|
||||||
|
NSString *documentDirectory;
|
||||||
|
NSArray<NSString *> *keyFiles;
|
||||||
|
NSError *error;
|
||||||
|
|
||||||
|
[super viewDidLoad];
|
||||||
|
|
||||||
|
if ((documentDirectory = NSSearchPathForDirectoriesInDomains(
|
||||||
|
NSDocumentDirectory, NSUserDomainMask, YES).firstObject) == nil) {
|
||||||
|
NSLog(@"Could not get key files: No documents directory");
|
||||||
|
[self.navigationController popViewControllerAnimated: YES];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
keyFiles = [NSFileManager.defaultManager
|
||||||
|
contentsOfDirectoryAtPath: documentDirectory
|
||||||
|
error: &error];
|
||||||
|
|
||||||
|
if (keyFiles == nil) {
|
||||||
|
NSLog(@"Could not get key files: %@", error);
|
||||||
|
[self.navigationController popViewControllerAnimated: YES];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_keyFiles = [[keyFiles sortedArrayUsingSelector:
|
||||||
|
@selector(compare:)] retain];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dealloc
|
||||||
|
{
|
||||||
|
[_keyFiles release];
|
||||||
|
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSInteger)tableView: (UITableView *)tableView
|
||||||
|
numberOfRowsInSection: (NSInteger)section
|
||||||
|
{
|
||||||
|
return _keyFiles.count + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UITableViewCell *)tableView: (UITableView *)tableView
|
||||||
|
cellForRowAtIndexPath: (NSIndexPath *)indexPath
|
||||||
|
{
|
||||||
|
UITableViewCell *cell = [tableView
|
||||||
|
dequeueReusableCellWithIdentifier: @"keyFile"];
|
||||||
|
|
||||||
|
if (cell == nil)
|
||||||
|
cell = [[[UITableViewCell alloc]
|
||||||
|
initWithStyle: UITableViewCellStyleDefault
|
||||||
|
reuseIdentifier: @"keyFile"] autorelease];
|
||||||
|
|
||||||
|
cell.textLabel.text =
|
||||||
|
(indexPath.row > 0 ? _keyFiles[indexPath.row - 1] : @"None");
|
||||||
|
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)tableView: (UITableView *)tableView
|
||||||
|
didSelectRowAtIndexPath: (NSIndexPath *)indexPath
|
||||||
|
{
|
||||||
|
self.addSiteController.keyFile =
|
||||||
|
(indexPath.row > 0 ? _keyFiles[indexPath.row - 1] : nil);
|
||||||
|
self.addSiteController.keyFileLabel.text =
|
||||||
|
(indexPath.row > 0 ? _keyFiles[indexPath.row - 1] : @"None");
|
||||||
|
|
||||||
|
[self.navigationController popViewControllerAnimated: YES];
|
||||||
|
}
|
||||||
|
@end
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
@ -186,6 +186,24 @@ clearNSMutableString(NSMutableString *string)
|
||||||
generator.site = _name;
|
generator.site = _name;
|
||||||
generator.length = _length;
|
generator.length = _length;
|
||||||
|
|
||||||
|
if (_keyFile != nil) {
|
||||||
|
NSString *documentDirectory;
|
||||||
|
OFString *keyFilePath;
|
||||||
|
|
||||||
|
if ((documentDirectory = NSSearchPathForDirectoriesInDomains(
|
||||||
|
NSDocumentDirectory, NSUserDomainMask, YES).firstObject) ==
|
||||||
|
nil) {
|
||||||
|
NSLog(@"Could not get key files: No documents "
|
||||||
|
@"directory");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
keyFilePath = [documentDirectory.OFObject
|
||||||
|
stringByAppendingPathComponent: _keyFile];
|
||||||
|
generator.keyFile = [OFMutableData
|
||||||
|
dataWithContentsOfFile: keyFilePath];
|
||||||
|
}
|
||||||
|
|
||||||
passphrase = of_strdup(self.passphraseField.text.UTF8String);
|
passphrase = of_strdup(self.passphraseField.text.UTF8String);
|
||||||
generator.passphrase = passphrase;
|
generator.passphrase = passphrase;
|
||||||
|
|
||||||
|
@ -200,6 +218,11 @@ clearNSMutableString(NSMutableString *string)
|
||||||
@try {
|
@try {
|
||||||
[generator derivePassword];
|
[generator derivePassword];
|
||||||
} @finally {
|
} @finally {
|
||||||
|
if (generator.keyFile != nil)
|
||||||
|
of_explicit_memset(
|
||||||
|
(void *)generator.keyFile.items, 0,
|
||||||
|
generator.keyFile.count);
|
||||||
|
|
||||||
of_explicit_memset(passphrase, 0, strlen(passphrase));
|
of_explicit_memset(passphrase, 0, strlen(passphrase));
|
||||||
free(passphrase);
|
free(passphrase);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
|
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
|
||||||
*
|
*
|
||||||
* https://heap.zone/git/scrypt-pwgen.git
|
* https://heap.zone/git/scrypt-pwgen.git
|
||||||
*
|
*
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
4BA115D31DA9432D007ED4EA /* NewPasswordGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA115D01DA9432D007ED4EA /* NewPasswordGenerator.m */; settings = {COMPILER_FLAGS = "-fconstant-string-class=OFConstantString -fno-constant-cfstrings"; }; };
|
4BA115D31DA9432D007ED4EA /* NewPasswordGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA115D01DA9432D007ED4EA /* NewPasswordGenerator.m */; settings = {COMPILER_FLAGS = "-fconstant-string-class=OFConstantString -fno-constant-cfstrings"; }; };
|
||||||
4BA115D61DA94390007ED4EA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BA115D51DA94390007ED4EA /* UIKit.framework */; };
|
4BA115D61DA94390007ED4EA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BA115D51DA94390007ED4EA /* UIKit.framework */; };
|
||||||
4BB3CDFD1DA9764300FEE5ED /* AddSiteController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BB3CDFC1DA9764300FEE5ED /* AddSiteController.m */; };
|
4BB3CDFD1DA9764300FEE5ED /* AddSiteController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BB3CDFC1DA9764300FEE5ED /* AddSiteController.m */; };
|
||||||
|
4BC29DD51FCB5FAE00A1E786 /* SelectKeyFileController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC29DD41FCB5FAE00A1E786 /* SelectKeyFileController.m */; };
|
||||||
4BF4ADEA1DA9A3DB0073B995 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BF4ADE91DA9A3DB0073B995 /* Foundation.framework */; };
|
4BF4ADEA1DA9A3DB0073B995 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BF4ADE91DA9A3DB0073B995 /* Foundation.framework */; };
|
||||||
4BF4ADED1DA9A6B00073B995 /* SiteStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BF4ADEC1DA9A6B00073B995 /* SiteStorage.m */; settings = {COMPILER_FLAGS = "-fconstant-string-class=OFConstantString -fno-constant-cfstrings"; }; };
|
4BF4ADED1DA9A6B00073B995 /* SiteStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BF4ADEC1DA9A6B00073B995 /* SiteStorage.m */; settings = {COMPILER_FLAGS = "-fconstant-string-class=OFConstantString -fno-constant-cfstrings"; }; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
@ -67,6 +68,8 @@
|
||||||
4BA115D51DA94390007ED4EA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
4BA115D51DA94390007ED4EA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||||
4BB3CDFB1DA9764300FEE5ED /* AddSiteController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddSiteController.h; sourceTree = "<group>"; };
|
4BB3CDFB1DA9764300FEE5ED /* AddSiteController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddSiteController.h; sourceTree = "<group>"; };
|
||||||
4BB3CDFC1DA9764300FEE5ED /* AddSiteController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddSiteController.m; sourceTree = "<group>"; };
|
4BB3CDFC1DA9764300FEE5ED /* AddSiteController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddSiteController.m; sourceTree = "<group>"; };
|
||||||
|
4BC29DD41FCB5FAE00A1E786 /* SelectKeyFileController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SelectKeyFileController.m; sourceTree = "<group>"; };
|
||||||
|
4BC29DD61FCB5FC400A1E786 /* SelectKeyFileController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SelectKeyFileController.h; sourceTree = "<group>"; };
|
||||||
4BF4ADE91DA9A3DB0073B995 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
4BF4ADE91DA9A3DB0073B995 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||||
4BF4ADEB1DA9A6B00073B995 /* SiteStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SiteStorage.h; sourceTree = "<group>"; };
|
4BF4ADEB1DA9A6B00073B995 /* SiteStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SiteStorage.h; sourceTree = "<group>"; };
|
||||||
4BF4ADEC1DA9A6B00073B995 /* SiteStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SiteStorage.m; sourceTree = "<group>"; };
|
4BF4ADEC1DA9A6B00073B995 /* SiteStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SiteStorage.m; sourceTree = "<group>"; };
|
||||||
|
@ -120,6 +123,8 @@
|
||||||
4B2E52E81DA942840040D091 /* Main.storyboard */,
|
4B2E52E81DA942840040D091 /* Main.storyboard */,
|
||||||
4B2E52E51DA942840040D091 /* MainViewController.h */,
|
4B2E52E51DA942840040D091 /* MainViewController.h */,
|
||||||
4B2E52E61DA942840040D091 /* MainViewController.m */,
|
4B2E52E61DA942840040D091 /* MainViewController.m */,
|
||||||
|
4BC29DD61FCB5FC400A1E786 /* SelectKeyFileController.h */,
|
||||||
|
4BC29DD41FCB5FAE00A1E786 /* SelectKeyFileController.m */,
|
||||||
4B0719231DAA78D80065997A /* ShowDetailsController.h */,
|
4B0719231DAA78D80065997A /* ShowDetailsController.h */,
|
||||||
4B0719241DAA78D80065997A /* ShowDetailsController.m */,
|
4B0719241DAA78D80065997A /* ShowDetailsController.m */,
|
||||||
4BF4ADEB1DA9A6B00073B995 /* SiteStorage.h */,
|
4BF4ADEB1DA9A6B00073B995 /* SiteStorage.h */,
|
||||||
|
@ -226,6 +231,7 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
4B82D1151DAAAFCE00F32B2F /* AboutController.m in Sources */,
|
4B82D1151DAAAFCE00F32B2F /* AboutController.m in Sources */,
|
||||||
|
4BC29DD51FCB5FAE00A1E786 /* SelectKeyFileController.m in Sources */,
|
||||||
4BB3CDFD1DA9764300FEE5ED /* AddSiteController.m in Sources */,
|
4BB3CDFD1DA9764300FEE5ED /* AddSiteController.m in Sources */,
|
||||||
4B2E52E41DA942840040D091 /* AppDelegate.m in Sources */,
|
4B2E52E41DA942840040D091 /* AppDelegate.m in Sources */,
|
||||||
4BA115D21DA9432D007ED4EA /* LegacyPasswordGenerator.m in Sources */,
|
4BA115D21DA9432D007ED4EA /* LegacyPasswordGenerator.m in Sources */,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue