GithubHelp home page GithubHelp logo

samgreen / otrkit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chatsecure/otrkit

0.0 2.0 0.0 8.66 MB

An Objective-C Off-the-Record library for iOS.

Home Page: http://chatsecure.org

License: Other

otrkit's Introduction

OTRKit

OTRKit is an Objective-C wrapper for the OTRv3 encrypted messaging protocol, using libotr. This library was designed for use with the encrypted iOS messaging app ChatSecure, but should theoretically work for Mac OS X as well with some minor tweaking to the build scripts.

Installation

Install this project as a submodule in your repository (make sure to fork it first if you plan to make changes):

git submodule add https://github.com/ChatSecure/OTRKit.git Submodules/OTRKit

To compile libotr and dependencies for iOS, run the included scripts in this order (or use build-all.sh):

  1. build-libgpg-error.sh
  2. build-libgcrypt.sh
  3. build-libotr.sh

Then do these things:

  1. Drag OTRKit.xcodeproj to the left-hand file pane in Xcode to add it to your project.
  2. Make sure to add OTRKit (OTRKit) to your project's Targent Dependencies in the Build Phases tab of your target settings.
  3. Add libOTRKit.a to the Link Binary With Libraries step within the same window.

Usage

Check out OTRKit.h because it is the most up-to-date reference at the moment.

Implement the required delegate methods somewhere that makes sense for your project.

@protocol OTRKitDelegate <NSObject>
@required
// Implement this delegate method to forward the injected message to the appropriate protocol
- (void) injectMessage:(NSString*)message recipient:(NSString*)recipient accountName:(NSString*)accountName protocol:(NSString*)protocol;
- (void) updateMessageStateForUsername:(NSString*)username accountName:(NSString*)accountName protocol:(NSString*)protocol messageState:(OTRKitMessageState)messageState; 

To encode a message:

NSString *message = @"Something in plain text.";
NSString *recipientAccount = @"[email protected]";
NSString *sendingAccount = @"[email protected]";
NSString *protocol = @"xmpp"; // OTR can work over any protocol
[[OTRKit sharedInstance] encodeMessage:message recipient:recipientAccount accountName:sendingAccount protocol:protocol success:^(NSString *encryptedMessage) {
		// you might want to pass this along to diffie
        NSLog(@"Encrypted ciphertext: %@", encryptedMessage);
    }];

To decode a message:

[[OTRKit sharedInstance] decodeMessage:message recipient:friendAccount accountName:myAccountName protocol:protocol]

TODO

  • Refactor to clean up the code a bit
  • Documentation!
  • Add Mac OS X support
  • Change project to use git submodules for the dependencies.
  • Figure out how to make libgcrypt, libgpg-error, and libotr build within Xcode to assist in debugging.
  • Preserve the debugging symbols to allow for better crash reports when used in conjuction with dSYM files.

Contributing

Please fork the project and submit a pull request and (preferrably) squash your commits. Thank you! If you're interested in privacy and security, check out chatsecure.org and The Guardian Project.

License

The code for this project is provided under the Modified BSD license. The required dependencies are under terms of a seperate license (LGPL). More information is available in the LICENSE file.

otrkit's People

Contributors

chrisballinger avatar davidchiles avatar

Watchers

Sam Green avatar James Cloos avatar

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.