<commit_before>NitroKeychain
=============
[![Version](http://cocoapod-badges.herokuapp.com/v/NitroKeychain/badge.png)](http://cocoadocs.org/docsets/NitroKeychain)
[![Platform](http://cocoapod-badges.herokuapp.com/p/NitroKeychain/badge.png)](http://cocoadocs.org/docsets/NitroKeychain)
<!-- [![TravisCI](https://travis-ci.org/danielalves/NitroKeychain.svg?branch=master)](https://travis-ci.org/danielalves/NitroKeychain) -->

**NitroKeychain** is a thin, yet powerful, abstraction layer on top of iOS keychain that provides commonly needed features. **NitroKeychain** is also thread safe.

There are 3 operations: `save`, `load` and `delete`, as you can see below:

Saving
------

```objc
[TNTKeychain save: @"com.myapp.service.id" 
             data: @"my-ultra-secret-token"];
             
// Or, if you want to make this item available across apps, specify 
// an access group:
[TNTKeychain save: @"com.myapp.service.id" 
             data: @"my-ultra-secret-token"
      accessGroup: @"super-company"];

```

- All keychain items are stored using the kSecClassGenericPassword Keychain Item class.
- `data` can be any value compatible with `NSKeyedArchiver`/`NSKeyedUnarchiver`.
- If there is already some data associated with a keychain item ID, it will be updated.

Loading
-------

```objc
NSString *token = [TNTKeychain load: @"com.myapp.service.id"];
NSLog( @"%@", token );
```

- `load` will return `nil` if no keychain item is found with such id.

Deleting
--------

```objc
[TNTKeychain delete: @"com.myapp.service.id"];
```

- `delete` does nothing if no keychain item is found with such id.

Simple as that :+1:

Requirements
------------

iOS 6.0 or higher, ARC only

Installation
------------

**NitroKeychain** is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile:

```ruby
pod 'NitroKeychain'
```

Authors
-------

- [<NAME>](http://github.com/danielalves) ([@alveslopesdan](https://twitter.com/alveslopesdan))
- [<NAME>](http://github.com/barbosa) ([@gustavocsb](https://twitter.com/gustavocsb))

License<commit_msg>add examples written in swift<commit_after>NitroKeychain
=============
[![Version](http://cocoapod-badges.herokuapp.com/v/NitroKeychain/badge.png)](http://cocoadocs.org/docsets/NitroKeychain)
[![Platform](http://cocoapod-badges.herokuapp.com/p/NitroKeychain/badge.png)](http://cocoadocs.org/docsets/NitroKeychain)
<!-- [![TravisCI](https://travis-ci.org/danielalves/NitroKeychain.svg?branch=master)](https://travis-ci.org/danielalves/NitroKeychain) -->

**NitroKeychain** is a thin, yet powerful, abstraction layer on top of iOS keychain that provides commonly needed features. **NitroKeychain** is also thread safe.

There are 3 operations: `save`, `load` and `delete`, as you can see below:

Saving
------

#### Objective-C

```objc
[TNTKeychain save: @"com.myapp.service.id" 
             data: @"my-ultra-secret-token"];
             
// Or, if you want to make this item available across apps, specify 
// an access group:
[TNTKeychain save: @"com.myapp.service.id" 
             data: @"my-ultra-secret-token"
      accessGroup: @"super-company"];

```

#### Swift

```swift
TNTKeychain.save("com.myapp.service.id", data: "my-ultra-secret-token")
             
// Or, if you want to make this item available across apps, specify 
// an access group:
TNTKeychain.save("com.myapp.service.id", 
                  data: "my-ultra-secret-token", 
                  accessGroup: "super-company")
```

- All keychain items are stored using the kSecClassGenericPassword Keychain Item class.
- `data` can be any value compatible with `NSKeyedArchiver`/`NSKeyedUnarchiver`.
- If there is already some data associated with a keychain item ID, it will be updated.

Loading
-------

#### Objective-C

```objc
NSString *token = [TNTKeychain load: @"com.myapp.service.id"];
NSLog( @"%@", token );
```

- `load` will return `nil` if no keychain item is found with such id.

#### Swift

```swift
let token = TNTKeychain.load("com.myapp.service.id")
print(token)
```

Deleting
--------

#### Objective-C

```objc
[TNTKeychain delete: @"com.myapp.service.id"];
```

- `delete` does nothing if no keychain item is found with such id.

#### Swift

```swift
TNTKeychain.delete("com.myapp.service.id")
```

Simple as that :+1:

Requirements
------------

iOS 6.0 or higher, ARC only

Installation
------------

**NitroKeychain** is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile:

```ruby
pod 'NitroKeychain'
```

Authors
-------

- [<NAME>](http://github.com/danielalves) ([@alveslopesdan](https://twitter.com/alveslopesdan))
- [<NAME>](http://github.com/barbosa) ([@gustavocsb](https://twitter.com/gustavocsb))

License
{'fraction_non_alphanumeric': 0.17651991614255766, 'fraction_numerical': 0.0016771488469601676, 'mean_word_length': 3.742544731610338, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3761188', 'n_tokens_mistral': 1697, 'n_tokens_neox': 1585, 'n_words': 400}