From c60ac4a1eccd3b33b5927ade5cadb54310a66bfb Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 11 Oct 2019 17:27:29 +0100 Subject: [PATCH 1/9] rc build with sdk 0.42.2 --- app | 2 +- buildozer.spec.arm.ci | 2 +- buildozer.spec.arm64.ci | 2 +- buildozer.spec.sample | 2 +- buildozer.spec.vagrant | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app b/app index 79c02825..b82759c7 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit 79c02825d187844d759514117c664f9426c641ca +Subproject commit b82759c78e1b501b783f3c1299a5bc026e7a27a8 diff --git a/buildozer.spec.arm.ci b/buildozer.spec.arm.ci index bb889d6d..fad72121 100644 --- a/buildozer.spec.arm.ci +++ b/buildozer.spec.arm.ci @@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.42.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.42.1#egg=torba&subdirectory=torba" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=torba&subdirectory=torba" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.arm64.ci b/buildozer.spec.arm64.ci index 08a93cef..3afa2f7d 100644 --- a/buildozer.spec.arm64.ci +++ b/buildozer.spec.arm64.ci @@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.42.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.42.1#egg=torba&subdirectory=torba" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=torba&subdirectory=torba" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.sample b/buildozer.spec.sample index 60c1a92a..fa0d47e8 100644 --- a/buildozer.spec.sample +++ b/buildozer.spec.sample @@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.42.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.42.1#egg=torba&subdirectory=torba" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=torba&subdirectory=torba" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.vagrant b/buildozer.spec.vagrant index 10c467ed..7eeb6305 100644 --- a/buildozer.spec.vagrant +++ b/buildozer.spec.vagrant @@ -272,4 +272,4 @@ warn_on_root = 1 # Then, invoke the command line with the "demo" profile: # #buildozer --profile demo android debug -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.42.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.42.1#egg=torba&subdirectory=torba" \ No newline at end of file +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=torba&subdirectory=torba" \ No newline at end of file -- 2.45.3 From c711fa070aa8b388bd15b04adbf436e6130bfa97 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 15 Oct 2019 09:17:22 +0100 Subject: [PATCH 2/9] sdk 0.43.0. add shareUrl method. --- app | 2 +- buildozer.spec.arm.ci | 2 +- buildozer.spec.arm64.ci | 2 +- buildozer.spec.sample | 2 +- buildozer.spec.vagrant | 2 +- .../lbry/browser/reactmodules/UtilityModule.java | 14 +++++++++++++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app b/app index b82759c7..dcbb7f62 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit b82759c78e1b501b783f3c1299a5bc026e7a27a8 +Subproject commit dcbb7f62d6e8b857781acf7e15a25bcd0b883cc0 diff --git a/buildozer.spec.arm.ci b/buildozer.spec.arm.ci index fad72121..f8d10df5 100644 --- a/buildozer.spec.arm.ci +++ b/buildozer.spec.arm.ci @@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=torba&subdirectory=torba" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=torba&subdirectory=torba" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.arm64.ci b/buildozer.spec.arm64.ci index 3afa2f7d..94035384 100644 --- a/buildozer.spec.arm64.ci +++ b/buildozer.spec.arm64.ci @@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=torba&subdirectory=torba" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=torba&subdirectory=torba" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.sample b/buildozer.spec.sample index fa0d47e8..cf8090e8 100644 --- a/buildozer.spec.sample +++ b/buildozer.spec.sample @@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=torba&subdirectory=torba" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=torba&subdirectory=torba" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.vagrant b/buildozer.spec.vagrant index 7eeb6305..a70eb747 100644 --- a/buildozer.spec.vagrant +++ b/buildozer.spec.vagrant @@ -272,4 +272,4 @@ warn_on_root = 1 # Then, invoke the command line with the "demo" profile: # #buildozer --profile demo android debug -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.42.2#egg=torba&subdirectory=torba" \ No newline at end of file +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=torba&subdirectory=torba" \ No newline at end of file diff --git a/src/main/java/io/lbry/browser/reactmodules/UtilityModule.java b/src/main/java/io/lbry/browser/reactmodules/UtilityModule.java index f6e46bd0..09bf33fd 100644 --- a/src/main/java/io/lbry/browser/reactmodules/UtilityModule.java +++ b/src/main/java/io/lbry/browser/reactmodules/UtilityModule.java @@ -208,6 +208,18 @@ public class UtilityModule extends ReactContextBaseJavaModule { } } + @ReactMethod + public void shareUrl(String url) { + Intent shareIntent = new Intent(); + shareIntent.setAction(Intent.ACTION_SEND); + shareIntent.setType("text/plain"); + shareIntent.putExtra(Intent.EXTRA_TEXT, url); + + Intent shareUrlIntent = Intent.createChooser(shareIntent, "Share LBRY content"); + shareUrlIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(shareUrlIntent); + } + @ReactMethod public void showNotificationForContent(final String uri, String title, String publisher, final String thumbnail, boolean isPlayable) { final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); @@ -354,7 +366,7 @@ public class UtilityModule extends ReactContextBaseJavaModule { context.sendBroadcast(intent); } } - + @ReactMethod public void openDocumentPicker(String type) { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); -- 2.45.3 From fa2cc270850e73935a4c879d8c639900f80c218a Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 15 Oct 2019 10:24:55 +0100 Subject: [PATCH 3/9] preference updates. fix KeyStore ops for Android 9++. --- app | 2 +- src/main/java/io/lbry/browser/Utils.java | 58 ++++++++++++++++++------ 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/app b/app index dcbb7f62..194e2935 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit dcbb7f62d6e8b857781acf7e15a25bcd0b883cc0 +Subproject commit 194e29356f24527f7d17c6adbaf24c0165b54a67 diff --git a/src/main/java/io/lbry/browser/Utils.java b/src/main/java/io/lbry/browser/Utils.java index e86f078f..dd432386 100644 --- a/src/main/java/io/lbry/browser/Utils.java +++ b/src/main/java/io/lbry/browser/Utils.java @@ -2,6 +2,7 @@ package io.lbry.browser; import android.content.Context; import android.content.SharedPreferences; +import android.os.Build; import android.security.KeyPairGeneratorSpec; import android.util.Base64; import android.util.Log; @@ -25,6 +26,8 @@ import java.security.Key; import java.security.KeyPairGenerator; import java.security.KeyStore; import java.security.NoSuchProviderException; +import java.security.PrivateKey; +import java.security.PublicKey; import java.security.SecureRandom; import java.util.ArrayList; import java.util.Calendar; @@ -40,7 +43,7 @@ import org.json.JSONObject; import org.json.JSONException; public final class Utils { - + private static final String TAG = Utils.class.getName(); private static final String AES_MODE = "AES/ECB/PKCS7Padding"; @@ -56,9 +59,9 @@ public final class Utils { private static final String SP_ENCRYPTION_KEY = "key"; private static final String SP_API_SECRET_KEY = "api_secret"; - + public static final String SDK_URL = "http://127.0.0.1:5279"; - + public static String getAndroidRelease() { return android.os.Build.VERSION.RELEASE; } @@ -153,6 +156,7 @@ public final class Utils { try { SharedPreferences pref = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE); String encryptedValue = pref.getString(key, null); + if (encryptedValue == null || encryptedValue.trim().length() == 0) { return null; } @@ -255,11 +259,11 @@ public final class Utils { return ks; } - + public static String performRequest(String url) throws ConnectException { return performRequest(url, "GET", null); } - + public static String performRequest(String requestUrl, String requestMethod, String json) throws ConnectException { BufferedReader reader = null; DataOutputStream dos = null; @@ -275,14 +279,14 @@ public final class Utils { conn.setDoOutput(true); conn.setRequestProperty("Content-type", "application/json"); } - + if (json != null) { dos = new DataOutputStream(conn.getOutputStream()); dos.writeBytes(json); dos.flush(); dos.close(); } - + if (conn.getResponseCode() == 200) { reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8")); StringBuilder sb = new StringBuilder(); @@ -325,7 +329,7 @@ public final class Utils { return null; } - + public static String sdkCall(String method) throws ConnectException { return sdkCall(method, null); } @@ -341,7 +345,7 @@ public final class Utils { } request.put("params", requestParams); } - + return performRequest(SDK_URL, "POST", request.toString()); } catch (ConnectException ex) { // sdk not started yet. rethrow @@ -356,11 +360,24 @@ public final class Utils { } private static byte[] rsaEncrypt(byte[] secret, KeyStore keyStore) throws Exception { - KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(KEY_ALIAS, null); + PrivateKey privateKey = null; + PublicKey publicKey = null; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + privateKey = (PrivateKey) keyStore.getKey(KEY_ALIAS, null); + publicKey = keyStore.getCertificate(KEY_ALIAS).getPublicKey(); + } else { + KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(KEY_ALIAS, null); + privateKey = privateKeyEntry.getPrivateKey(); + publicKey = privateKeyEntry.getCertificate().getPublicKey(); + } + + if (publicKey == null) { + throw new Exception("Could not obtain public key for encryption."); + } // Encrypt the text Cipher inputCipher = Cipher.getInstance(RSA_MODE); - inputCipher.init(Cipher.ENCRYPT_MODE, privateKeyEntry.getCertificate().getPublicKey()); + inputCipher.init(Cipher.ENCRYPT_MODE, publicKey); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); CipherOutputStream cipherOutputStream = new CipherOutputStream(outputStream, inputCipher); @@ -371,9 +388,20 @@ public final class Utils { } private static byte[] rsaDecrypt(byte[] encrypted, KeyStore keyStore) throws Exception { - KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(KEY_ALIAS, null); + PrivateKey privateKey = null; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + privateKey = (PrivateKey) keyStore.getKey(KEY_ALIAS, null); + } else { + KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(KEY_ALIAS, null); + privateKey = privateKeyEntry.getPrivateKey(); + } + + if (privateKey == null) { + throw new Exception("Could not obtain private key for decryption"); + } + Cipher output = Cipher.getInstance(RSA_MODE); - output.init(Cipher.DECRYPT_MODE, privateKeyEntry.getPrivateKey()); + output.init(Cipher.DECRYPT_MODE, privateKey); CipherInputStream cipherInputStream = new CipherInputStream(new ByteArrayInputStream(encrypted), output); ArrayList values = new ArrayList(); int nextByte; @@ -412,14 +440,14 @@ public final class Utils { } return new SecretKeySpec(rsaDecrypt(Base64.decode(base64Key, Base64.DEFAULT), keyStore), "AES"); } - + public static String capitalizeAndStrip(String text) { String[] parts = text.split(" "); StringBuilder sb = new StringBuilder(); for (int i = 0; i < parts.length; i++) { sb.append(parts[i].substring(0, 1).toUpperCase()).append(parts[i].substring(1)); } - + return sb.toString(); } } -- 2.45.3 From 915f4c93f7dae7c8d5ad7c8131c46a209560de54 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 15 Oct 2019 18:00:47 +0100 Subject: [PATCH 4/9] app head: latest changes --- app | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app b/app index 60b06675..d18ac68e 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit 60b0667546d3d6187fb5bf35456c67c1280f225d +Subproject commit d18ac68e2c7d5137ea1e06207d7e7f842f957417 -- 2.45.3 From 58b6dae3abbfd78420fa55d7d536d3debf0d8ef8 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 15 Oct 2019 23:14:19 +0100 Subject: [PATCH 5/9] app head: update sdk calls --- app | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app b/app index d18ac68e..eb12a361 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit d18ac68e2c7d5137ea1e06207d7e7f842f957417 +Subproject commit eb12a361b7ae847b8f965f2e1a00df0cc92c19ea -- 2.45.3 From d784b576caec0f430162ce9f83899d89fd46beff Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Wed, 16 Oct 2019 17:09:23 +0100 Subject: [PATCH 6/9] app head: more updates for release --- app | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app b/app index eb12a361..48030a97 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit eb12a361b7ae847b8f965f2e1a00df0cc92c19ea +Subproject commit 48030a97f2ce898502938ef0cd648dececa32aa1 -- 2.45.3 From 0692516b7ea879143cdc4e7fe734d21adb5b32a1 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Thu, 17 Oct 2019 06:31:44 +0100 Subject: [PATCH 7/9] sdk 0.43.1 --- app | 2 +- buildozer.spec.arm.ci | 2 +- buildozer.spec.arm64.ci | 2 +- buildozer.spec.sample | 2 +- buildozer.spec.vagrant | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app b/app index 48030a97..d5f6d494 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit 48030a97f2ce898502938ef0cd648dececa32aa1 +Subproject commit d5f6d494a4a4b8aaf07110a5c896b445dd9649b7 diff --git a/buildozer.spec.arm.ci b/buildozer.spec.arm.ci index f8d10df5..4beb8a5a 100644 --- a/buildozer.spec.arm.ci +++ b/buildozer.spec.arm.ci @@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=torba&subdirectory=torba" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.1#egg=torba&subdirectory=torba" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.arm64.ci b/buildozer.spec.arm64.ci index 94035384..fd5bcbc5 100644 --- a/buildozer.spec.arm64.ci +++ b/buildozer.spec.arm64.ci @@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=torba&subdirectory=torba" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.1#egg=torba&subdirectory=torba" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.sample b/buildozer.spec.sample index cf8090e8..78a0439f 100644 --- a/buildozer.spec.sample +++ b/buildozer.spec.sample @@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=torba&subdirectory=torba" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.1#egg=torba&subdirectory=torba" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.vagrant b/buildozer.spec.vagrant index a70eb747..18f93d6e 100644 --- a/buildozer.spec.vagrant +++ b/buildozer.spec.vagrant @@ -272,4 +272,4 @@ warn_on_root = 1 # Then, invoke the command line with the "demo" profile: # #buildozer --profile demo android debug -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.0#egg=torba&subdirectory=torba" \ No newline at end of file +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.1#egg=torba&subdirectory=torba" \ No newline at end of file -- 2.45.3 From 28b1ac2bd5b7523e9691032b339127195eb6fd8e Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Thu, 17 Oct 2019 13:58:03 +0100 Subject: [PATCH 8/9] app headd: remove getSync from channel creation success --- app | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app b/app index d5f6d494..3ddd0b5b 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit d5f6d494a4a4b8aaf07110a5c896b445dd9649b7 +Subproject commit 3ddd0b5b50dcc2f1107d351b7386b67f881211a0 -- 2.45.3 From 6f364fb5e5c5b707df1a0399dc939957eb036191 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Thu, 17 Oct 2019 14:11:53 +0100 Subject: [PATCH 9/9] app head: master --- app | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app b/app index 3ddd0b5b..90809138 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit 3ddd0b5b50dcc2f1107d351b7386b67f881211a0 +Subproject commit 9080913811b1916774b8eea010bb3ce46ea6f586 -- 2.45.3