mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 00:37:47 +00:00
Add "last resort" PreKey generation to KeyHelper.
This commit is contained in:
parent
e84a0948e9
commit
81ae9af2e4
@ -48,6 +48,7 @@ prekeys.
|
||||
IdentityKeyPair identityKeyPair = KeyHelper.generateIdentityKeyPair();
|
||||
int registrationId = KeyHelper.generateRegistrationId();
|
||||
List<PreKeyRecord> preKeys = KeyHelper.generatePreKeys(startId, 100);
|
||||
PreKeyRecord lastResortKey = KeyHelper.generateLastResortKey();
|
||||
|
||||
// Store identityKeyPair somewhere durable and safe.
|
||||
// Store registrationId somewhere durable and safe.
|
||||
|
@ -74,4 +74,15 @@ public class KeyHelper {
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the last resort PreKey. Clients should do this only once, at install
|
||||
* time, and durably store it for the length of the install.
|
||||
*
|
||||
* @return the generated last resort PreKeyRecord.
|
||||
*/
|
||||
public static PreKeyRecord generateLastResortPreKey() {
|
||||
ECKeyPair keyPair = Curve.generateKeyPair(true);
|
||||
return new PreKeyRecord(Medium.MAX_VALUE, keyPair);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user