what-the-bank/sources/o/MqF.java

178 lines
6.4 KiB
Java

package o;
import android.text.TextUtils;
import android.util.Base64;
import android.view.KeyEvent;
import android.view.ViewConfiguration;
import com.scb.phone.data.entity.transfer.SingleDataEntity;
import java.nio.charset.Charset;
import java.util.List;
import java.util.Objects;
import javax.crypto.Cipher;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import retrofit2.Response;
import retrofit2.adapter.rxjava3.Result;
import scb.yek.AESUtil;
import scb.yek.NTBProfileKey;
/* loaded from: classes3.dex */
public final class MqF implements InterfaceC16281mwD {
final WCw a;
private final gNU b;
private final ZYf c;
private final YWN d;
final KTN e;
private String j;
@InterfaceC13391fZD
public MqF(ZYf zYf, WCw wCw, gNU gnu, KTN ktn, YWN ywn, String str) {
this.c = zYf;
this.a = wCw;
this.b = gnu;
this.e = ktn;
this.d = ywn;
this.j = str;
}
@Override // o.InterfaceC16281mwD
public final AbstractC13163fSk<List<Cxy>> e() {
AbstractC13163fSk<SingleDataEntity<ULF>> introductions = this.c.b.getIntroductions();
final WCw wCw = this.a;
Objects.requireNonNull(wCw);
return introductions.map(new fSS(wCw) { // from class: o.tXI
private WCw e;
@Override // o.fSS
public final Object a(Object obj) {
return this.e.b((SingleDataEntity<ULF>) obj);
}
{
this.e = wCw;
}
});
}
@Override // o.InterfaceC16281mwD
public final KEo b() {
gNU gnu = this.b;
return (KEo) gnu.c.fromJson(gnu.d.getString("com.scb.phone.PREF_KEY_NEW_CUSTOMER_USER_INFO", null), KEo.class);
}
@Override // o.InterfaceC16281mwD
public final void b(KEo kEo) {
this.b.d(kEo);
}
@Override // o.InterfaceC16281mwD
public final boolean a() {
return this.b.d.getBoolean("com.scb.phone.PREF_KEY_NEW_CUSTOMER_VIEW_KYC_COACH_MARK", false);
}
@Override // o.InterfaceC16281mwD
public final void d() {
this.b.d.edit().putBoolean("com.scb.phone.PREF_KEY_NEW_CUSTOMER_VIEW_KYC_COACH_MARK", true).commit();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // o.InterfaceC16281mwD
public final AbstractC13163fSk<List<Cxy>> c(C7689ct c7689ct) {
String str;
if (gjJ.a(c7689ct.e)) {
NTBProfileKey nTBProfileKey = new NTBProfileKey();
String str2 = c7689ct.e;
C14957gcv.e(str2, "");
C14957gcv.e("com.scb.phone.data", "");
long a = NTBProfileKey.a();
String a2 = NTBProfileKey.a(a, NTBProfileKey.c());
String d = NTBProfileKey.d(String.valueOf(a));
SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
String d2 = AESUtil.d.d(nTBProfileKey.ntbProfileKeyFromJNI("com.scb.phone.data"));
char[] charArray = d.toCharArray();
C14957gcv.c(charArray, "");
byte[] bytes = d2.getBytes(gdP.a);
C14957gcv.c(bytes, "");
SecretKeySpec secretKeySpec = new SecretKeySpec(secretKeyFactory.generateSecret(new PBEKeySpec(charArray, bytes, 4096, 256)).getEncoded(), "AES");
byte[] bytes2 = gdZ.b(d, 16).getBytes(gdP.a);
C14957gcv.c(bytes2, "");
IvParameterSpec ivParameterSpec = new IvParameterSpec(bytes2);
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(1, secretKeySpec, ivParameterSpec);
Object[] objArr = new Object[1];
NTBProfileKey.f((char) (KeyEvent.getMaxKeyCode() >> 16), ViewConfiguration.getMaximumDrawingCacheSize() >> 24, 4 - TextUtils.lastIndexOf("", '0', 0, 0), objArr);
Charset forName = Charset.forName((String) objArr[0]);
C14957gcv.c(forName, "");
byte[] bytes3 = str2.getBytes(forName);
C14957gcv.c(bytes3, "");
String encodeToString = Base64.encodeToString(cipher.doFinal(bytes3), 2);
C14957gcv.c((Object) encodeToString, "");
C13396fZU c13396fZU = new C13396fZU(encodeToString, a2);
c7689ct.e = (String) c13396fZU.d;
str = (String) c13396fZU.e;
} else {
str = null;
}
C15571guL d3 = this.d.d(c7689ct.c);
c7689ct.c = d3.c;
c7689ct.j = this.j;
ZYf zYf = this.c;
return zYf.b.postUserProfile(c7689ct, str, d3.d).flatMap(new fSS() { // from class: o.jGv
@Override // o.fSS
public final Object a(Object obj) {
Result result = (Result) obj;
if (result.isError()) {
return AbstractC13163fSk.error(result.error());
}
return AbstractC13163fSk.just(result.response());
}
}).doOnNext(new fSQ(this) { // from class: o.qBP
private MqF d;
@Override // o.fSQ
public final void c(Object obj) {
KTN ktn = this.d.e;
String str3 = ((Response) obj).headers().get("Api-Auth");
if (TextUtils.isEmpty(str3)) {
return;
}
ktn.c = str3;
}
{
this.d = this;
}
}).map(new fSS(this) { // from class: o.usI
private MqF c;
@Override // o.fSS
public final Object a(Object obj) {
MqF mqF = this.c;
Response response = (Response) obj;
WCw wCw = mqF.a;
KTN ktn = mqF.e;
String str3 = response.headers().get("Api-Auth");
SingleDataEntity<ULF> singleDataEntity = (SingleDataEntity) response.body();
if (!((iJI) ZTC.e(new Object[]{singleDataEntity}, 321450472, -321450471, (int) System.currentTimeMillis())).e.equals(BET.SUCCESS.status)) {
DiG.a(singleDataEntity);
}
if (TextUtils.isEmpty(str3)) {
yzb yzbVar = new yzb();
yzbVar.e = "1999";
DiG.e(yzbVar);
}
if (!TextUtils.isEmpty(str3)) {
ktn.c = str3;
}
return wCw.b(singleDataEntity);
}
{
this.c = this;
}
});
}
}