Git Product home page Git Product logo

ngbaccountstore's Introduction

NGBAccountStore

NGBAccountStore is a simple drop-in class for storing complete account objects encrypted in the system keychain. iCloud sync is supported, too.

Requirements

NGBAccountStore works only on iOS7 as it uses the built in base64 decoder. But I'm happy to accept pull requests adding backwards compability.

Adding NGBAccountStore to your project

Cocoapods

CocoaPods is the recommended way to add NGBAccountStore to your project.

  1. Add a pod entry for MBProgressHUD to your Podfile pod 'NGBAccountStore', '~> 0.1.0'
  2. Install the pod(s) by running pod install.

Source files

Alternatively you can directly add the source files to your project.

  1. Download the latest code version or add the repository as a git submodule to your git-tracked project.
  2. Open your project in Xcode, then drag and drop all classes in the AccountStore folder onto your project (use the "Product Navigator view"). Make sure to select Copy items when asked if you extracted the code archive outside of your project.

Usage

Just instantiate an instance of NGBAccountStore or use the provided Singleton, then add your accounts. You can use the provided convenience class NGBAccount or roll your own account class by implementing the NGBManagedAccount protocol on your account.

Password saving is decoupled from the account object as the password should not stay in memory for security reasons.

Get all accounts in the keychain:

NSArray* accounts = [NGBAccountStore defaultStore].accounts;

Create a new account

NGBAccount* account = [[NGBAccount alloc] init];
account.identifier = @"thisismyid";
account.username = "John Doe";
[[NGBAccountStore defaultStore] addAccount: account];
[[NGBAccountStore defaultStore] setPassword:@"secret!"" forAccount:account];

Read the password from an account:

NGBAccount* account = [NGBAccountStore defaultStore].accounts.firstObject;
NSString* password = [[NGBAccountStore defaultStore] passwordForAccount:account];

// or use the convenience method:

password = account.password;

License

This code is distributed under the terms and conditions of the MIT license.

Contributing

Have a new idea or found a bug? Please support this project by contributing pull requests.

First open an issue and state that you're working on something so there is no doubled work. Then submit your pull request.

Coding guidelines

  • All public methods need to be documented with appledoc syntax.
  • If you provide additional functionality, add a unit test.
  • If you fix a bug, please add a unit test so the bug will not happen again.

ngbaccountstore's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sbatururimi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.