package i9;

import ca.canadapost.core.services.models.EpostOAuthLoginResponse;
import kotlin.jvm.internal.k;
import kotlin.jvm.internal.t;

/* loaded from: classes.dex */
public final class a implements c {

    /* renamed from: c, reason: collision with root package name */
    public static final C0482a f22517c = new C0482a(null);

    /* renamed from: a, reason: collision with root package name */
    private final ja.d f22518a;

    /* renamed from: b, reason: collision with root package name */
    private final ja.c f22519b;

    /* renamed from: i9.a$a, reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public static final class C0482a {
        private C0482a() {
        }

        public /* synthetic */ C0482a(k kVar) {
            this();
        }
    }

    public a(ja.d sharePrefs, ja.c encryptedSharePrefs) {
        t.g(sharePrefs, "sharePrefs");
        t.g(encryptedSharePrefs, "encryptedSharePrefs");
        this.f22518a = sharePrefs;
        this.f22519b = encryptedSharePrefs;
    }

    private final String e(String str) {
        String string = this.f22518a.getString(str, null);
        if (string == null) {
            return null;
        }
        this.f22519b.putString(str, string);
        this.f22518a.remove(str);
        return string;
    }

    @Override // i9.c
    public void a(String str) {
        this.f22519b.putString("CpcID_key", str);
    }

    @Override // i9.c
    public void b(EpostOAuthLoginResponse epostOAuthLoginResponse) {
        this.f22519b.putString("EpostOAuthLoginResponse_key", epostOAuthLoginResponse != null ? epostOAuthLoginResponse.toJsonString() : null);
    }

    @Override // i9.c
    public EpostOAuthLoginResponse c() {
        return EpostOAuthLoginResponse.INSTANCE.a(this.f22519b.getString("EpostOAuthLoginResponse_key", e("EpostOAuthLoginResponse_key")));
    }

    @Override // i9.c
    public String d() {
        return this.f22519b.getString("CpcID_key", e("CpcID_key"));
    }
}
