A Layer-2 framework built over Keychain API which helps in using Keychain in all your Apple devices with easiness and flexibility.

Overview

KCM Logo

Keychain Manager

Keychain Manager is a Layer-2 framework built over Keychain API which helps in using Keychain in all your Apple devices with easiness and flexibility. It focuses on using all the power of Keychain with high simplicity. The easy to use methods of Keychain Manager helps to setup Keychain on any Apple device with great convenience.

📔 Usage

⚙️ Intilisation

Before using any Keychain Manager methods we need to intialise the class. Keychain Manager supports various types of inilisation which depends upon variety of use cases

🗳 Basic Initialisation

  • This initilisation stores all the Keychain items on the local device.
  • Such initilisations are best used when the app is single login based.
let KCM = KeychainManager()

🗳 Prefix Initiliser

  • This initiliser helps to add a prefix value in your account string.
  • Such initilisations are best used when performing tests (Eg: test_account1_).
 let KCM = KeychainManager(keyPrefix: "test")

🗳 Sharable Initiliser

  • Keychain Manger allowes developers to share the keychain values to other apps also synchronise with iCloud.
  • Such initilisations are best used when you need to share Keychain values among apps.
  • Eg: A same app running on two different devices with same iCloudID & To share data between Different apps running on same or different device
let KCM = KeychainManager(accessGroup: "TeamID.KeychainGroupID", synchronizable: true)

🗳 Prefix + Sharable

  • When you need to add both prefix and sharable propert on keychain then this initialisation is the best one to use
 let KCM = KeychainManager(keyPrefix: "test", accessGroup: "TeamID.KeychainGroupID", synchronizable: true)

🛠 Operations

Following are the methods which help to perfrom various operations:

🔑 SET

  • Used to save data on keychain.
  • Keychain Manager Supports variety of data storage

String

KCM.set(value: "value", service: service_ID, account: account_name)

Bool

KCM.set(value: true, service: service_ID, account: account_name)

Custom Object

KCM.set(object: Any_Codable_Object, service: service_ID, account: account_name)

Web Credentials

KCM.set(server: server_ID, account: account_name, password: password)

Tip: Make sure Account, Service & Server parameter must be unique for every item.

🔑 GET

  • Used to get Keychain Items.
  • Keychain Manager helps to GET variety of format of Data from Keychain Storage

String

let value = KCM.get(service: service_ID, account: account_name)

Bool

let value = KCM.getBool(service: service_ID, account: account_name)

Custom Object

 let value = KCM.get(object: Any_Codable_Object, service: service_ID, account: account_name)

Web Credentials

let value = KCM.get(server: server_ID, account: account_name)

Get All Values

  • Generic Password
 let value = KCM.getAllValues(secClass: .genericPassword)
  • Web Credentials
 let value = KCM.getAllValues(secClass: .webCredentials)

🔑 UPDATE

  • Used to update Kechain Item Values
  • Since we have variety of SET and GET methods, similarly to update them we have variety of UPDATE methods

String

KCM.update(value: "value", service: service_ID, account: account_name)

Bool

KCM.update(value: true, service: service_ID, account: account_name)

Custom Object

KCM.update(object: Any_Codable_Object, service: service_ID, account: account_name)

Web Credentials

KCM.update(server: server_ID, account: account_name, password: password)

🔑 DELETE

  • Used to delete Keychain Items

Service Deletion

 do {
    try KCMTest.delete(service: service_ID, isCustomObjectType: false)
 }
 catch {
    print(error.localizedDescription)
}
  • isCustomObjectType is used to explicitly tell Keychain Manager to delete a custom Object type.
  • By default the value of isCustomObjectType is false

Server Deletion

 do {
    try KCMTest.delete(server: server_ID)
 }
 catch {
    print(error.localizedDescription)
}

🔑 VALIDATE

  • Is used to check if a certain Server or Service based keychain is valid/present.

Service

 if KCM.isValidService(service: service_ID, account: account_name) {
        print("🙂")
 } else {
        print("☹️")
 }

Server

 if KCM.isValidService(server: server_ID, account: account_name) {
     print("🙂")
 } else {
     print("☹️")
 }

☁️ iCloud Sync

  • iCloud synchronisation needs to be set during initilisation.
  • Make sure to use the sharable initialisation at every method to save all changes on cloud.

📱 Device Supported

No Device Version
1 iOS 13.0.0 +
2 iPadOS 13.0.0 +
3 WatchOS 6.0.0 +
4 MacOS 11.0.0 +
5 tvOS 11.0.0 +

📌 Keynotes

Make sure you know these keynotes before using Keychain Manager

  • GET Bool will return false even after deleting the Keychain item.
  • To delete a custom object make sure you explicitly tell Keychain Manager that its a custom object in the delete method.
  • By enabling iCloud sync you also enable Keychain Access Group, thus adding Keychain Sharing capability is important (How to do it?).
  • Every Keychain item stored through MacOS is also saved in form of iOS, making it easy for developers to share same keychain data among all platforms. Thus keychain manager will give access to your MacOS based keychain items on other platforms too (Read this).
  • Keychain Items stored on tvOS will not sync with other platforms (Read this).

📦 SPM

Keychain Manger is available through Swift Package Manager. To add Keychain Manager through SPM

  • Open project in Xcode
  • Select File > Add Packages
https://github.com/gokulnair2001/KeychainManager

SPM Dialogue

🌐 Keychain Sharing

  • Open your project target
  • Select Signing & Capabilities option
  • Click plus button and search for Keychain Sharing

Keychain Sharing Capability

Screenshot 2022-06-17 at 3 38 39 PM

  • Make sure to use the same Keychain Item in other apps you add the Keychain access group ID of the initial project.

🪄 How to contribute ?

  • Use the framework through SPM
  • If you face issues in any step open a new issue.
  • To fix issues: Fork this repository, make your changes and make a Pull Request.

⚖️ License

  • Keychain Manager is available under GNU General Public License.

Like the framework ?

  • If you liked Keychain Manager do consider buying me a coffee 😊

BMC logo+wordmark - Black

Made with ❤️ in 🇮🇳 By Gokul Nair

You might also like...
A simple wrapper for the iOS Keychain to allow you to use it in a similar fashion to User Defaults. Written in Swift.

SwiftKeychainWrapper A simple wrapper for the iOS / tvOS Keychain to allow you to use it in a similar fashion to User Defaults. Written in Swift. Prov

Recover lost keychain passwords with swift

brutalkeychain Recover lost keychain passwords using a simple swift script (so c

Recover lost keychain passwords with swift

brutalkeychain Recover lost keychain passwords using a simple swift script (so c

Keep track of accessibility settings, leverage high contrast colors, and use scalable fonts to enable users with disabilities to use your app.
Keep track of accessibility settings, leverage high contrast colors, and use scalable fonts to enable users with disabilities to use your app.

Accessibility for iOS, macOS, tvOS, and watchOS 🎉 What's new in Capable 2.0 🎉 Here are the most important changes: 🏛 New framework architecture and

Swift managers package for the easiness of working with the various services.

SwiftManagers Description Swift managers package for the easiness of working with the various services. FirebaseAuth - Manager to handle Firebase auth

A view that shows selectable symbols, similar to UITableView's `sectionIndexTitles` API but with support for symbols and more flexibility
A view that shows selectable symbols, similar to UITableView's `sectionIndexTitles` API but with support for symbols and more flexibility

📖 TableOfContentsSelector Are you familiar with UITableView's sectionIndexTitles API? The little alphabet on the side of some tables for quickly jump

iCloud Drive is Apple's essential connection between all your devices, Mac, iPhone, iPad, even your Windows PC.
iCloud Drive is Apple's essential connection between all your devices, Mac, iPhone, iPad, even your Windows PC.

iCloud Drive is Apple's essential connection between all your devices, Mac, iPhone, iPad, even your Windows PC.While the cost of storage seems expensive in comparison to other online storage services, its advantage is that it works natively across all your devices.

Meet cute and very flexibility library for iOS application for different data view in one circle diagram.
Meet cute and very flexibility library for iOS application for different data view in one circle diagram.

SMDiagramViewSwift Meet cute and very flexibility library for iOS application for different data view in one circle diagram. The opportunity of transf

A simple and flexible way to add source of overlapping circular pictures, currently supports horizontal overlapping or distant pictures with great layout flexibility.
A simple and flexible way to add source of overlapping circular pictures, currently supports horizontal overlapping or distant pictures with great layout flexibility.

THIS PROJECT IS NO LONGER MAINTAINED. STILL ONE ONLY BEST UI SOLUTION FOR UIKIT DEVELOPERS. SOON WILL COME UP WITH SWIFTUI STILL CONTRIBUTORS ARE WELC

Swift Paging is a framework that helps you load and display pages of data from a larger dataset from local storage or over network.

Swift Paging is a framework that helps you load and display pages of data from a larger dataset from local storage or over network. This approach allows your app to use both network bandwidth and system resources more efficiently. It's built on top of Combine, allowing you to harness its full power, handle errors easily, etc.

Zephyr synchronizes specific keys and/or all of your UserDefaults over iCloud using NSUbiquitousKeyValueStore.
Zephyr synchronizes specific keys and/or all of your UserDefaults over iCloud using NSUbiquitousKeyValueStore.

Zephyr 🌬️ Effortlessly sync UserDefaults over iCloud About Zephyr synchronizes specific keys and/or all of your UserDefaults over iCloud using NSUbiq

UICKeyChainStore is a simple wrapper for Keychain on iOS, watchOS, tvOS and macOS. Makes using Keychain APIs as easy as NSUserDefaults.

UICKeyChainStore UICKeyChainStore is a simple wrapper for Keychain that works on iOS and OS X. Makes using Keychain APIs as easy as NSUserDefaults. Lo

🛶Shallows is a generic abstraction layer over lightweight data storage and persistence.

Shallows Shallows is a generic abstraction layer over lightweight data storage and persistence. It provides a StorageKey, Value type, instances of w

SecureDefaults is a wrapper over UserDefaults/NSUserDefaults with an extra AES-256 encryption layer

SecureDefaults for iOS, macOS Requirements • Usage • Installation • Contributing • Acknowledgments • Contributing • Author • License SecureDefaults is

Reactive WebSockets - A lightweight abstraction layer over Starscream to make it reactive.

RxWebSocket Reactive extensions for websockets. A lightweight abstraction layer over Starscream to make it reactive. Installation RxWebSocket is avail

 SQLite.swift - A type-safe, Swift-language layer over SQLite3.
SQLite.swift - A type-safe, Swift-language layer over SQLite3.

SQLite.swift provides compile-time confidence in SQL statement syntax and intent.

A lightweight wrapper over UserDefaults/NSUserDefaults with an additional layer of AES-256 encryption

SecureDefaults for iOS, macOS Requirements • Usage • Installation • Contributing • Acknowledgments • Contributing • Author • License SecureDefaults is

MapTeam - A type-safe, Swift-language layer over SQLite3
MapTeam - A type-safe, Swift-language layer over SQLite3

SQLite.swift A type-safe, Swift-language layer over SQLite3. SQLite.swift provid

Releases(1.0.0)
  • 1.0.0(Jun 17, 2022)

    Keychain Manager: v1.0.0

    • The first major release of Keychain Manager

    • The project also enables features like:

      1. iCloud Sync
      2. Access Group Sharing
      3. Adding Prefix
    • This version consists of all major methods like:

      1. GET
      2. SET
      3. UPDATE
      4. DELETE
      5. VALIDATE
    • Remaining details are mentioned in the Readme file of the project.

    Source code(tar.gz)
    Source code(zip)
Owner
Gokul Nair
iOS Intern @powerplay-developers📱| MLH Fellow'21 | Tech-Enthusiasts ☮️| Freelancer⚡️ | Student 🚀
Gokul Nair
Valet lets you securely store data in the iOS, tvOS, or macOS Keychain without knowing a thing about how the Keychain works. It’s easy. We promise.

Valet Valet lets you securely store data in the iOS, tvOS, watchOS, or macOS Keychain without knowing a thing about how the Keychain works. It’s easy.

Square 3.8k Jan 4, 2023
Keychain - Keychain wrapper with swift

Keychain wrapper. Store a value as a generic password: let account = "an-arbitra

Alejandro Ramirez 0 Mar 14, 2022
A tool to check which keychain items are available to an attacker once an iOS device has been jailbroken

Keychain Dumper Usage All that should be needed to use keychain_dumper is the binary that is checked in to the Keychain-Dumper Git repository. This bi

Patrick Toomey 1.2k Dec 28, 2022
Modern Swift wrapper for Keychain Services API with the benefits of static typing

SwiftyKeychainKit SwiftyKeychainKit is a simple Swift wrapper for Keychain Services API with the benefits of static typing. Define your keys in one pl

Andriy Slyusar 18 Jan 1, 2023
A keychain wrapper that is so easy to use that your cat could use it.

A keychain wrapper that is so easy to use that your cat could use it.

HyperRedink 71 Oct 15, 2022
Example of using TOTP with iCloud Keychain in iOS 15

Installation This example needs Ngrok and Ruby 3.0.3+. Setup project with Makefi

Makeeyaf 0 Dec 31, 2021
Simple Swift wrapper for Keychain that works on iOS, watchOS, tvOS and macOS.

KeychainAccess KeychainAccess is a simple Swift wrapper for Keychain that works on iOS and OS X. Makes using Keychain APIs extremely easy and much mor

Kishikawa Katsumi 7.2k Jan 5, 2023
Simple Objective-C wrapper for the keychain that works on Mac and iOS

SAMKeychain SAMKeychain is a simple wrapper for accessing accounts, getting passwords, setting passwords, and deleting passwords using the system Keyc

Sam Soffes 5.4k Jan 8, 2023
Accessibility Abstraction Layer (axabl) for macOS window management

axabl accessibility abstraction layer axabl is an abstraction layer over the accessibility API (and more) provided by Apple to make window management

null 2 Jul 31, 2022
A powerful, protocol-oriented library for working with the keychain in Swift.

Locksmith A powerful, protocol-oriented library for working with the keychain in Swift. ?? iOS 8.0+ ?? Mac OS X 10.10+ ⌚️ watchOS 2 ?? tvOS ?? I make

Matthew Palmer 2.9k Dec 21, 2022