Skip to content

Commit

Permalink
Update documentation to reflect Signal change
Browse files Browse the repository at this point in the history
// FREEBIE
  • Loading branch information
moxie0 committed Mar 23, 2016
1 parent d148ea8 commit a375b66
Show file tree
Hide file tree
Showing 9 changed files with 800 additions and 799 deletions.
77 changes: 38 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
# libtextsecure-java
# signal-service-java

A Java library for communicating via TextSecure.
A Java library for communicating via Signal.

## Implementing the Axolotl interfaces
## Implementing the Signal Protocol interfaces

The axolotl encryption protocol is a stateful protocol, so libtextsecure users
need to implement the storage interface `AxolotlStore`, which handles load/store
The Signal encryption protocol is a stateful protocol, so libsignal-service users
need to implement the storage interface `SignalProtocolStore`, which handles load/store
of your key and session information to durable media.

## Creating keys

`````
IdentityKeyPair identityKey = KeyHelper.generateIdentityKeyPair();
List<PreKeyRecord> oneTimePreKeys = KeyHelper.generatePreKeys(100);
PreKeyRecord lastResortKey = KeyHelper.generateLastResortKey();
SignedPreKeyRecord signedPreKeyRecord = KeyHelper.generateSignedPreKey(identityKey, signedPreKeyId);
`````

The above are then stored locally so that they're available for load via the `AxolotlStore`.
The above are then stored locally so that they're available for load via the `SignalProtocolStore`.

## Registering

At install time, clients need to register with the TextSecure server.
At install time, clients need to register with the Signal server.

`````
private final String URL = "https://my.textsecure.server.com";
private final String URL = "https://my.signal.server.com";
private final TrustStore TRUST_STORE = new MyTrustStoreImpl();
private final String USERNAME = "+14151231234";
private final String PASSWORD = generateRandomPassword();
TextSecureAccountManager accountManager = new TextSecureAccountManager(URL, TRUST_STORE,
USERNAME, PASSWORD);
SignalServiceAccountManager accountManager = new SignalServiceAccountManager(URL, TRUST_STORE,
USERNAME, PASSWORD);
accountManager.requestSmsVerificationCode();
accountManager.verifyAccount(receivedSmsVerificationCode, generateRandomSignalingKey(),
Expand All @@ -42,52 +41,52 @@ accountManager.setPreKeys(identityKey.getPublic(), lastResortKey, signedPreKey,
## Sending text messages

`````
TextSecureMessageSender messageSender = new TextSecureMessageSender(URL, TRUST_STORE, USERNAME, PASSWORD,
localRecipientId, new MyAxolotlStore(),
Optional.absent());
messageSender.sendMessage(new TextSecureAddress("+14159998888"),
TextSecureMessage.newBuilder()
.withBody("Hello, world!")
.build());
SignalServiceMessageSender messageSender = new SignalServiceMessageSender(URL, TRUST_STORE, USERNAME, PASSWORD,
localRecipientId, new MySignalProtocolStore(),
Optional.absent());
messageSender.sendMessage(new SignalProtocolAddress("+14159998888"),
SignalProtocolMessage.newBuilder()
.withBody("Hello, world!")
.build());
`````

## Sending media messages

`````
TextSecureMessageSender messageSender = new TextSecureMessageSender(URL, TRUST_STORE, USERNAME, PASSWORD,
localRecipientId, new MyAxolotlStore(),
Optional.absent());
SignalServiceMessageSender messageSender = new SignalServiceMessageSender(URL, TRUST_STORE, USERNAME, PASSWORD,
localRecipientId, new MySignalProtocolStore(),
Optional.absent());
File myAttachment = new File("/path/to/my.attachment");
FileInputStream attachmentStream = new FileInputStream(myAttachment);
TextSecureAttachment attachment = TextSecureAttachment.newStreamBuilder()
.withStream(attachmentStream)
.withContentType("image/png")
.withLength(myAttachment.size())
.build();
messageSender.sendMessage(new TextSecureAddress("+14159998888"),
TextSecureMessage.newBuilder()
.withBody("An attachment!")
.withAttachment(attachment)
.build());
TextSecureAttachment attachment = SignalServiceAttachment.newStreamBuilder()
.withStream(attachmentStream)
.withContentType("image/png")
.withLength(myAttachment.size())
.build();
messageSender.sendMessage(new SignalProtocolAddress("+14159998888"),
SignalProtocolMessage.newBuilder()
.withBody("An attachment!")
.withAttachment(attachment)
.build());
`````

## Receiving messages

`````
TextSecureMessageReceiver messageReceiver = new TextSecureMessageReceiver(URL, TRUST_STORE, USERNAME, PASSWORD, mySignalingKey);
TextSecureMessagePipe messagePipe;
SignalServiceMessageReceiver messageReceiver = new SignalServiceMessageReceiver(URL, TRUST_STORE, USERNAME, PASSWORD, mySignalingKey);
SignalServiceMessagePipe messagePipe;
try {
messagePipe = messageReciever.createMessagePipe();
while (listeningForMessages) {
TextSecureEnvelope envelope = messagePipe.read(timeout, timeoutTimeUnit);
TextSecureCipher cipher = new TextSecureCipher(new MyAxolotlStore());
TextSecureMessage message = cipher.decrypt(envelope);
SignalServiceEnvelope envelope = messagePipe.read(timeout, timeoutTimeUnit);
SignalServiceCipher cipher = new SignalServiceCipher(new MySignalProtocolStore());
SignalServiceMessage message = cipher.decrypt(envelope);
System.out.println("Received message: " + message.getBody().get());
}
Expand All @@ -111,7 +110,7 @@ The form and manner of this distribution makes it eligible for export under the

## License

Copyright 2013-2015 Open Whisper Systems
Copyright 2013-2016 Open Whisper Systems

Licensed under the AGPLv3: https://www.gnu.org/licenses/agpl-3.0.html

14 changes: 7 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'signing'

archivesBaseName = "textsecure-android"
archivesBaseName = "signal-service-android"
version = version_number
group = group_info

Expand Down Expand Up @@ -76,15 +76,15 @@ uploadArchives {
}

pom.project {
name 'textsecure-android'
name 'signal-service-android'
packaging 'aar'
description 'TextSecure library for Android'
url 'https://github.com/WhisperSystems/libtextsecure-java'
description 'Signal Service communication library for Android'
url 'https://github.com/WhisperSystems/libsignal-service-java'

scm {
url 'scm:[email protected]:WhisperSystems/libtextsecure-java.git'
connection 'scm:[email protected]:WhisperSystems/libtextsecure-java.git'
developerConnection 'scm:[email protected]:WhisperSystems/libtextsecure-java.git'
url 'scm:[email protected]:WhisperSystems/libsignal-service-java.git'
connection 'scm:[email protected]:WhisperSystems/libsignal-service-java.git'
developerConnection 'scm:[email protected]:WhisperSystems/libsignal-service-java.git'
}

licenses {
Expand Down
14 changes: 7 additions & 7 deletions java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'maven'
apply plugin: 'signing'

sourceCompatibility = 1.7
archivesBaseName = "textsecure-java"
archivesBaseName = "signal-service-java"
version = version_number
group = group_info

Expand Down Expand Up @@ -50,15 +50,15 @@ uploadArchives {
}

pom.project {
name 'textscure-java'
name 'signal-service-java'
packaging 'jar'
description 'TetSecure library for Java'
url 'https://github.com/WhisperSystems/libtextsecure-java'
description 'Signal Service communication library for Java'
url 'https://github.com/WhisperSystems/libsignal-service-java'

scm {
url 'scm:[email protected]:WhisperSystems/libtextsecure-java.git'
connection 'scm:[email protected]:WhisperSystems/libtextsecure-java.git'
developerConnection 'scm:[email protected]:WhisperSystems/libtextsecure-java.git'
url 'scm:[email protected]:WhisperSystems/libsignal-service-java.git'
connection 'scm:[email protected]:WhisperSystems/libsignal-service-java.git'
developerConnection 'scm:[email protected]:WhisperSystems/libsignal-service-java.git'
}

licenses {
Expand Down
Loading

0 comments on commit a375b66

Please sign in to comment.