diff options
Diffstat (limited to 'tests/src/test/java/org/whispersystems/libaxolotl/TestInMemoryAxolotlStore.java')
-rw-r--r-- | tests/src/test/java/org/whispersystems/libaxolotl/TestInMemoryAxolotlStore.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/src/test/java/org/whispersystems/libaxolotl/TestInMemoryAxolotlStore.java b/tests/src/test/java/org/whispersystems/libaxolotl/TestInMemoryAxolotlStore.java new file mode 100644 index 00000000..8c4700fc --- /dev/null +++ b/tests/src/test/java/org/whispersystems/libaxolotl/TestInMemoryAxolotlStore.java @@ -0,0 +1,22 @@ +package org.whispersystems.libaxolotl; + +import org.whispersystems.libaxolotl.ecc.Curve; +import org.whispersystems.libaxolotl.ecc.ECKeyPair; +import org.whispersystems.libaxolotl.util.KeyHelper; + +public class TestInMemoryAxolotlStore extends org.whispersystems.libaxolotl.state.impl.InMemoryAxolotlStore { + public TestInMemoryAxolotlStore() { + super(generateIdentityKeyPair(), generateRegistrationId()); + } + + private static IdentityKeyPair generateIdentityKeyPair() { + ECKeyPair identityKeyPairKeys = Curve.generateKeyPair(); + + return new IdentityKeyPair(new IdentityKey(identityKeyPairKeys.getPublicKey()), + identityKeyPairKeys.getPrivateKey()); + } + + private static int generateRegistrationId() { + return KeyHelper.generateRegistrationId(false); + } +} |