Marino Faggiana 7 years ago
parent
commit
d81b06c6cb

+ 13 - 0
iOSClient/Settings/NCManageEndToEndEncryption.m

@@ -56,6 +56,14 @@
     row.action.formSelector = @selector(deletePrivateKey:);
     [section addFormRow:row];
     
+    // Inizializze e2e
+    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"initE2E" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_e2e_settings_encryption_initialize_", nil)];
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+    [row.cellConfig setObject:[UIColor blackColor] forKey:@"textLabel.textColor"];
+    [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
+    row.action.formSelector = @selector(initE2E:);
+    [section addFormRow:row];
+    
     return [super initWithForm:form];
 }
 
@@ -79,4 +87,9 @@
     [app addNetworkingOperationQueue:app.netQueue delegate:app.activeMain metadataNet:metadataNet];
 }
 
+- (void)initE2E:(XLFormRowDescriptor *)sender
+{
+    [CCUtility initEndToEnd:app.activeAccount];
+}
+
 @end

+ 1 - 0
iOSClient/Utility/CCUtility.h

@@ -95,6 +95,7 @@
 + (void)setEndToEndPrivateKey:(NSString *)account privateKey:(NSString *)privateKey;
 + (void)setEndToEndMnemonic:(NSString *)account mnemonic:(NSString *)mnemonic;
 + (void)setEndToEndServerPublicKey:(NSString *)account publicKey:(NSString *)publicKey;
++ (void)initEndToEnd:(NSString *)account;
 
 // GET
 

+ 8 - 0
iOSClient/Utility/CCUtility.m

@@ -245,6 +245,14 @@
     [UICKeyChainStore setString:publicKey forKey:key service:k_serviceShareKeyChain];
 }
 
++ (void)initEndToEnd:(NSString *)account
+{
+    [self setEndToEndPublicKey:account publicKey:nil];
+    [self setEndToEndPrivateKey:account privateKey:nil];
+    [self setEndToEndMnemonic:account mnemonic:nil];
+    [self setEndToEndServerPublicKey:account publicKey:nil];
+}
+
 #pragma ------------------------------ GET
 
 + (NSString *)getKeyChainPasscodeForUUID:(NSString *)uuid