Search in sources :

Example 1 with Request

use of org.whispersystems.signalservice.internal.keybackup.protos.Request in project Signal-Android by WhisperSystems.

the class KeyBackupCipher method createKeyBackupRequest.

public static KeyBackupRequest createKeyBackupRequest(byte[] kbsAccessKey, byte[] kbsData, TokenResponse token, RemoteAttestation remoteAttestation, byte[] serviceId, int tries) {
    long now = System.currentTimeMillis();
    BackupRequest backupRequest = BackupRequest.newBuilder().setServiceId(ByteString.copyFrom(serviceId)).setBackupId(ByteString.copyFrom(token.getBackupId())).setToken(ByteString.copyFrom(token.getToken())).setValidFrom(getValidFromSeconds(now)).setData(ByteString.copyFrom(kbsData)).setPin(ByteString.copyFrom(kbsAccessKey)).setTries(tries).build();
    Request requestData = Request.newBuilder().setBackup(backupRequest).build();
    return createKeyBackupRequest(requestData, remoteAttestation, "backup");
}
Also used : BackupRequest(org.whispersystems.signalservice.internal.keybackup.protos.BackupRequest) KeyBackupRequest(org.whispersystems.signalservice.internal.contacts.entities.KeyBackupRequest) BackupRequest(org.whispersystems.signalservice.internal.keybackup.protos.BackupRequest) DeleteRequest(org.whispersystems.signalservice.internal.keybackup.protos.DeleteRequest) Request(org.whispersystems.signalservice.internal.keybackup.protos.Request) RestoreRequest(org.whispersystems.signalservice.internal.keybackup.protos.RestoreRequest) KeyBackupRequest(org.whispersystems.signalservice.internal.contacts.entities.KeyBackupRequest)

Example 2 with Request

use of org.whispersystems.signalservice.internal.keybackup.protos.Request in project Signal-Android by WhisperSystems.

the class KeyBackupCipher method createKeyRestoreRequest.

public static KeyBackupRequest createKeyRestoreRequest(byte[] kbsAccessKey, TokenResponse token, RemoteAttestation remoteAttestation, byte[] serviceId) {
    long now = System.currentTimeMillis();
    RestoreRequest restoreRequest = RestoreRequest.newBuilder().setServiceId(ByteString.copyFrom(serviceId)).setBackupId(ByteString.copyFrom(token.getBackupId())).setToken(ByteString.copyFrom(token.getToken())).setValidFrom(getValidFromSeconds(now)).setPin(ByteString.copyFrom(kbsAccessKey)).build();
    Request request = Request.newBuilder().setRestore(restoreRequest).build();
    return createKeyBackupRequest(request, remoteAttestation, "restore");
}
Also used : BackupRequest(org.whispersystems.signalservice.internal.keybackup.protos.BackupRequest) DeleteRequest(org.whispersystems.signalservice.internal.keybackup.protos.DeleteRequest) Request(org.whispersystems.signalservice.internal.keybackup.protos.Request) RestoreRequest(org.whispersystems.signalservice.internal.keybackup.protos.RestoreRequest) KeyBackupRequest(org.whispersystems.signalservice.internal.contacts.entities.KeyBackupRequest) RestoreRequest(org.whispersystems.signalservice.internal.keybackup.protos.RestoreRequest)

Example 3 with Request

use of org.whispersystems.signalservice.internal.keybackup.protos.Request in project Signal-Android by WhisperSystems.

the class KeyBackupCipher method createKeyDeleteRequest.

public static KeyBackupRequest createKeyDeleteRequest(TokenResponse token, RemoteAttestation remoteAttestation, byte[] serviceId) {
    DeleteRequest deleteRequest = DeleteRequest.newBuilder().setServiceId(ByteString.copyFrom(serviceId)).setBackupId(ByteString.copyFrom(token.getBackupId())).build();
    Request request = Request.newBuilder().setDelete(deleteRequest).build();
    return createKeyBackupRequest(request, remoteAttestation, "delete");
}
Also used : BackupRequest(org.whispersystems.signalservice.internal.keybackup.protos.BackupRequest) DeleteRequest(org.whispersystems.signalservice.internal.keybackup.protos.DeleteRequest) Request(org.whispersystems.signalservice.internal.keybackup.protos.Request) RestoreRequest(org.whispersystems.signalservice.internal.keybackup.protos.RestoreRequest) KeyBackupRequest(org.whispersystems.signalservice.internal.contacts.entities.KeyBackupRequest) DeleteRequest(org.whispersystems.signalservice.internal.keybackup.protos.DeleteRequest)

Aggregations

KeyBackupRequest (org.whispersystems.signalservice.internal.contacts.entities.KeyBackupRequest)3 BackupRequest (org.whispersystems.signalservice.internal.keybackup.protos.BackupRequest)3 DeleteRequest (org.whispersystems.signalservice.internal.keybackup.protos.DeleteRequest)3 Request (org.whispersystems.signalservice.internal.keybackup.protos.Request)3 RestoreRequest (org.whispersystems.signalservice.internal.keybackup.protos.RestoreRequest)3