1- # libtextsecure -java
1+ # signal-service -java
22
3- A Java library for communicating via TextSecure .
3+ A Java library for communicating via Signal .
44
5- ## Implementing the Axolotl interfaces
5+ ## Implementing the Signal Protocol interfaces
66
7- The axolotl encryption protocol is a stateful protocol, so libtextsecure users
8- need to implement the storage interface ` AxolotlStore ` , which handles load/store
7+ The Signal encryption protocol is a stateful protocol, so libsignal-service users
8+ need to implement the storage interface ` SignalProtocolStore ` , which handles load/store
99of your key and session information to durable media.
1010
1111## Creating keys
1212
1313`````
1414IdentityKeyPair identityKey = KeyHelper.generateIdentityKeyPair();
1515List<PreKeyRecord> oneTimePreKeys = KeyHelper.generatePreKeys(100);
16- PreKeyRecord lastResortKey = KeyHelper.generateLastResortKey();
1716SignedPreKeyRecord signedPreKeyRecord = KeyHelper.generateSignedPreKey(identityKey, signedPreKeyId);
1817`````
1918
20- The above are then stored locally so that they're available for load via the ` AxolotlStore ` .
19+ The above are then stored locally so that they're available for load via the ` SignalProtocolStore ` .
2120
2221## Registering
2322
24- At install time, clients need to register with the TextSecure server.
23+ At install time, clients need to register with the Signal server.
2524
2625`````
27- private final String URL = "https://my.textsecure .server.com";
26+ private final String URL = "https://my.signal .server.com";
2827private final TrustStore TRUST_STORE = new MyTrustStoreImpl();
2928private final String USERNAME = "+14151231234";
3029private final String PASSWORD = generateRandomPassword();
3130
32- TextSecureAccountManager accountManager = new TextSecureAccountManager (URL, TRUST_STORE,
33- USERNAME, PASSWORD);
31+ SignalServiceAccountManager accountManager = new SignalServiceAccountManager (URL, TRUST_STORE,
32+ USERNAME, PASSWORD);
3433
3534accountManager.requestSmsVerificationCode();
3635accountManager.verifyAccount(receivedSmsVerificationCode, generateRandomSignalingKey(),
@@ -42,52 +41,52 @@ accountManager.setPreKeys(identityKey.getPublic(), lastResortKey, signedPreKey,
4241## Sending text messages
4342
4443`````
45- TextSecureMessageSender messageSender = new TextSecureMessageSender (URL, TRUST_STORE, USERNAME, PASSWORD,
46- localRecipientId, new MyAxolotlStore (),
47- Optional.absent());
48-
49- messageSender.sendMessage(new TextSecureAddress ("+14159998888"),
50- TextSecureMessage .newBuilder()
51- .withBody("Hello, world!")
52- .build());
44+ SignalServiceMessageSender messageSender = new SignalServiceMessageSender (URL, TRUST_STORE, USERNAME, PASSWORD,
45+ localRecipientId, new MySignalProtocolStore (),
46+ Optional.absent());
47+
48+ messageSender.sendMessage(new SignalProtocolAddress ("+14159998888"),
49+ SignalProtocolMessage .newBuilder()
50+ .withBody("Hello, world!")
51+ .build());
5352`````
5453
5554## Sending media messages
5655
5756`````
58- TextSecureMessageSender messageSender = new TextSecureMessageSender (URL, TRUST_STORE, USERNAME, PASSWORD,
59- localRecipientId, new MyAxolotlStore (),
60- Optional.absent());
57+ SignalServiceMessageSender messageSender = new SignalServiceMessageSender (URL, TRUST_STORE, USERNAME, PASSWORD,
58+ localRecipientId, new MySignalProtocolStore (),
59+ Optional.absent());
6160
6261File myAttachment = new File("/path/to/my.attachment");
6362FileInputStream attachmentStream = new FileInputStream(myAttachment);
64- TextSecureAttachment attachment = TextSecureAttachment .newStreamBuilder()
65- .withStream(attachmentStream)
66- .withContentType("image/png")
67- .withLength(myAttachment.size())
68- .build();
69-
70- messageSender.sendMessage(new TextSecureAddress ("+14159998888"),
71- TextSecureMessage .newBuilder()
72- .withBody("An attachment!")
73- .withAttachment(attachment)
74- .build());
63+ TextSecureAttachment attachment = SignalServiceAttachment .newStreamBuilder()
64+ .withStream(attachmentStream)
65+ .withContentType("image/png")
66+ .withLength(myAttachment.size())
67+ .build();
68+
69+ messageSender.sendMessage(new SignalProtocolAddress ("+14159998888"),
70+ SignalProtocolMessage .newBuilder()
71+ .withBody("An attachment!")
72+ .withAttachment(attachment)
73+ .build());
7574
7675`````
7776
7877## Receiving messages
7978
8079`````
81- TextSecureMessageReceiver messageReceiver = new TextSecureMessageReceiver (URL, TRUST_STORE, USERNAME, PASSWORD, mySignalingKey);
82- TextSecureMessagePipe messagePipe;
80+ SignalServiceMessageReceiver messageReceiver = new SignalServiceMessageReceiver (URL, TRUST_STORE, USERNAME, PASSWORD, mySignalingKey);
81+ SignalServiceMessagePipe messagePipe;
8382
8483try {
8584 messagePipe = messageReciever.createMessagePipe();
8685
8786 while (listeningForMessages) {
88- TextSecureEnvelope envelope = messagePipe.read(timeout, timeoutTimeUnit);
89- TextSecureCipher cipher = new TextSecureCipher (new MyAxolotlStore ());
90- TextSecureMessage message = cipher.decrypt(envelope);
87+ SignalServiceEnvelope envelope = messagePipe.read(timeout, timeoutTimeUnit);
88+ SignalServiceCipher cipher = new SignalServiceCipher (new MySignalProtocolStore ());
89+ SignalServiceMessage message = cipher.decrypt(envelope);
9190
9291 System.out.println("Received message: " + message.getBody().get());
9392 }
@@ -111,7 +110,7 @@ The form and manner of this distribution makes it eligible for export under the
111110
112111## License
113112
114- Copyright 2013-2015 Open Whisper Systems
113+ Copyright 2013-2016 Open Whisper Systems
115114
116115Licensed under the AGPLv3: https://www.gnu.org/licenses/agpl-3.0.html
117116
0 commit comments