Allow usage of uploaded PGP keys
This commit is contained in:
parent
5e581aa6da
commit
bb654849af
2 changed files with 70 additions and 2 deletions
|
|
@ -171,12 +171,16 @@ class PasswordStore {
|
|||
if pgp.getKeysOf(.secret).count == 0 {
|
||||
throw NSError(domain: "me.mssun.pass.error", code: 2, userInfo: [NSLocalizedDescriptionKey: "Cannot import seceret key."])
|
||||
}
|
||||
let key = pgp.getKeysOf(.public)[0]
|
||||
let key: PGPKey = getPgpPrivateKey()
|
||||
Defaults[.pgpKeyID] = key.keyID!.shortKeyString
|
||||
if let gpgUser = key.users[0] as? PGPUser {
|
||||
Defaults[.pgpKeyUserID] = gpgUser.userID
|
||||
}
|
||||
}
|
||||
|
||||
func getPgpPrivateKey() -> PGPKey {
|
||||
return pgp.getKeysOf(.secret)[0]
|
||||
}
|
||||
|
||||
func initPGP(pgpPublicKeyURL: URL, pgpPublicKeyLocalPath: String, pgpPrivateKeyURL: URL, pgpPrivateKeyLocalPath: String) throws {
|
||||
let pgpPublicData = try Data(contentsOf: pgpPublicKeyURL)
|
||||
|
|
@ -192,7 +196,6 @@ class PasswordStore {
|
|||
try initPGP(pgpPublicKeyLocalPath: pgpPublicKeyLocalPath, pgpPrivateKeyLocalPath: pgpPrivateKeyLocalPath)
|
||||
}
|
||||
|
||||
|
||||
func cloneRepository(remoteRepoURL: URL,
|
||||
credential: GitCredential,
|
||||
transferProgressBlock: @escaping (UnsafePointer<git_transfer_progress>, UnsafeMutablePointer<ObjCBool>) -> Void,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue