Skip to content

Commit

Permalink
big bang
Browse files Browse the repository at this point in the history
  • Loading branch information
rhodey committed Jul 19, 2014
0 parents commit 4446288
Show file tree
Hide file tree
Showing 601 changed files with 34,654 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
*~
.classpath
project.properties
.project
.settings
bin/
gen/
.idea/
*.iml
out
tests
lint.xml
local.properties
ant.properties
.DS_Store
build.log
build-log.xml
.gradle
build
signing.properties
53 changes: 53 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Building Flock
=====================

Basics
------

Flock uses [Gradle](http://gradle.org) to build the project and to maintain
dependencies.

Building Flock
-------------------

The following steps should help you (re)build flock from the command line.

1. Checkout the source somewhere on your filesystem with

git clone https://github.com/WhisperSystems/Flock.git

2. Make sure you have the [Android SDK](https://developer.android.com/sdk/index.html) installed somewhere on your system.
3. Ensure the "Android Support Repository" and "Android SDK Build-tools" are installed from the Android SDK manager.
4. Create a local.properties file at the root of your source checkout and add an sdk.dir entry to it.

sdk.dir=\<path to your sdk installation\>

5. Execute Gradle:

./gradlew build

Setting up a development environment
------------------------------------

[Android Studio](https://developer.android.com/sdk/installing/studio.html) is the recommended development environment.

1. Install Android Studio
2. Make sure the "Android Support Repository" is installed in the Android Studio SDK.
3. Make sure the latest "Android SDK build-tools" is installed in the Android Studio SDK.
4. Create a new Android Studio project. from the Quickstart pannel (use File > Close Project to see it), choose "Checkout from Version Control" then "git".
5. Paste the URL for the Flock project when prompted (https://github.com/rhodey/securesync.git)
6. Android studio should detect the presence of a project file and ask you wethere to open it. Click "yes".
7. Default config options should be good enough.
8. Project initialisation and build should proceed.

Contributing code
-----------------

Code contributions should be sent via github as pull requests, from feature branches [as explained here](https://help.github.com/articles/using-pull-requests).

Mailing list
------------

Development discussion happens on the whispersystems mailing list.
[To join](https://lists.riseup.net/www/info/whispersystems)
Send emails to [email protected]
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Flock
=================

A secure contact and calendar syncing application for Android.

Flock is a replacement for the default contact and calendar synchronization services provided by Google. Flock provides end-to-end encryption
between multiple Android devices, putting the privacy of your contacts and calendars back under your control. To facilitate syncing between
multiple devices a "Sync Service" is required, this can be any standards compliant WebDAV server that conforms to the following RFCs:

1. RFC 2518 - HTTP Extensions for Distributed Authoring -- WEBDAV
2. RFC 4918 - HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)
3. RFC 6352 - CardDAV: vCard Extensions to Web Distributed Authoring and Versioning (WebDAV)
4. RFC 4791 - Calendaring Extensions to WebDAV (CalDAV)
5. RFC 1337 - TODO: A few more small specs to include...

Building and contributing code
==============================
Instructions on how to build Flock, as well as on how to setup an IDE to modify it can be found in the "BUILDING.md" file.

Bug tracker
-----------

Have a bug? Please create an issue here on GitHub!

https://github.com/rhodey/securesync/issues

Mailing list
------------

Have a question? Ask on our mailing list!

[email protected]

https://lists.riseup.net/www/info/whispersystems

Cryptography Notice
------------

This distribution includes cryptographic software. The country in which you currently reside may have restrictions on the import, possession, use, and/or re-export to another country, of encryption software.
BEFORE using any encryption software, please check your country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted.
See <http://www.wassenaar.org/> for more information.

The U.S. Government Department of Commerce, Bureau of Industry and Security (BIS), has classified this software as Export Commodity Control Number (ECCN) 5D002.C.1, which includes information security software using or performing cryptographic functions with asymmetric algorithms.
The form and manner of this distribution makes it eligible for export under the License Exception ENC Technology Software Unrestricted (TSU) exception (see the BIS Export Administration Regulations, Section 740.13) for both object code and source code.

License
---------------------

Copyright 2014 Open WhisperSystems

Licensed under the GPLv3: http://www.gnu.org/licenses/gpl-3.0.html
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
1 change: 1 addition & 0 deletions flock/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
90 changes: 90 additions & 0 deletions flock/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
classpath files('libs/gradle-witness.jar')
}
}

apply plugin: 'com.android.application'
apply plugin: 'witness'

repositories {
mavenCentral()

maven {
url "https://raw.github.com/whispersystems/maven/master/stripe-btc/releases"
}
maven {
url "https://raw.github.com/whispersystems/maven/master/gson/releases/"
}
}

android {
compileSdkVersion 19
buildToolsVersion '19.1.0'

defaultConfig {
minSdkVersion 16
targetSdkVersion 19
}

packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'LICENSE.txt'
}

lintOptions {
abortOnError false;
}
}

dependencies {
compile group: 'com.google.guava', name: 'guava', version: '16.0'
compile group: 'com.android.support', name: 'support-v4', version: '19.0.1'
compile group: 'org.apache.jackrabbit', name: 'jackrabbit-webdav', version: '2.3.7'
compile group: 'commons-httpclient', name: 'commons-httpclient', version: '3.1'
compile group: 'javax.servlet', name: 'servlet-api', version: '2.5'
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.5'
compile group: 'com.googlecode.ez-vcard', name: 'ez-vcard', version: '0.9.0'
compile group: 'org.mnode.ical4j', name: 'ical4j', version: '1.0.5.2'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.3.0'
compile group: 'com.google.code.gson', name: 'gson', version: '2.2.4'
compile group: 'com.stripe', name: 'stripe-java-btc', version: '1.12.0-btc-beta'
compile group: 'com.google.zxing', name: 'core', version: '3.1.0'
}

dependencyVerification {
verify = [
'com.google.guava:guava:fa917f4f3f6a76375134ba89a40d3a1ce807945a91bbdbe39c31f76e03030868',
'com.android.support:support-v4:a4268abd6370c3fd3f94d2a7f9e6e755f5ddd62450cf8bbc62ba789e1274d585',
'org.apache.jackrabbit:jackrabbit-webdav:9a11e030921bc21de7d6dcf168571a3d2671f72c351498a0daefaf79e0edc888',
'commons-httpclient:commons-httpclient:dbd4953d013e10e7c1cc3701a3e6ccd8c950c892f08d804fabfac21705930443',
'javax.servlet:servlet-api:c658ea360a70faeeadb66fb3c90a702e4142a0ab7768f9ae9828678e0d9ad4dc',
'org.slf4j:slf4j-simple:6d06eedca4768119b2c6ac5adf97e7b5ad57a03d6578d69e734fa083c957dc06',
'com.googlecode.ez-vcard:ez-vcard:2e09cc227f8f269be5fbdc17b999b9514e239281754a0b4d4c221e29ba2d0876',
'org.mnode.ical4j:ical4j:dedb09e8975f0703b3ae5ad60205fedda7512f91d837070be99732001a08b138',
'com.fasterxml.jackson.core:jackson-databind:9b789c2de23ff5a1ae1fc8193ea79e34f16d74c64c51491fbe76ca277349e694',
'com.google.code.gson:gson:c0328cd07ca9e363a5acd00c1cf4afe8cf554bd6d373834981ba05cebec687fb',
'com.stripe:stripe-java-btc:daaabd181eb6bc4868d739e023226d344a56bf6020a7ad057dc0c26fc7d223da',
'com.google.zxing:core:f00b32f7a1b0edc914a8f74301e8dc34f189afc4698e9c8cc54e5d46772734a5',
'org.slf4j:jcl-over-slf4j:261e66d2b5d95ce1bc9923ab5e614f58b2568787b2b55f74dbb861b60ff798e0',
'org.jsoup:jsoup:37e3b44fb9476a677a956fb684090b9b4a1e4d38bcfc30b499dbc83f109422c0',
'org.freemarker:freemarker:c26923394f3f1cf0427f515ee3bb6be66d1a7f4261e6d6f0504fdec63ab85da8',
'commons-logging:commons-logging:70903f6fc82e9908c8da9f20443f61d90f0870a312642991fe8462a0b9391784',
'commons-codec:commons-codec:599b40b94b4a39c2550a4b5106df071aa03199b71ad5423207e2e7356aa4f8bb',
'commons-lang:commons-lang:50f11b09f877c294d56f24463f47d28f929cf5044f648661c0f0cfbae9a2f49c',
'backport-util-concurrent:backport-util-concurrent:f5759b7fcdfc83a525a036deedcbd32e5b536b625ebc282426f16ca137eb5902',
'com.fasterxml.jackson.core:jackson-annotations:0c8c3811322cc84c09a93f34436fe784a1259dd5376a90aec5a73493456f757d',
'org.slf4j:slf4j-api:fe30825245d2336c859dc38d60c0fc5f3668dbf29cd586828d2b5667ec355b91',
'com.fasterxml.jackson.core:jackson-core:61f84f93e3f901134d7498b50119ee01074f10d59560e45ccd3e1d48cfec493b',
]
}

Binary file added flock/libs/gradle-witness.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.anhonesteffort.flock.test.sync;

import org.anhonesteffort.flock.crypto.MasterCipher;
import org.anhonesteffort.flock.util.Base64;

import java.io.IOException;

/**
* Programmer: rhodey
* Date: 3/21/14
*/

// This class is meant to assist in the testing of Hiding*Store and Hiding*Collection.
public class MockMasterCipher extends MasterCipher {

public MockMasterCipher() {
super(null, null);
}

@Override
public byte[] encryptAndEncode(byte[] data) {
return Base64.encodeBytes(data).getBytes();
}

@Override
public String encryptAndEncode(String data) {
return Base64.encodeBytes(data.getBytes());
}

@Override
public byte[] decodeAndDecrypt(byte[] encodedIvCiphertextAndMac) {
return Base64.decode(encodedIvCiphertextAndMac);
}

public String decodeAndDecrypt(String data) throws IOException {
return new String(Base64.decode(data));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package org.anhonesteffort.flock.test.sync.addressbook;

import android.test.AndroidTestCase;

import com.google.common.base.Optional;
import ezvcard.VCard;
import ezvcard.VCardVersion;
import ezvcard.property.StructuredName;
import ezvcard.property.Uid;
import org.anhonesteffort.flock.test.sync.MockMasterCipher;
import org.anhonesteffort.flock.sync.addressbook.HidingCardDavCollection;
import org.anhonesteffort.flock.sync.addressbook.HidingCardDavStore;
import org.anhonesteffort.flock.webdav.ComponentETagPair;
import org.anhonesteffort.flock.test.webdav.DavTestParams;

import java.util.UUID;

/**
* Programmer: rhodey
* Date: 2/25/14
*/
public class HidingCardDavCollectionTest extends AndroidTestCase {

private HidingCardDavCollection hidingCardDavCollection;

@Override
protected void setUp() throws Exception {
HidingCardDavStore hidingCardDavStore = new HidingCardDavStore(new MockMasterCipher(),
DavTestParams.WEBDAV_HOST,
DavTestParams.USERNAME,
DavTestParams.PASSWORD,
Optional.<String>absent(),
Optional.<String>absent());

Optional<String> addressbookHomeSet = hidingCardDavStore.getAddressbookHomeSet();
String COLLECTION_PATH = addressbookHomeSet.get().concat("addressbook/");

hidingCardDavCollection = hidingCardDavStore.getCollection(COLLECTION_PATH).get();
}

public void testEditProperties() throws Exception {
final Optional<String> ORIGINAL_DISPLAY_NAME = hidingCardDavCollection.getHiddenDisplayName();

final String NEW_DISPLAY_NAME = "Only 1337 people in here";

hidingCardDavCollection.setHiddenDisplayName(NEW_DISPLAY_NAME);

assertEquals("Addressbook display name must be maintained.",
NEW_DISPLAY_NAME,
hidingCardDavCollection.getHiddenDisplayName().get());

if (ORIGINAL_DISPLAY_NAME.isPresent())
hidingCardDavCollection.setDisplayName(ORIGINAL_DISPLAY_NAME.get());
}

public void testAddGetRemoveComponent() throws Exception {
final StructuredName structuredName = new StructuredName();
structuredName.setFamily("Strangelove");
structuredName.setGiven("idk");
structuredName.addPrefix("Dr");
structuredName.addSuffix("");

VCard putVCard = new VCard();
putVCard.setVersion(VCardVersion.V3_0);
putVCard.setUid(new Uid(UUID.randomUUID().toString()));
putVCard.setStructuredName(structuredName);
putVCard.setFormattedName("you need this too");

hidingCardDavCollection.addComponent(putVCard);

Optional<ComponentETagPair<VCard>> gotVCard = hidingCardDavCollection.getComponent(putVCard.getUid().getValue());
assertTrue("Added component must be found in collection.", gotVCard.isPresent());

assertEquals("vCard structured name must be maintained within the collection.",
gotVCard.get().getComponent().getStructuredName().getFamily(),
putVCard.getStructuredName().getFamily());

hidingCardDavCollection.removeComponent(putVCard.getUid().getValue());

assertTrue("Removed component must not be found in collection.",
!hidingCardDavCollection.getComponent(putVCard.getUid().getValue()).isPresent());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.anhonesteffort.flock.test.sync.addressbook;

import android.test.AndroidTestCase;

import com.google.common.base.Optional;
import org.anhonesteffort.flock.test.sync.MockMasterCipher;
import org.anhonesteffort.flock.sync.addressbook.HidingCardDavStore;
import org.anhonesteffort.flock.test.webdav.DavTestParams;
import org.anhonesteffort.flock.webdav.carddav.CardDavCollection;

import java.net.URLEncoder;

/**
* Programmer: rhodey
* Date: 2/25/14
*/
public class HidingCardDavStoreTest extends AndroidTestCase {

private HidingCardDavStore hidingCardDavStore;

@Override
protected void setUp() throws Exception {
hidingCardDavStore = new HidingCardDavStore(new MockMasterCipher(),
DavTestParams.WEBDAV_HOST,
DavTestParams.USERNAME,
DavTestParams.PASSWORD,
Optional.<String>absent(),
Optional.<String>absent());
}

public void testGetCollections() throws Exception {
final String DEFAULT_COLLECTION_OWNER = "/principals/__uids__/" + URLEncoder.encode(DavTestParams.USERNAME) + "/";

CardDavCollection collection = hidingCardDavStore.getCollections().get(0);

assertEquals("Default addressbook collection must be owned by " + DavTestParams.USERNAME,
collection.getOwnerHref().get(),
DEFAULT_COLLECTION_OWNER);
}

}
Loading

0 comments on commit 4446288

Please sign in to comment.