CryptoPassphrase  Diff

Differences From Artifact [75a5ea2c02]:

To Artifact [07cb7c3f7e]:


27
28
29
30
31
32
33
34

35
36
37
38
39
40
41
27
28
29
30
31
32
33

34
35
36
37
38
39
40
41







-
+








#import "SiteStorage.h"
#import "PasswordGenerator.h"
#import "NewPasswordGenerator.h"
#import "LegacyPasswordGenerator.h"

@interface ShowDetailsController ()
- (void)_generateWithCallback: (void(^)(NSMutableString*))block;
- (void)_generateWithCallback: (void (^)(NSMutableString *))block;
- (void)_generateAndCopy;
- (void)_generateAndShow;
@end

static void
clearNSMutableString(NSMutableString *string)
{
82
83
84
85
86
87
88
89

90
91
92
93
94
95
96


97
98
99
100
101
102
103
82
83
84
85
86
87
88

89
90
91
92
93
94


95
96
97
98
99
100
101
102
103







-
+





-
-
+
+







}

- (void)viewDidAppear: (BOOL)animated
{
	[self.passphraseField becomeFirstResponder];
}

- (BOOL)textFieldShouldReturn: (UITextField*)textField
- (BOOL)textFieldShouldReturn: (UITextField *)textField
{
	[textField resignFirstResponder];
	return NO;
}

-	  (void)tableView: (UITableView*)tableView
  didSelectRowAtIndexPath: (NSIndexPath*)indexPath
-	  (void)tableView: (UITableView *)tableView
  didSelectRowAtIndexPath: (NSIndexPath *)indexPath
{
	[self.passphraseField resignFirstResponder];
	[tableView deselectRowAtIndexPath: indexPath
				 animated: YES];

	if (indexPath.section == 3) {
		switch (indexPath.row) {
157
158
159
160
161
162
163
164

165
166
167
168
169
170
171
157
158
159
160
161
162
163

164
165
166
167
168
169
170
171







-
+







				   animated: YES
				 completion: ^ {
			clearNSMutableString(password);
		}];
	}];
}

- (void)_generateWithCallback: (void(^)(NSMutableString*))block
- (void)_generateWithCallback: (void (^)(NSMutableString *))block
{
	UIStoryboard *mainStoryboard =
	[UIStoryboard storyboardWithName: @"Main"
				  bundle: nil];
	UIViewController *activityController = [mainStoryboard
	    instantiateViewControllerWithIdentifier: @"activityIndicator"];
	[self.navigationController.view addSubview: activityController.view];
191
192
193
194
195
196
197
198

199
200

201
202
203
204
205
206
207
191
192
193
194
195
196
197

198
199

200
201
202
203
204
205
206
207







-
+

-
+







			[generator derivePassword];
		} @finally {
			of_explicit_memset(passphrase, 0, strlen(passphrase));
			free(passphrase);
		}

		NSMutableString *password = [NSMutableString
		    stringWithUTF8String: (char*)generator.output];
		    stringWithUTF8String: (char *)generator.output];
		of_explicit_memset(generator.output, 0,
		    strlen((char*)generator.output));
		    strlen((char *)generator.output));

		activityController.view.hidden = YES;
		block(password);
	});
}

- (IBAction)remove: (id)sender