-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename 'device key' to 'signed prekey'.
- Loading branch information
Showing
26 changed files
with
579 additions
and
580 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 0 additions & 58 deletions
58
libaxolotl/src/androidTest/java/org/whispersystems/test/InMemoryDeviceKeyStore.java
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
libaxolotl/src/androidTest/java/org/whispersystems/test/InMemorySignedPreKeyStore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.whispersystems.test; | ||
|
||
import org.whispersystems.libaxolotl.InvalidKeyIdException; | ||
import org.whispersystems.libaxolotl.state.SignedPreKeyRecord; | ||
import org.whispersystems.libaxolotl.state.SignedPreKeyStore; | ||
|
||
import java.io.IOException; | ||
import java.util.HashMap; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class InMemorySignedPreKeyStore implements SignedPreKeyStore { | ||
|
||
private final Map<Integer, byte[]> store = new HashMap<>(); | ||
|
||
@Override | ||
public SignedPreKeyRecord loadSignedPreKey(int signedPreKeyId) throws InvalidKeyIdException { | ||
try { | ||
if (!store.containsKey(signedPreKeyId)) { | ||
throw new InvalidKeyIdException("No such signedprekeyrecord!"); | ||
} | ||
|
||
return new SignedPreKeyRecord(store.get(signedPreKeyId)); | ||
} catch (IOException e) { | ||
throw new AssertionError(e); | ||
} | ||
} | ||
|
||
@Override | ||
public List<SignedPreKeyRecord> loadSignedPreKeys() { | ||
try { | ||
List<SignedPreKeyRecord> results = new LinkedList<>(); | ||
|
||
for (byte[] serialized : store.values()) { | ||
results.add(new SignedPreKeyRecord(serialized)); | ||
} | ||
|
||
return results; | ||
} catch (IOException e) { | ||
throw new AssertionError(e); | ||
} | ||
} | ||
|
||
@Override | ||
public void storeSignedPreKey(int signedPreKeyId, SignedPreKeyRecord record) { | ||
store.put(signedPreKeyId, record.serialize()); | ||
} | ||
|
||
@Override | ||
public boolean containsSignedPreKey(int signedPreKeyId) { | ||
return store.containsKey(signedPreKeyId); | ||
} | ||
|
||
@Override | ||
public void removeSignedPreKey(int signedPreKeyId) { | ||
store.remove(signedPreKeyId); | ||
} | ||
} |
202 changes: 101 additions & 101 deletions
202
libaxolotl/src/androidTest/java/org/whispersystems/test/SessionBuilderTest.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.