Support folder operations
Example: - add: a/b/c/d - delete: a/b/c/d - move: a/b/c/d -> a/b/c/d/e
This commit is contained in:
parent
b1ef8a343f
commit
d8ecd1e889
8 changed files with 213 additions and 141 deletions
|
|
@ -21,24 +21,6 @@ extension PasswordEntity {
|
|||
}
|
||||
}
|
||||
|
||||
func decrypt(passphrase: String) throws -> Password? {
|
||||
var password: Password?
|
||||
let encryptedDataPath = URL(fileURLWithPath: "\(Globals.repositoryPath)/\(path!)")
|
||||
let encryptedData = try Data(contentsOf: encryptedDataPath)
|
||||
let decryptedData = try PasswordStore.shared.pgp.decryptData(encryptedData, passphrase: passphrase)
|
||||
let plainText = String(data: decryptedData, encoding: .utf8) ?? ""
|
||||
password = Password(name: name!, plainText: plainText)
|
||||
return password
|
||||
}
|
||||
|
||||
func encrypt(password: Password) throws -> Data {
|
||||
name = password.name
|
||||
let plainData = password.getPlainData()
|
||||
let pgp = PasswordStore.shared.pgp
|
||||
let encryptedData = try pgp.encryptData(plainData, usingPublicKey: pgp.getKeysOf(.public)[0], armored: Defaults[.encryptInArmored])
|
||||
return encryptedData
|
||||
}
|
||||
|
||||
func getCategoryText() -> String {
|
||||
var parentEntity = parent
|
||||
var passwordCategoryArray: [String] = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue