SecureDefaults alternatives and similar libraries
Based on the "Database" category.
Alternatively, view SecureDefaults alternatives based on common mentions on social networks and blogs.
-
MMKV
An efficient, small mobile key-value storage framework developed by WeChat. Works on Android, iOS, macOS, Windows, and POSIX. -
YapDatabase
YapDB is a collection/key/value store with a plugin architecture. It's built atop sqlite, for Swift & objective-c developers. -
ParseAlternatives
DISCONTINUED. GraphQLite is a toolkit to work with GraphQL servers easily. It also provides several other features to make life easier during iOS application development. [Moved to: https://github.com/relatedcode/GraphQLite] -
Unrealm
Unrealm is an extension on RealmCocoa, which enables Swift native types to be saved in Realm. -
Prephirences
Prephirences is a Swift library that provides useful protocols and convenience methods to manage application preferences, configurations and app-state. UserDefaults -
PredicateEditor
A GUI for dynamically creating NSPredicates at runtime to query data in your iOS app. -
realm-cocoa-converter
A library that provides the ability to import/export Realm files from a variety of data container formats. -
MySQL
A stand-alone Swift wrapper around the MySQL client library, enabling access to MySQL servers. -
PersistenceKit
Store and retrieve Codable objects to various persistence layers, in a couple lines of code! -
PersistentStorageSerializable
Swift library that makes easier to serialize the user's preferences (app's settings) with system User Defaults or Property List file on disk. -
ObjectiveRocks
An Objective-C wrapper for RocksDB - A Persistent Key-Value Store for Flash and RAM Storage. -
MongoDB
A stand-alone Swift wrapper around the mongo-c client library, enabling access to MongoDB servers. -
PostgreSQL
A stand-alone Swift wrapper around the libpq client library, enabling access to PostgreSQL servers. -
FileMaker
A stand-alone Swift wrapper around the FileMaker XML Web publishing interface, enabling access to FileMaker servers.
SaaSHub - Software Alternatives and Reviews
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of SecureDefaults or a related project?
README
SecureDefaults for iOS, macOS
Requirements • Usage • Installation • Contributing • Acknowledgments • Contributing • Author • License
SecureDefaults
is a wrapper over UserDefaults/NSUserDefaults
with an extra AES-256 encryption layer (key size has 256-bit length). It encludes:
- AES-256 encryption
- Password stretching with PBKDF2
- Encrypt-then-hash HMAC
- Password salting
- Random IV
The design and strength of all key lengths of the AES algorithm (i.e., 128, 192 and 256) are sufficient to protect classified information up to the SECRET level. TOP SECRET information will require use of either the 192 or 256 key lengths. The implementation of AES in products intended to protect national security systems and/or information must be reviewed and certified by NSA prior to their acquisition and use. [1]
Motivation
- Avoiding the following behavior https://stackoverflow.com/questions/4747404/delete-keychain-items-when-an-app-is-uninstalled. (Yes, there is still a key, but there is no data)
- Avoiding additional thinking about there is a good place to store a particular value. (choice between Keychain and
UserDefaults
) - Improving a situation with security on the iOS platform. Many apps I've seen didn't use
Keychain
. They store all sensitive data inUserDefaults
(access tokens, passwords, etc)... At least, this can help to make such apps a bit more secured without pain. Perhaps, if this framework is almost the same asUserDefaults
, maybe developers will start using it? - It doesn't look good to keep many simple keys in
Keychain
.
Requirements
- iOS 8.0+
- macOS 10.11+
- Xcode 10.1+
- Swift 4.2+
Usage
It is pretty simple to use SecureDefaults
instead of UserDefaults/NSUserDefaults
. In most cases, it is the same thing that is UserDefaults
. You just need to set a password to make it work.
Replace the following code:
UserDefaults.standard
by this one:
let defaults = SecureDefaults.shared
// Ensures that a password was not set before. Otherwise, if
// you set a password one more time, it will re-generate a key.
// That means that we lose old data as well.
if !defaults.isKeyCreated {
defaults.password = NSUUID().uuidString // Or any password you wish
}
To use the app and keychain groups:
let defaults = SecureDefaults(suitName: "app.group") // Set a shared app group
defaults.keychainAccessGroup = "keychain.group" // Set a shrared keychain group
if !defaults.isKeyCreated {
defaults.password = NSUUID().uuidString // Or any password you wish
}
SecureDefaults
is not able to catch that any particular data is encrypted, to obtain a raw value, use the following method:
public func rawObject(forKey defaultName: String) -> Any?
Installation
CocoaPods
SecureDefaults
is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'SecureDefaults', '1.0.7' # Swift 5.0
pod 'SecureDefaults', '1.0.0' # Swift 4.2
Carthage
Add this to Cartfile
github "vpeschenkov/SecureDefaults" == 1.0.7 # Swift 5.0
github "vpeschenkov/SecureDefaults" == 1.0.0 # Swift 4.2
$ carthage update
Swift Package Manager
Create a Package.swift
file.
// swift-tools-version:4.2
import PackageDescription
let package = Package(
name: "YourProject",
dependencies: [
.package(url: "https://github.com/vpeschenkov/SecureDefaults", "1.0.7")
],
targets: [
.target(name: "YourProject", dependencies: ["SecureDefaults"])
]
)
$ swift build
Contributing
- If you need help or you'd like to ask a general question, open an issue.
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
Acknowledgments
A big thanks to the following individuals:
- Rob Napier - for this awesome article "Properly Encrypting With AES With CommonCrypto"
- Håvard Fossli - for this awesome Gist "AES 256 in swift 4 with CommonCrypto"
Author
Victor Peschenkov, [email protected]
License
SecureDefaults
is available under the MIT license. See the [LICENSE](LICENSE) file for more info.
*Note that all licence references and agreements mentioned in the SecureDefaults README section above
are relevant to that project's source code only.