PR cleanup #1164
2 changed files with 4 additions and 2 deletions
|
@ -121,6 +121,7 @@ import java.io.InputStreamReader;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -1799,7 +1800,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
if (!Helper.isNullOrEmpty(encryptedAuthToken)) {
|
if (!Helper.isNullOrEmpty(encryptedAuthToken)) {
|
||||||
try {
|
try {
|
||||||
Lbryio.AUTH_TOKEN = new String(Utils.decrypt(
|
Lbryio.AUTH_TOKEN = new String(Utils.decrypt(
|
||||||
Base64.decode(encryptedAuthToken, Base64.NO_WRAP), this, Lbry.KEYSTORE), "UTF8");
|
Base64.decode(encryptedAuthToken, Base64.NO_WRAP), this, Lbry.KEYSTORE), StandardCharsets.UTF_8);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
// pass. A new auth token would have to be generated if the old one cannot be decrypted
|
// pass. A new auth token would have to be generated if the old one cannot be decrypted
|
||||||
Log.e(TAG, "Could not decrypt existing auth token.", ex);
|
Log.e(TAG, "Could not decrypt existing auth token.", ex);
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -304,7 +305,7 @@ public final class Lbryio {
|
||||||
private static void broadcastAuthTokenGenerated(Context context) {
|
private static void broadcastAuthTokenGenerated(Context context) {
|
||||||
try {
|
try {
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
String encryptedAuthToken = Utils.encrypt(AUTH_TOKEN.getBytes("UTF8"), context, Lbry.KEYSTORE);
|
String encryptedAuthToken = Utils.encrypt(AUTH_TOKEN.getBytes(StandardCharsets.UTF_8), context, Lbry.KEYSTORE);
|
||||||
Intent intent = new Intent(MainActivity.ACTION_AUTH_TOKEN_GENERATED);
|
Intent intent = new Intent(MainActivity.ACTION_AUTH_TOKEN_GENERATED);
|
||||||
intent.putExtra("authToken", encryptedAuthToken);
|
intent.putExtra("authToken", encryptedAuthToken);
|
||||||
context.sendBroadcast(intent);
|
context.sendBroadcast(intent);
|
||||||
|
|
Loading…
Reference in a new issue