Grouper 2.2

Grouper 2.2

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Jan 2018
SwiftSwift Version 3.1

Maintained by [Meng Li].



 
Depends on:
Sync~> 4
AFNetworking~> 3
 

A framework for developing app using secret sharing and multiple untrusted servers.

Introduction

Conventional client-server mode applications require central servers for storing shared data. The users of such mobile applications must fully trust the central server and their application providers. If a central server is compromised by hackers, user information may be revealed because data is often stored on the server in cleartext. Users may lose their data when service providers shut down their services.

Grouper uses secret sharing and multiple untrusted servers to solve this problem. In Grouper, a device use Secret Sharing scheme to divide a message into several shares and upload them to multiple untrusted servers. Other devices download shares and recover shares to original message by Secret Sharing scheme. Thus, user data can be protected.

Demo

We have developed an demo app called AccountBook using Grouper framework.

Installation

Grouper is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'Grouper', '~> 2.1'

Documentation

Grouper uses its own Web service. The Web service by Java EE is here Grouper-Server.

Grouper is developed with Objective-C. Import header file into your project.

#import <Grouper/Grouper.h>

Prepare

Grouper object inclueds 3 subobject, they are group(GroupManager), sender(SenderManager), receiver(ReceiverManager).

Grouper relys on Sync framework to syncrhonize data between devices. Thus, when you setup Core Data stack in AppDelegate, you should use DataStack provided in Sync framework.

_dataStack = [[DataStack alloc] initWithModelName:@"Model"];

Next, setup Grouper witg your appId, entities, data stack and main storyboard.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    grouper = [Grouper sharedInstance];
    [grouper setupWithAppId:@"test-app"
                   entities:[NSArray arrayWithObjects:@"Test", nil]
                  dataStack:[self dataStack]
             mainStoryboard:storyboard];
}

The attribue entities is an array which constains the names of all entities saved in Core Data.
If an entity A which is referenced by an entity B, you need to ensure that A should be in the front of B in the entities array.

Entity Design

All your Core Data entity should be subentity of SyncEntity, and all your NSManagedObjects should be subclass of SyncEntity. SyncEntity class has been provied in Grouper framework. Create SyncEntity in your Model.xcdatamodeld file and set parent entity as SyncEntity for your entity.

Attribute Type Explanation
createAt Date Create date of this entity
creator String Creator of this entity
remoteID String Remote ID for Sync framework
updator String Updater of this entity
updateAt String Update date of this entity

Group Management

Grouper provides group initialzation related function in Init.storyboard and member management in Members.storyboard. Use these 2 storyboards directly by grouper.ui.groupInit and grouper.ui.members.

Data Synchronization

Grouper use SenderManager to send data and ReceiverManager to receive data.

Use these methods to send data by grouper.sender.

// Send an update message for a sync entity.
- (void)update:(NSManagedObject *)entity;

// Delete a sync entity and send a delete message.
- (void)delete:(NSManagedObject *)entity;

// Send update messages for multiple sync entities.
- (void)updateAll:(NSArray *)entities;

// Delete multiple sync entities and send delete messages.
- (void)deleteAll:(NSArray *)entities;

// Send confirm message;
- (void)confirm;

// Send resend message which contains not existed sequences to receiver.
- (void)resend:(NSArray *)sequences to:(NSString *)receiver;

Use this method to receiver data by grouper.receiver.

// Receive message and do something in completion block.
- (void)receiveWithCompletion:(Completion)completion;

More information can be found in Demo app AccountBook.

Author

Meng Li, http://fczm.pw, [email protected]

License

Grouper is available under the MIT license. See the LICENSE file for more info.