Skip to content

Commit

Permalink
Delay generating default id_rsa. Refs blinksh#734
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Jun 13, 2019
1 parent 53e8d47 commit 2ca45c5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Settings/Model/BKPubKey.m
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,12 @@ + (void)loadIDS
if ((Identities = [NSKeyedUnarchiver unarchiveObjectWithFile:[BlinkPaths blinkKeysFile]]) == nil) {
// Initialize the structure if it doesn't exist, with a default id_rsa key
Identities = [[NSMutableArray alloc] init];
Pki *defaultKey = [[Pki alloc] initRSAWithLength:4096];
[self saveCard:@"id_rsa" privateKey:defaultKey.privateKey publicKey:[defaultKey publicKeyWithComment:@""]];

// Create default key in next main queue step in order to speedup app start.
dispatch_async(dispatch_get_main_queue(), ^{
Pki *defaultKey = [[Pki alloc] initRSAWithLength:4096];
[self saveCard:@"id_rsa" privateKey:defaultKey.privateKey publicKey:[defaultKey publicKeyWithComment:@""]];
});
}
}

Expand Down

0 comments on commit 2ca45c5

Please sign in to comment.