Skip to content
Snippets Groups Projects
Commit 18016fbb authored by maik65's avatar maik65
Browse files

issue #137: calling function findMailforSecretKey in function storeMultipleKeys.

parent 4a715c64
No related branches found
No related tags found
2 merge requests!58Onboarding screens swift ui merge dev,!55WIP: Resolve "UI for gamifcation & stats"
......@@ -316,16 +316,20 @@ class SwiftPGP: Encryption {
return readKeys(data: data, importDate: importDate)
}
private func storeMultipleKeys(keys: [Key], pw: String?, secret: Bool )-> [String]{
private func storeMultipleKeys(keys: [Key], pw: String?, secret: Bool)-> [String] {
var ids = [String]()
let keyring = Keyring()
// merge secret and public keys
keyring.import(keys: keys)
let newKeys = keyring.keys
for k in newKeys{
if k.isSecret && secret || !k.isSecret && !secret{
ids.append(storeKey(key: k))
if let password = pw{
for k in newKeys {
if k.isSecret && secret || !k.isSecret && !secret {
let id = storeKey(key: k)
ids.append(id)
if k.isSecret && secret {
findMailForSecretKey(keyID: id)
}
if let password = pw {
pwKeyChain[k.keyID.longIdentifier] = password
}
}
......@@ -335,7 +339,7 @@ class SwiftPGP: Encryption {
func store(tempKeys: [TempKey]) -> [String] {
var ids: [String] = []
tempKeys.forEach{
tempKeys.forEach {
ids.append(contentsOf: storeMultipleKeys(keys: [$0.key!], pw: $0.password, secret: $0.isSecret))
}
return ids
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment