Skip to content

Instantly share code, notes, and snippets.

@fitomad fitomad/keychain-update.swift Secret
Created Apr 8, 2019

Embed
What would you like to do?
// Filtro para encontrar el registro
let query: [String: Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrService as String : self.serviceName,
kSecAttrAccount as String: user.name
]
// La clave que queremos actualizar
let fields: [String: Any] = [
kSecAttrAccount as String: user.name,
kSecValueData as String: passwordData
]
// Ejecutamos la operación
let status = SecItemUpdate(query as CFDictionary, fields as CFDictionary)
// Comprobamos el resultado
if status != errSecSuccess
{
throw KeychainError.unknown(status: status)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.