Implement migration of existing PGP keys into Keychain
This commit is contained in:
parent
a66a79abc6
commit
e4e4c6daff
1 changed files with 10 additions and 0 deletions
|
|
@ -126,6 +126,7 @@ public class PasswordStore {
|
||||||
// File migration to group
|
// File migration to group
|
||||||
migrateIfNeeded()
|
migrateIfNeeded()
|
||||||
backwardCompatibility()
|
backwardCompatibility()
|
||||||
|
importExistingKeysIntoKeychain()
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if fm.fileExists(atPath: storeURL.path) {
|
if fm.fileExists(atPath: storeURL.path) {
|
||||||
|
|
@ -182,6 +183,15 @@ public class PasswordStore {
|
||||||
SharedDefaults[.isRememberPGPPassphraseOn] = true
|
SharedDefaults[.isRememberPGPPassphraseOn] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func importExistingKeysIntoKeychain() {
|
||||||
|
if let publicKey = fm.contents(atPath: Globals.pgpPublicKeyPath) {
|
||||||
|
Utils.addDataToKeychain(key: PGPKeyType.PUBLIC.rawValue, data: publicKey)
|
||||||
|
}
|
||||||
|
if let privateKey = fm.contents(atPath: Globals.pgpPrivateKeyPath) {
|
||||||
|
Utils.addDataToKeychain(key: PGPKeyType.PRIVATE.rawValue, data: privateKey)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
enum SSHKeyType {
|
enum SSHKeyType {
|
||||||
case `public`, secret
|
case `public`, secret
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue