mirror of
https://github.com/signalapp/libsignal.git
synced 2026-05-11 09:26:20 +02:00
Remove some Java API surface no longer needed
Some cruft still remains for the tests which is hard to avoid, eg getAliceBaseKey
This commit is contained in:
@@ -45,32 +45,10 @@ public class SessionRecord {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasSessionState(int version, byte[] aliceBaseKey) {
|
||||
if (sessionState.getSessionVersion() == version &&
|
||||
Arrays.equals(aliceBaseKey, sessionState.getAliceBaseKey()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
for (SessionState state : previousStates) {
|
||||
if (state.getSessionVersion() == version &&
|
||||
Arrays.equals(aliceBaseKey, state.getAliceBaseKey()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public SessionState getSessionState() {
|
||||
return sessionState;
|
||||
}
|
||||
|
||||
public boolean isFresh() {
|
||||
return fresh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the current {@link SessionState} into the list of "previous" session states,
|
||||
* and replace the current {@link org.whispersystems.libsignal.state.SessionState}
|
||||
@@ -80,7 +58,7 @@ public class SessionRecord {
|
||||
promoteState(new SessionState());
|
||||
}
|
||||
|
||||
public void promoteState(SessionState promotedState) {
|
||||
private void promoteState(SessionState promotedState) {
|
||||
this.previousStates.addFirst(sessionState);
|
||||
this.sessionState = promotedState;
|
||||
|
||||
@@ -89,10 +67,6 @@ public class SessionRecord {
|
||||
}
|
||||
}
|
||||
|
||||
public void setState(SessionState sessionState) {
|
||||
this.sessionState = sessionState;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a serialized version of the current SessionRecord.
|
||||
*/
|
||||
|
||||
@@ -83,11 +83,11 @@ public class SessionState {
|
||||
this.sessionStructure = sessionStructure;
|
||||
}
|
||||
|
||||
public SessionState(SessionState copy) {
|
||||
SessionState(SessionState copy) {
|
||||
this.sessionStructure = copy.sessionStructure.toBuilder().build();
|
||||
}
|
||||
|
||||
public SessionStructure getStructure() {
|
||||
SessionStructure getStructure() {
|
||||
return sessionStructure;
|
||||
}
|
||||
|
||||
@@ -123,27 +123,6 @@ public class SessionState {
|
||||
}
|
||||
}
|
||||
|
||||
public int getPreviousCounter() {
|
||||
return sessionStructure.getPreviousCounter();
|
||||
}
|
||||
|
||||
public ECPublicKey getSenderRatchetKey() {
|
||||
try {
|
||||
return Curve.decodePoint(sessionStructure.getSenderChain().getSenderRatchetKey().toByteArray(), 0);
|
||||
} catch (InvalidKeyException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
public ECKeyPair getSenderRatchetKeyPair() {
|
||||
ECPublicKey publicKey = getSenderRatchetKey();
|
||||
ECPrivateKey privateKey = Curve.decodePrivatePoint(sessionStructure.getSenderChain()
|
||||
.getSenderRatchetKeyPrivate()
|
||||
.toByteArray());
|
||||
|
||||
return new ECKeyPair(publicKey, privateKey);
|
||||
}
|
||||
|
||||
public boolean hasSenderChain() {
|
||||
return sessionStructure.hasSenderChain();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user