beatlabs / BeatChain

BeatChain is a manager for saving and retrieving string values into keychain written in swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BeatChain

BeatChain is a manager for saving and retrieving string values into keychain written in swift.

Build Status Cocoapods Compatible Carthage compatible Swift 4.0.x platforms

Contents

Requirements

  • iOS 10.0+
  • Swift 4.0+
  • Xcode 10.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

to integrate BeatChain into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'BeatChain', '~> 1.0.0'
end

then, run the following command, this will fetch and install the BeatChain pod:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew install carthage

to integrate BeatChain into your Xcode project using Carthage, specify it in your Cartfile:

github "beatlabs/BeatChain" "master"

Run carthage update to build the framework and drag the built BeatChain.framework into your Xcode project.

Swift Package Manager

You can use The Swift Package Manager to install BeatChain by adding the proper description to your Package.swift file:

// swift-tools-version:4.0
import PackageDescription

let package = Package(
    name: "YOUR_PROJECT_NAME",
    dependencies: [
        .package(url: "https://github.com/beatlabs/BeatChain.git", from: "1.0.0"),
    ]
)

then, run the following command:

$ swift build

Manually

If you prefer you can build the framework manually and drag generated framework BeatChain.framework into your Xcode project.

Usage

Quick Start

import BeatChain
let keychainManager = KeychainManager()

// save password into keychain
do {
    let item = GenericPasswordItem(account: "username", accessGroup: "accessGroup")
    try keychainManager.saveValue(password, to: item)
} catch {
    assertionFailure("Save password failed")
}

// read password from keychain
do {
    let item = GenericPasswordItem(account: "account", accessGroup: "accessGroup")
    return try keychainManager.readValue(item)
} catch KeychainManagerError.noItemFound {
    assertionFailure("Item not found")
} catch {
    assertionFailure("Get password failed")
}

// delete password item from keychain
do {
    let item = GenericPasswordItem(account: nil, accessGroup: "accessGroup")
    try keychainManager.deleteItem(item)
} catch {
    assertionFailure("Delete password failed")
}

Documentation

Install Jazzy

$ gem install jazzy

then you can generate documentation by using the following command:

$ jazzy --min-acl internal

License

BeatChain is released under the Apache License Version 2.0. See LICENSE for details.

Authors

The iOS BEAT team

https://github.com/beatlabs/BeatChain

Credits

About

BeatChain is a manager for saving and retrieving string values into keychain written in swift.

License:Apache License 2.0


Languages

Language:Swift 89.8%Language:Ruby 4.6%Language:Makefile 3.2%Language:Objective-C 2.3%