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");
}
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");
}
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");
}
Aggregations