A library that provides a convenient interface for securely managing email

KeyChainManager

The KeychainManager is a library that provides a convenient interface for securely managing email and password data in the keychain.

Features

  • Save email and password securely in the keychain.
  • Update existing email and password stored in the keychain.
  • Delete email and password from the keychain.

Installation

Swift Package Manager

To use the KeychainManager library in your project, follow these steps:

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding KeyChainManager as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/abbasjoyia99/KeyChainManager.git", .upToNextMajor(from: "1.0.0"))
]

Manually

If you prefer not to use any of the aforementioned dependency managers, you can integrate KeyChainManager into your project manually.

  • Add the KeychainManager.swift file to your project.
  • Ensure that the Security.framework is linked with your project.

Usage

  • To get started with the KeychainManager, follow the example below:

import KeyChainManager
// Save email
let emailSaved = KeychainManager.shared.saveEmail(email: "example@example.com")
if emailSaved {
    print("Email saved successfully.")
} else {
    print("Failed to save email.")
}

// Save password
let passwordSaved = KeychainManager.shared.savePassword(password: "password123")
if passwordSaved {
    print("Password saved successfully.")
} else {
    print("Failed to save password.")
}

// Update email
let emailUpdated = KeychainManager.shared.updateEmail(newEmail: "new@example.com")
if emailUpdated {
    print("Email updated successfully.")
} else {
    print("Failed to update email.")
}

// Update password
let passwordUpdated = KeychainManager.shared.updatePassword(newPassword: "newpassword123")
if passwordUpdated {
    print("Password updated successfully.")
} else {
    print("Failed to update password.")
}

// Delete email
let emailDeleted = KeychainManager.shared.deleteEmail()
if emailDeleted {
    print("Email deleted successfully.")
} else {
    print("Failed to delete email.")
}

// Delete password
let passwordDeleted = KeychainManager.shared.deletePassword()
if passwordDeleted {
    print("Password deleted successfully.")
} else {
    print("Failed to delete password.")
}

Contribution

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

Credits

The KeychainManager library is developed and maintained by Ghullam abbas.

Contact

For any inquiries, please contact abbasjoyia99@gmil.com.

GitHub

View Github