Add search and copy password in extension
- no lock screen for now - share keychain between app and extension
This commit is contained in:
parent
abe1c46d83
commit
8e5a824cca
11 changed files with 362 additions and 132 deletions
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
enum AppError: Error {
|
||||
public enum AppError: Error {
|
||||
case RepositoryNotSetError
|
||||
case RepositoryRemoteMasterNotFoundError
|
||||
case KeyImportError
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class Utils {
|
|||
}
|
||||
|
||||
public static func getPasswordFromKeychain(name: String) -> String? {
|
||||
let keychain = Keychain(service: Globals.bundleIdentifier)
|
||||
let keychain = Keychain(service: Globals.bundleIdentifier, accessGroup: Globals.groupIdentifier)
|
||||
do {
|
||||
return try keychain.getString(name)
|
||||
} catch {
|
||||
|
|
@ -73,19 +73,21 @@ public class Utils {
|
|||
}
|
||||
|
||||
public static func addPasswordToKeychain(name: String, password: String?) {
|
||||
let keychain = Keychain(service: Globals.bundleIdentifier)
|
||||
let keychain = Keychain(service: Globals.bundleIdentifier, accessGroup: Globals.groupIdentifier)
|
||||
keychain[name] = password
|
||||
}
|
||||
|
||||
public static func removeKeychain(name: String) {
|
||||
let keychain = Keychain(service: Globals.bundleIdentifier)
|
||||
let keychain = Keychain(service: Globals.bundleIdentifier, accessGroup: Globals.groupIdentifier)
|
||||
do {
|
||||
try keychain.remove(name)
|
||||
} catch {
|
||||
print(error)
|
||||
}
|
||||
}
|
||||
|
||||
public static func removeAllKeychain() {
|
||||
let keychain = Keychain(service: Globals.bundleIdentifier)
|
||||
let keychain = Keychain(service: Globals.bundleIdentifier, accessGroup: Globals.groupIdentifier)
|
||||
do {
|
||||
try keychain.removeAll()
|
||||
} catch {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue