├── .gitignore ├── .idea ├── AndroidProjectSystem.xml ├── codeStyles │ └── Project.xml ├── compiler.xml ├── deploymentTargetDropDown.xml ├── deploymentTargetSelector.xml ├── encodings.xml ├── inspectionProfiles │ └── Project_Default.xml ├── jarRepositories.xml ├── migrations.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml ├── studiobot.xml └── vcs.xml ├── LICENSE ├── README.md ├── app ├── .gitignore ├── CMakeLists.txt ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── xyz │ │ └── zood │ │ └── george │ │ ├── DBTest.java │ │ ├── FriendshipManagerTest.java │ │ ├── PersistentQueueTest.java │ │ ├── SafetyNumberTest.java │ │ └── SodiumTest.java │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ └── sodium.c │ ├── ic_launcher-web.png │ ├── java │ ├── com │ │ └── squareup │ │ │ └── picasso │ │ │ └── PicassoTools.java │ ├── io │ │ └── pijun │ │ │ └── george │ │ │ ├── App.java │ │ │ ├── AuthenticationManager.java │ │ │ ├── Battery.java │ │ │ ├── CloudLogger.java │ │ │ ├── Config.java │ │ │ ├── Constants.java │ │ │ ├── Hex.java │ │ │ ├── L.java │ │ │ ├── LocationUtils.java │ │ │ ├── LogActivity.java │ │ │ ├── MessageProcessor.java │ │ │ ├── Prefs.java │ │ │ ├── SettingsAdapter.java │ │ │ ├── SettingsFragment.java │ │ │ ├── Sodium.java │ │ │ ├── UiRunnable.java │ │ │ ├── UpdateStatusTracker.java │ │ │ ├── Utils.java │ │ │ ├── WelcomeActivity.java │ │ │ ├── WelcomeViewHolder.java │ │ │ ├── WorkerRunnable.java │ │ │ ├── api │ │ │ ├── AuthenticationChallenge.java │ │ │ ├── CommType.java │ │ │ ├── CreateUserResponse.java │ │ │ ├── DeviceInfo.java │ │ │ ├── FinishedAuthenticationChallenge.java │ │ │ ├── LimitedUserInfo.java │ │ │ ├── LoginResponse.java │ │ │ ├── Message.java │ │ │ ├── MessageConverter.java │ │ │ ├── OscarAPI.java │ │ │ ├── OscarClient.java │ │ │ ├── OscarError.java │ │ │ ├── OscarSocket.java │ │ │ ├── OutboundMessage.java │ │ │ ├── PushNotification.java │ │ │ ├── SearchUserResult.java │ │ │ ├── ServerPublicKeyResponse.java │ │ │ ├── TaskSender.java │ │ │ ├── User.java │ │ │ ├── UserComm.java │ │ │ ├── adapter │ │ │ │ ├── BytesToBase64Adapter.java │ │ │ │ └── CommTypeAdapter.java │ │ │ ├── locationiq │ │ │ │ ├── LatLng.java │ │ │ │ ├── LocationIQAPI.java │ │ │ │ ├── LocationIQClient.java │ │ │ │ ├── RevGeocoding.java │ │ │ │ └── ReverseGeocodingCache.java │ │ │ └── task │ │ │ │ ├── AddFcmTokenTask.java │ │ │ │ ├── DeleteFcmTokenTask.java │ │ │ │ ├── DeleteMessageTask.java │ │ │ │ ├── DropPackageTask.java │ │ │ │ ├── OscarTask.java │ │ │ │ ├── QueueConverter.java │ │ │ │ └── SendMessageTask.java │ │ │ ├── crypto │ │ │ ├── EncryptedData.java │ │ │ └── KeyPair.java │ │ │ ├── database │ │ │ ├── DB.java │ │ │ ├── FriendLocation.java │ │ │ ├── FriendRecord.java │ │ │ ├── LimitedShare.java │ │ │ ├── MovementType.java │ │ │ ├── Snapshot.java │ │ │ └── UserRecord.java │ │ │ ├── network │ │ │ └── Network.java │ │ │ ├── queue │ │ │ └── PersistentQueue.java │ │ │ ├── service │ │ │ ├── BootReceiver.java │ │ │ ├── FcmMessageReceiver.java │ │ │ └── TimedShareService.java │ │ │ ├── sodium │ │ │ └── HashConfig.java │ │ │ └── view │ │ │ ├── AvatarRenderer.java │ │ │ ├── AvatarView.java │ │ │ ├── MyLocationView.java │ │ │ ├── ProfileListItemViewHolder.java │ │ │ └── RecyclerViewAdapterItem.java │ └── xyz │ │ └── zood │ │ └── george │ │ ├── AddFriendFragment.java │ │ ├── AppInForegroundObserver.java │ │ ├── AvatarCropperActivity.java │ │ ├── AvatarManager.java │ │ ├── BackPressInterceptor.java │ │ ├── BackPressNotifier.java │ │ ├── FriendBarFragment.java │ │ ├── FriendSymbol.java │ │ ├── FriendSymbolTracker.java │ │ ├── FriendsBarAdapter.java │ │ ├── FriendshipManager.java │ │ ├── LibrariesAdapter.java │ │ ├── LicenseTextFragment.java │ │ ├── LicensesFragment.java │ │ ├── MainActivity.java │ │ ├── MainFragment.java │ │ ├── MapLibreMapLifecycleObserver.java │ │ ├── MyLocationSymbol.java │ │ ├── OnboardingFragment.java │ │ ├── Permissions.java │ │ ├── SafetyNumber.java │ │ ├── SafetyNumberFragment.java │ │ ├── TimedShareFragment.java │ │ ├── animation │ │ ├── LatLngEvaluator.java │ │ ├── PointEvaluator.java │ │ ├── PointGeoJsonSource.java │ │ └── SymbolPosition.java │ │ ├── notifier │ │ ├── ActivityRecognitionPermissionNotifier.java │ │ ├── BackgroundDataRestrictionNotifier.java │ │ ├── BackgroundLocationPermissionNotifier.java │ │ ├── ClientNotConnectedNotifier.java │ │ └── ForegroundLocationPermissionNotifier.java │ │ ├── receiver │ │ ├── PassiveLocationReceiver.java │ │ ├── ScreenOnReceiver.java │ │ └── UserActivityReceiver.java │ │ ├── service │ │ ├── LocationService.java │ │ └── ScreamerService.java │ │ ├── time │ │ └── HoursMinutesSeconds.java │ │ ├── viewmodels │ │ ├── Event.java │ │ └── MainViewModel.java │ │ ├── widget │ │ ├── AuthenticationProgressDialog.java │ │ ├── BannerView.java │ │ ├── CircularProgressView.java │ │ ├── InfoPanel.java │ │ ├── RadialMenuButton.java │ │ ├── SettingsListItemViewHolder.java │ │ ├── SlidableCL.java │ │ ├── SlidableScrollView.java │ │ └── ZoodDialog.java │ │ └── worker │ │ ├── BackupDatabaseWorker.java │ │ └── LocationWorker.java │ └── res │ ├── animator │ ├── fade_in.xml │ ├── fade_out.xml │ ├── new_enter_from_left.xml │ ├── new_enter_from_right.xml │ ├── new_exit_to_left.xml │ └── new_exit_to_right.xml │ ├── color │ ├── avatar_border.xml │ ├── fab_background.xml │ ├── my_location_fab_tint.xml │ ├── switch_thumb.xml │ ├── switch_track.xml │ ├── text_button_text_and_icon.xml │ ├── timed_share_button.xml │ ├── timed_share_fab_background.xml │ └── timed_share_fab_tint.xml │ ├── drawable-xxhdpi │ └── george_clooney.jpg │ ├── drawable-xxxhdpi │ └── location_logo_113dp.png │ ├── drawable │ ├── add_friends.xml │ ├── ic_add_circle_outline.xml │ ├── ic_arrow_back_24dp.xml │ ├── ic_check_black_24dp.xml │ ├── ic_chevron_left_24dp.xml │ ├── ic_clear_black_24px.xml │ ├── ic_close_black_24dp.xml │ ├── ic_cloud.xml │ ├── ic_content_copy_black_24px.xml │ ├── ic_info_24dp.xml │ ├── ic_location_on_black_24dp.xml │ ├── ic_my_location_black_24dp.xml │ ├── ic_outlined_exit_to_app_24dp.xml │ ├── ic_outlined_notifications_24dp.xml │ ├── ic_outlined_person_add_24dp.xml │ ├── ic_outlined_privacy_tip_24dp.xml │ ├── ic_pin.xml │ ├── ic_position_service.xml │ ├── ic_refresh_24dp.xml │ ├── ic_refresh_black_24dp.xml │ ├── ic_remove_circle_outline.xml │ ├── ic_schedule_black_24px.xml │ ├── ic_settings.xml │ ├── ic_share_24dp.xml │ ├── ic_sharp_battery_20_20dp.xml │ ├── ic_sharp_battery_30_20dp.xml │ ├── ic_sharp_battery_50_20dp.xml │ ├── ic_sharp_battery_60_20dp.xml │ ├── ic_sharp_battery_80_20dp.xml │ ├── ic_sharp_battery_90_20dp.xml │ ├── ic_sharp_battery_charging_20_20dp.xml │ ├── ic_sharp_battery_charging_30_20dp.xml │ ├── ic_sharp_battery_charging_50_20dp.xml │ ├── ic_sharp_battery_charging_60_20dp.xml │ ├── ic_sharp_battery_charging_80_20dp.xml │ ├── ic_sharp_battery_charging_90_20dp.xml │ ├── ic_sharp_battery_charging_full_20dp.xml │ ├── ic_sharp_battery_full_20dp.xml │ ├── ic_sharp_bike_20dp.xml │ ├── ic_sharp_car_20dp.xml │ ├── ic_sharp_more_vert_24dp.xml │ ├── ic_sharp_navigation_20dp.xml │ ├── ic_sharp_person_add_24dp.xml │ ├── ic_sharp_settings_24dp.xml │ ├── ic_sharp_walk_20dp.xml │ ├── ic_timed_share.xml │ ├── ic_timed_share_map_texture_off.xml │ ├── ic_timed_share_map_texture_on.xml │ ├── ic_zood_logo.xml │ ├── invalid_user_icon.xml │ ├── onboarding_add_friends.xml │ ├── onboarding_permission.xml │ ├── onboarding_safe_secure.xml │ ├── onboarding_share_location.xml │ ├── page_indicator.xml │ ├── radial_button_background.xml │ └── rounded_background.xml │ ├── font │ ├── montserrat.xml │ ├── montserrat_bold.ttf │ └── montserrat_extra_bold.ttf │ ├── layout │ ├── activity_avatar_cropper.xml │ ├── activity_log.xml │ ├── activity_main.xml │ ├── activity_welcome.xml │ ├── banner_item.xml │ ├── fragment_add_friend.xml │ ├── fragment_alert_dialog.xml │ ├── fragment_authentication_progress_dialog.xml │ ├── fragment_confirmation_dialog.xml │ ├── fragment_friends_bar.xml │ ├── fragment_license_text.xml │ ├── fragment_licenses.xml │ ├── fragment_main.xml │ ├── fragment_onboarding.xml │ ├── fragment_safety_number.xml │ ├── fragment_settings.xml │ ├── fragment_timed_share.xml │ ├── friends_bar_add_friend.xml │ ├── friends_bar_divider.xml │ ├── friends_bar_friend.xml │ ├── friends_bar_margin.xml │ ├── library_list_item.xml │ ├── onboarding_slide.xml │ ├── profile_list_item.xml │ └── settings_list_item.xml │ ├── menu │ ├── activity_log.xml │ ├── activity_safety_number.xml │ ├── info_panel_overflow.xml │ └── profile_photo.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ ├── ic_launcher_background.png │ ├── ic_launcher_foreground.png │ ├── ic_launcher_monochrome.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ ├── ic_launcher_background.png │ ├── ic_launcher_foreground.png │ ├── ic_launcher_monochrome.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ ├── ic_launcher_background.png │ ├── ic_launcher_foreground.png │ ├── ic_launcher_monochrome.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ ├── ic_launcher_background.png │ ├── ic_launcher_foreground.png │ ├── ic_launcher_monochrome.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ ├── ic_launcher_background.png │ ├── ic_launcher_foreground.png │ ├── ic_launcher_monochrome.png │ └── ic_launcher_round.png │ ├── raw │ └── apache2.txt │ ├── values-ru │ └── strings.xml │ ├── values-tr │ └── strings.xml │ ├── values-w820dp │ └── dimens.xml │ ├── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ ├── styles.xml │ ├── timings.xml │ └── typography.xml │ └── xml │ └── file_paths.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── sodium ├── include ├── sodium.h └── sodium │ ├── core.h │ ├── crypto_aead_aes256gcm.h │ ├── crypto_aead_chacha20poly1305.h │ ├── crypto_aead_xchacha20poly1305.h │ ├── crypto_auth.h │ ├── crypto_auth_hmacsha256.h │ ├── crypto_auth_hmacsha512.h │ ├── crypto_auth_hmacsha512256.h │ ├── crypto_box.h │ ├── crypto_box_curve25519xchacha20poly1305.h │ ├── crypto_box_curve25519xsalsa20poly1305.h │ ├── crypto_core_ed25519.h │ ├── crypto_core_hchacha20.h │ ├── crypto_core_hsalsa20.h │ ├── crypto_core_ristretto255.h │ ├── crypto_core_salsa20.h │ ├── crypto_core_salsa2012.h │ ├── crypto_core_salsa208.h │ ├── crypto_generichash.h │ ├── crypto_generichash_blake2b.h │ ├── crypto_hash.h │ ├── crypto_hash_sha256.h │ ├── crypto_hash_sha512.h │ ├── crypto_kdf.h │ ├── crypto_kdf_blake2b.h │ ├── crypto_kx.h │ ├── crypto_onetimeauth.h │ ├── crypto_onetimeauth_poly1305.h │ ├── crypto_pwhash.h │ ├── crypto_pwhash_argon2i.h │ ├── crypto_pwhash_argon2id.h │ ├── crypto_pwhash_scryptsalsa208sha256.h │ ├── crypto_scalarmult.h │ ├── crypto_scalarmult_curve25519.h │ ├── crypto_scalarmult_ed25519.h │ ├── crypto_scalarmult_ristretto255.h │ ├── crypto_secretbox.h │ ├── crypto_secretbox_xchacha20poly1305.h │ ├── crypto_secretbox_xsalsa20poly1305.h │ ├── crypto_secretstream_xchacha20poly1305.h │ ├── crypto_shorthash.h │ ├── crypto_shorthash_siphash24.h │ ├── crypto_sign.h │ ├── crypto_sign_ed25519.h │ ├── crypto_sign_edwards25519sha512batch.h │ ├── crypto_stream.h │ ├── crypto_stream_chacha20.h │ ├── crypto_stream_salsa20.h │ ├── crypto_stream_salsa2012.h │ ├── crypto_stream_salsa208.h │ ├── crypto_stream_xchacha20.h │ ├── crypto_stream_xsalsa20.h │ ├── crypto_verify_16.h │ ├── crypto_verify_32.h │ ├── crypto_verify_64.h │ ├── export.h │ ├── randombytes.h │ ├── randombytes_internal_random.h │ ├── randombytes_sysrandom.h │ ├── runtime.h │ ├── utils.h │ └── version.h └── lib ├── arm64-v8a └── libsodium.so ├── armeabi-v7a └── libsodium.so ├── x86 └── libsodium.so └── x86_64 └── libsodium.so /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | local.properties 4 | .DS_Store 5 | /build 6 | /captures 7 | .externalNativeBuild 8 | /app/externalNativeBuild 9 | google-services.json 10 | app/src/main/res/values/secrets.xml 11 | app/src/debug/res/values/secrets.xml 12 | .cxx/ 13 | .stignore 14 | 15 | 16 | .idea/caches/ 17 | .idea/libraries/ 18 | .idea/shelf/ 19 | .idea/workspace.xml 20 | .idea/tasks.xml 21 | .idea/.name 22 | .idea/compiler.xml 23 | .idea/copyright/profiles_settings.xml 24 | .idea/encodings.xml 25 | .idea/misc.xml 26 | .idea/modules.xml 27 | .idea/scopes/scope_settings.xml 28 | .idea/dictionaries 29 | .idea/vcs.xml 30 | .idea/jsLibraryMappings.xml 31 | .idea/datasources.xml 32 | .idea/dataSources.ids 33 | .idea/sqlDataSources.xml 34 | .idea/dynamic.xml 35 | .idea/uiDesigner.xml 36 | .idea/assetWizardSettings.xml 37 | .idea/gradle.xml 38 | .idea/jarRepositories.xml 39 | .idea/navEditor.xml -------------------------------------------------------------------------------- /.idea/AndroidProjectSystem.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/deploymentTargetDropDown.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /.idea/deploymentTargetSelector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | 34 | 35 | 39 | 40 | 44 | 45 | -------------------------------------------------------------------------------- /.idea/migrations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 17 | -------------------------------------------------------------------------------- /.idea/studiobot.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Zood Location Android 2 | 3 | Zood Location is an easy to use location sharing app leveraging end-to-end encryption. 4 | 5 | Features 6 | * Easy to use interface for sharing your location with your family or close friends. 7 | * End to end encryption 8 | * Username based accounts 9 | * Convenient 'timed shares' for temporarily sharing your location with someone that is not a friend via a link. 10 | 11 | Currently available on the Play Store, and F-Droid via the [IzzyOnDroid repo](https://apt.izzysoft.de/fdroid/). 12 | 13 | Get it on Google Play 14 | Get it on IzzyOnDroid 15 | 16 | ## License 17 | 18 | Copyright 2020 Arash Payan 19 | 20 | Licensed under the AGPLv3: https://www.gnu.org/licenses/agpl-3.0.en.html 21 | 22 | Zood is a trademark of Tangled Wires, LLC
23 | Google Play and the Google Play logo are trademarks of Google Inc. 24 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Sets the minimum version of CMake required to build the native 2 | # library. You should either keep the default value or only pass a 3 | # value of 3.4.0 or lower. 4 | 5 | cmake_minimum_required(VERSION 3.4.1) 6 | 7 | # store the path to the sodium library in a variable 8 | set(sodium-dir ${CMAKE_CURRENT_SOURCE_DIR}/../sodium) 9 | 10 | add_library(sodium SHARED IMPORTED) 11 | set_property( TARGET sodium 12 | PROPERTY IMPORTED_LOCATION 13 | # Provides the path to the appropriate libsodium.so 14 | ${sodium-dir}/lib/${ANDROID_ABI}/libsodium.so) 15 | 16 | # Creates and names a library, sets it as either STATIC 17 | # or SHARED, and provides the relative paths to its source code. 18 | # You can define multiple libraries, and CMake builds it for you. 19 | # Gradle automatically packages shared libraries with your APK. 20 | 21 | add_library( # Sets the name of the library. 22 | native-lib 23 | 24 | # Sets the library as a shared library. 25 | SHARED 26 | 27 | # Provides a relative path to your source file(s). 28 | # Associated headers in the same location as their source 29 | # file are automatically included. 30 | src/main/cpp/sodium.c) 31 | 32 | target_include_directories(native-lib PRIVATE 33 | ${sodium-dir}/include) 34 | 35 | target_link_libraries(native-lib android sodium log) 36 | 37 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/arash/apps/android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # okio (pulled in from retrofit2) 20 | -dontwarn okio.** 21 | # retrofit2 22 | -dontwarn retrofit2.Platform$Java8 23 | 24 | # Don't minify any zood code 25 | -keep class io.pijun.george.** { *; } 26 | -keep class xyz.zood.george.** { *; } 27 | 28 | # Inner class protection 29 | -keep class io.pijun.george.*$* { *; } 30 | -keep class xyz.zood.george.*$* { *; } 31 | 32 | # For Android-Image-Croper library 33 | -keep class androidx.appcompat.widget.** { *; } 34 | -keep class com.google.firebase.messaging.FirebaseMessagingService { *; } -------------------------------------------------------------------------------- /app/src/androidTest/java/xyz/zood/george/SafetyNumberTest.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george; 2 | 3 | import androidx.test.ext.junit.runners.AndroidJUnit4; 4 | 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | 8 | import io.pijun.george.Constants; 9 | 10 | import static org.junit.Assert.assertEquals; 11 | 12 | @RunWith(AndroidJUnit4.class) 13 | public class SafetyNumberTest { 14 | 15 | @Test 16 | public void testTwoBytes() { 17 | String expected = "46628"; 18 | // binary: 1011011000100100 19 | 20 | byte[] bytes = new byte[]{(byte)182, (byte)36}; 21 | String actual = SafetyNumber.toSafetyNumber(bytes, 1, " "); 22 | assertEquals(expected, actual); 23 | } 24 | 25 | @Test 26 | public void testLeadingZero() { 27 | String expected = "05301"; 28 | // binary: 0001010010110101 29 | 30 | byte[] bytes = new byte[]{(byte)20, (byte)181}; 31 | String actual = SafetyNumber.toSafetyNumber(bytes, 1, " "); 32 | assertEquals(expected, actual); 33 | } 34 | 35 | @Test 36 | public void testFourBytesTwoCols() { 37 | String expected = "46628 05301"; 38 | byte[] bytes = new byte[]{(byte)182, (byte)36, (byte)20, (byte)181}; 39 | String actual = SafetyNumber.toSafetyNumber(bytes, 2, " "); 40 | assertEquals(expected, actual); 41 | } 42 | 43 | @Test 44 | public void testFourBytesOneCol() { 45 | String expected = "46628\n05301"; 46 | byte[] bytes = new byte[]{(byte)182, (byte)36, (byte)20, (byte)181}; 47 | String actual = SafetyNumber.toSafetyNumber(bytes, 1, " "); 48 | assertEquals(expected, actual); 49 | } 50 | 51 | @Test 52 | public void test32BytesFourCols() { 53 | String expected = "28789 29728 28526 08308\n26725 08308 25964 27753\n25900 08276 20256 21576\n17696 16962 17185 08481"; 54 | byte[] bytes = "put on the tellie, TO THE BBC!!!".getBytes(Constants.utf8); 55 | String actual = SafetyNumber.toSafetyNumber(bytes, 4, " "); 56 | assertEquals(expected, actual); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/java/com/squareup/picasso/PicassoTools.java: -------------------------------------------------------------------------------- 1 | package com.squareup.picasso; 2 | 3 | public class PicassoTools { 4 | public static void clearCache(Picasso p) { 5 | p.cache.clear(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/Battery.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.content.IntentFilter; 6 | import android.os.BatteryManager; 7 | 8 | import androidx.annotation.CheckResult; 9 | import androidx.annotation.NonNull; 10 | 11 | class Battery { 12 | 13 | static class State { 14 | int level = -1; 15 | boolean isCharging; 16 | 17 | private State() { 18 | } 19 | } 20 | 21 | @NonNull 22 | @CheckResult 23 | static State getState(Context context) { 24 | State state = new State(); 25 | 26 | IntentFilter filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); 27 | Intent status = context.registerReceiver(null, filter); 28 | if (status == null) { 29 | return state; 30 | } 31 | 32 | state.level = status.getIntExtra(BatteryManager.EXTRA_LEVEL, -1); 33 | int chargingState = status.getIntExtra(BatteryManager.EXTRA_STATUS, -1); 34 | state.isCharging = chargingState == BatteryManager.BATTERY_STATUS_CHARGING || 35 | chargingState == BatteryManager.BATTERY_STATUS_FULL; 36 | 37 | return state; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/CloudLogger.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george; 2 | 3 | public class CloudLogger { 4 | 5 | public static void log(Throwable t) { 6 | L.w(t.getLocalizedMessage(), t); 7 | } 8 | 9 | public static void log(String msg) { 10 | L.w(msg); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/Config.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george; 2 | 3 | public class Config { 4 | 5 | public static String apiAddress() { 6 | return "api.zood.xyz"; 7 | } 8 | 9 | private static boolean apiSecure() { 10 | return true; 11 | } 12 | 13 | public static String httpScheme() { 14 | if (apiSecure()) { 15 | return "https"; 16 | } else { 17 | return "http"; 18 | } 19 | } 20 | 21 | public static String wsScheme() { 22 | if (apiSecure()) { 23 | return "wss"; 24 | } else { 25 | return "ws"; 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/Constants.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george; 2 | 3 | import java.nio.charset.Charset; 4 | import java.nio.charset.StandardCharsets; 5 | 6 | public class Constants { 7 | 8 | public static final int DROP_BOX_ID_LENGTH = 16; 9 | public static final int USER_ID_LENGTH = 16; 10 | public static final int PUBLIC_KEY_LENGTH = 32; 11 | public static final int PASSWORD_TEXT_MIN_LENGTH = 6; 12 | public static final int DEVICE_ID_SIZE = 8; 13 | 14 | public static final int DEFAULT_ZOOM_LEVEL = 15; 15 | public static final Charset utf8 = StandardCharsets.UTF_8; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/Hex.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george; 2 | 3 | public class Hex { 4 | 5 | final private static char[] sHexChars = "0123456789abcdef".toCharArray(); 6 | public static String toHexString(byte[] bytes) { 7 | if (bytes == null) { 8 | return ""; 9 | } 10 | char[] hex = new char[bytes.length * 2]; 11 | for (int i=0; i>> 4]; 14 | hex[i*2+1] = sHexChars[val & 0x0F]; 15 | } 16 | return new String(hex); 17 | } 18 | 19 | public static byte[] toBytes(String hex) { 20 | int len = hex.length(); 21 | if (len % 2 != 0) { 22 | return null; 23 | } 24 | byte[] data = new byte[len / 2]; 25 | for (int i=0; i, JsonDeserializer { 16 | @Override 17 | public byte[] deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { 18 | return Base64.decode(json.getAsString(), Base64.NO_WRAP); 19 | } 20 | 21 | @Override 22 | public JsonElement serialize(byte[] src, Type typeOfSrc, JsonSerializationContext context) { 23 | return new JsonPrimitive(Base64.encodeToString(src, Base64.NO_WRAP)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/api/adapter/CommTypeAdapter.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.api.adapter; 2 | 3 | import com.google.gson.JsonDeserializationContext; 4 | import com.google.gson.JsonDeserializer; 5 | import com.google.gson.JsonElement; 6 | import com.google.gson.JsonParseException; 7 | import com.google.gson.JsonPrimitive; 8 | import com.google.gson.JsonSerializationContext; 9 | import com.google.gson.JsonSerializer; 10 | 11 | import java.lang.reflect.Type; 12 | 13 | import io.pijun.george.api.CommType; 14 | 15 | public class CommTypeAdapter implements JsonSerializer, JsonDeserializer { 16 | @Override 17 | public CommType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { 18 | return CommType.get(json.getAsString()); 19 | } 20 | 21 | @Override 22 | public JsonElement serialize(CommType src, Type typeOfSrc, JsonSerializationContext context) { 23 | return new JsonPrimitive(src.val); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/api/locationiq/LatLng.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.api.locationiq; 2 | 3 | public class LatLng { 4 | final double lat; 5 | final double lng; 6 | 7 | LatLng(double lat, double lng) { 8 | this.lat = lat; 9 | this.lng = lng; 10 | } 11 | 12 | @SuppressWarnings("RedundantIfStatement") 13 | @Override 14 | public boolean equals(Object o) { 15 | if (this == o) return true; 16 | if (o == null || getClass() != o.getClass()) return false; 17 | 18 | LatLng latLng = (LatLng) o; 19 | 20 | if (Double.compare(latLng.lat, lat) != 0) return false; 21 | if (Double.compare(latLng.lng, lng) != 0) return false; 22 | 23 | return true; 24 | } 25 | 26 | @Override 27 | public int hashCode() { 28 | int result; 29 | long temp; 30 | temp = Double.doubleToLongBits(lat); 31 | result = (int) (temp ^ (temp >>> 32)); 32 | temp = Double.doubleToLongBits(lng); 33 | result = 31 * result + (int) (temp ^ (temp >>> 32)); 34 | return result; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/api/locationiq/LocationIQAPI.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.api.locationiq; 2 | 3 | import okhttp3.ResponseBody; 4 | import retrofit2.Call; 5 | import retrofit2.http.GET; 6 | import retrofit2.http.Query; 7 | 8 | public interface LocationIQAPI { 9 | 10 | @GET("reverse.php") 11 | Call getReverseGeocoding(@Query("lat") String lat, @Query("lon") String lon); 12 | 13 | @GET("reverse.php") 14 | Call getReverseGeocoding2(@Query("lat") String lat, @Query("lon") String lon); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/api/locationiq/RevGeocoding.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.api.locationiq; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | public class RevGeocoding { 6 | // String placeId; 7 | Address address; 8 | 9 | public static class Address { 10 | String houseNumber; 11 | String road; 12 | String neighbourhood; 13 | String suburb; 14 | String city; 15 | String county; 16 | String state; 17 | // String postcode; 18 | String country; 19 | // String countryCode; 20 | } 21 | 22 | @NonNull 23 | public String getAddress() { 24 | if (address.houseNumber != null && address.road != null && address.city != null) { 25 | return String.format("%s %s, %s", address.houseNumber, address.road, address.city); 26 | } else if (address.road != null && address.city != null) { 27 | return String.format("%s, %s", address.road, address.city); 28 | } else if (address.city != null && address.county != null) { 29 | return String.format("%s, %s", address.city, address.county); 30 | } else if (address.city != null && address.state != null) { 31 | return String.format("%s, %s", address.city, address.state); 32 | } 33 | 34 | return getArea(); 35 | } 36 | 37 | @NonNull 38 | public String getArea() { 39 | if (address.neighbourhood != null) { 40 | return address.neighbourhood; 41 | } else if (address.suburb != null) { 42 | return address.suburb; 43 | } else if (address.city != null) { 44 | return address.city; 45 | } else if (address.county != null) { 46 | return address.county; 47 | } else if (address.state != null) { 48 | return address.state; 49 | } else if (address.country != null) { 50 | return address.country; 51 | } 52 | 53 | return ""; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/api/task/AddFcmTokenTask.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.api.task; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import java.util.Map; 6 | 7 | public class AddFcmTokenTask extends OscarTask { 8 | public static final String NAME = "add_fcm_token"; 9 | public Map body; 10 | 11 | public AddFcmTokenTask(String accessToken) { 12 | super(NAME, accessToken); 13 | } 14 | 15 | @NonNull 16 | @Override 17 | public String toString() { 18 | return "AddFcmTokenTask{" + 19 | "body=" + body + 20 | '}'; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/api/task/DeleteFcmTokenTask.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.api.task; 2 | 3 | public class DeleteFcmTokenTask extends OscarTask { 4 | public static final String NAME = "delete_fcm_token"; 5 | public String fcmToken; 6 | 7 | public DeleteFcmTokenTask(String accessToken) { 8 | super(NAME, accessToken); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/api/task/DeleteMessageTask.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.api.task; 2 | 3 | public class DeleteMessageTask extends OscarTask { 4 | public static final String NAME = "delete_message"; 5 | public long messageId; 6 | 7 | public DeleteMessageTask(String accessToken) { 8 | super(NAME, accessToken); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/api/task/DropPackageTask.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.api.task; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import io.pijun.george.crypto.EncryptedData; 6 | 7 | public class DropPackageTask extends OscarTask { 8 | public static final String NAME = "drop_package"; 9 | public String hexBoxId; 10 | public EncryptedData pkg; 11 | 12 | public DropPackageTask(String accessToken) { 13 | super(NAME, accessToken); 14 | } 15 | 16 | @NonNull 17 | @Override 18 | public String toString() { 19 | return "DropPackageTask{" + 20 | "hexBoxId='" + hexBoxId + '\'' + 21 | ", pkg=" + pkg + 22 | '}'; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/api/task/OscarTask.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.api.task; 2 | 3 | public abstract class OscarTask { 4 | public final String apiMethod; 5 | public final String accessToken; 6 | 7 | public OscarTask(String method, String accessToken) { 8 | this.apiMethod = method; 9 | this.accessToken = accessToken; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/api/task/SendMessageTask.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.api.task; 2 | 3 | import androidx.annotation.NonNull; 4 | import io.pijun.george.crypto.EncryptedData; 5 | 6 | public class SendMessageTask extends OscarTask { 7 | public static final String NAME = "send_message"; 8 | public String hexUserId; 9 | public EncryptedData message; 10 | public boolean urgent; 11 | public boolean isTransient; 12 | 13 | public SendMessageTask(@NonNull String accessToken) { 14 | super(NAME, accessToken); 15 | } 16 | 17 | @Override 18 | @NonNull 19 | public String toString() { 20 | return "SendMessageTask{" + 21 | "hexUserId='" + hexUserId + '\'' + 22 | ", message=" + message + 23 | ", urgent=" + urgent + 24 | ", transient=" + isTransient + 25 | '}'; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/crypto/EncryptedData.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.crypto; 2 | 3 | import androidx.annotation.Keep; 4 | import androidx.annotation.NonNull; 5 | 6 | import io.pijun.george.Hex; 7 | 8 | /** 9 | * We have to manually specify @Keep here because EncryptedData objects 10 | * get constructed from JNI. 11 | */ 12 | @Keep 13 | public class EncryptedData { 14 | 15 | public byte[] cipherText; 16 | public byte[] nonce; 17 | 18 | @NonNull 19 | @Override 20 | public String toString() { 21 | return "EncryptedData:\n" + "cipherText: " + 22 | Hex.toHexString(cipherText) + 23 | '\n' + 24 | "nonce: " + 25 | Hex.toHexString(nonce); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/crypto/KeyPair.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.crypto; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | import androidx.annotation.NonNull; 7 | 8 | import java.util.Arrays; 9 | import java.util.Objects; 10 | 11 | import io.pijun.george.Hex; 12 | 13 | public class KeyPair implements Parcelable { 14 | 15 | public byte[] publicKey; 16 | public byte[] secretKey; 17 | 18 | @Override 19 | public boolean equals(Object o) { 20 | if (this == o) return true; 21 | if (o == null || getClass() != o.getClass()) return false; 22 | KeyPair keyPair = (KeyPair) o; 23 | return Arrays.equals(publicKey, keyPair.publicKey) && 24 | Arrays.equals(secretKey, keyPair.secretKey); 25 | } 26 | 27 | @Override 28 | public int hashCode() { 29 | return Objects.hash(publicKey, secretKey); 30 | } 31 | 32 | @NonNull 33 | @Override 34 | public String toString() { 35 | return "PubKey: " + 36 | Hex.toHexString(publicKey) + 37 | '\n' + 38 | "SecKey: " + 39 | Hex.toHexString(secretKey); 40 | } 41 | 42 | //region Parcelable 43 | 44 | @Override 45 | public int describeContents() { 46 | return 0; 47 | } 48 | 49 | @Override 50 | public void writeToParcel(Parcel out, int flags) { 51 | out.writeByteArray(publicKey); 52 | out.writeByteArray(secretKey); 53 | } 54 | 55 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { 56 | @Override 57 | public KeyPair createFromParcel(Parcel in) { 58 | KeyPair kp = new KeyPair(); 59 | kp.publicKey = in.createByteArray(); 60 | kp.secretKey = in.createByteArray(); 61 | return kp; 62 | } 63 | 64 | @Override 65 | public KeyPair[] newArray(int size) { 66 | return new KeyPair[size]; 67 | } 68 | }; 69 | 70 | //endregion 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/database/FriendLocation.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.database; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.annotation.Nullable; 5 | 6 | public class FriendLocation { 7 | 8 | public final long friendId; 9 | public final double latitude; 10 | public final double longitude; 11 | public final long time; 12 | public final Float accuracy; 13 | public final Float speed; 14 | // The person's bearing, in degrees 15 | public final Float bearing; 16 | public final MovementType movement; 17 | public final Integer batteryLevel; 18 | public final Boolean batteryCharging; 19 | 20 | FriendLocation(long id, double lat, double lng, long time, Float accuracy, Float speed, Float bearing, MovementType movement, Integer batteryLevel, @Nullable Boolean batteryCharging) { 21 | this.friendId = id; 22 | this.latitude = lat; 23 | this.longitude = lng; 24 | this.time = time; 25 | this.accuracy = accuracy; 26 | this.speed = speed; 27 | this.bearing = bearing; 28 | this.movement = movement; 29 | this.batteryLevel = batteryLevel; 30 | this.batteryCharging = batteryCharging; 31 | } 32 | 33 | public float getAccuracyRadiusInPixels(double zoomLevel) { 34 | // https://groups.google.com/g/google-maps-js-api-v3/c/hDRO4oHVSeM/m/osOYQYXg2oUJ 35 | double metersPerPixel = 156543.03392 * Math.cos(latitude * Math.PI / 180) / Math.pow(2, zoomLevel); 36 | return (float) (accuracy / metersPerPixel); 37 | } 38 | 39 | @Override 40 | @NonNull 41 | public String toString() { 42 | return "FriendLocation{" + 43 | "friendId=" + friendId + 44 | ", latitude=" + latitude + 45 | ", longitude=" + longitude + 46 | ", time=" + time + 47 | ", accuracy=" + accuracy + 48 | ", speed=" + speed + 49 | ", bearing=" + bearing + 50 | ", movement='" + movement + '\'' + 51 | ", batteryLevel=" + batteryLevel + 52 | ", batteryCharging=" + batteryCharging + 53 | '}'; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/database/FriendRecord.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.database; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import io.pijun.george.Hex; 6 | 7 | public class FriendRecord { 8 | 9 | public UserRecord user; 10 | public long id; 11 | public long userId; 12 | public byte[] sendingBoxId; 13 | public byte[] receivingBoxId; 14 | 15 | @Override 16 | public boolean equals(Object o) { 17 | if (this == o) return true; 18 | if (o == null || getClass() != o.getClass()) return false; 19 | 20 | FriendRecord that = (FriendRecord) o; 21 | 22 | return id == that.id; 23 | } 24 | 25 | @Override 26 | public int hashCode() { 27 | return (int) (id ^ (id >>> 32)); 28 | } 29 | 30 | @NonNull 31 | @Override 32 | public String toString() { 33 | return "FriendRecord{" + 34 | "id=" + id + 35 | ", userId=" + userId + 36 | ", sendingBoxId=" + Hex.toHexString(sendingBoxId) + 37 | ", receivingBoxId=" + Hex.toHexString(receivingBoxId) + 38 | '}'; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/database/LimitedShare.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.database; 2 | 3 | public class LimitedShare { 4 | 5 | public long id; 6 | public byte[] publicKey; 7 | public byte[] sendingBoxId; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/database/MovementType.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.database; 2 | 3 | import com.google.android.gms.location.DetectedActivity; 4 | 5 | import androidx.annotation.NonNull; 6 | import androidx.annotation.Nullable; 7 | 8 | public enum MovementType { 9 | Vehicle("vehicle"), 10 | Bicycle("bicycle"), 11 | OnFoot("on_foot"), 12 | Running("running"), 13 | Stationary("stationary"), 14 | Tilting("tilting"), 15 | Walking("walking"), 16 | Unknown("unknown"); 17 | 18 | public final String val; 19 | 20 | MovementType(@NonNull String val) { 21 | this.val = val; 22 | } 23 | 24 | @NonNull 25 | public static MovementType get(@Nullable String val) { 26 | if (val == null) { 27 | return Unknown; 28 | } 29 | 30 | for (MovementType mt : values()) { 31 | if (mt.val.equals(val)) { 32 | return mt; 33 | } 34 | } 35 | 36 | return Unknown; 37 | } 38 | 39 | @NonNull 40 | public static MovementType getByDetectedActivity(int activityId) { 41 | switch (activityId) { 42 | case DetectedActivity.IN_VEHICLE: 43 | return Vehicle; 44 | case DetectedActivity.ON_BICYCLE: 45 | return Bicycle; 46 | case DetectedActivity.ON_FOOT: 47 | return OnFoot; 48 | case DetectedActivity.RUNNING: 49 | return Running; 50 | case DetectedActivity.STILL: 51 | return Stationary; 52 | case DetectedActivity.TILTING: 53 | return Tilting; 54 | case DetectedActivity.WALKING: 55 | return Walking; 56 | default: 57 | return Unknown; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/database/Snapshot.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.database; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.annotation.Nullable; 5 | 6 | import java.io.ByteArrayInputStream; 7 | import java.io.InputStreamReader; 8 | import java.util.ArrayList; 9 | 10 | import io.pijun.george.CloudLogger; 11 | import io.pijun.george.Constants; 12 | import io.pijun.george.api.OscarClient; 13 | 14 | public class Snapshot { 15 | 16 | public static class Friend { 17 | public byte[] userId; 18 | public byte[] sendingBoxId; 19 | public byte[] receivingBoxId; 20 | } 21 | 22 | public static class User { 23 | public byte[] userId; 24 | public byte[] publicKey; 25 | public String username; 26 | } 27 | 28 | @NonNull 29 | public final ArrayList friends = new ArrayList<>(); 30 | @NonNull 31 | public final ArrayList users = new ArrayList<>(); 32 | @Nullable 33 | public byte[] avatar; 34 | 35 | public int schemaVersion; 36 | public long timestamp; 37 | 38 | public byte[] toJson() { 39 | String s = OscarClient.sGson.toJson(this); 40 | return s.getBytes(Constants.utf8); 41 | } 42 | 43 | @Nullable 44 | public static Snapshot fromJson(@NonNull byte[] bytes) { 45 | InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream(bytes)); 46 | Snapshot snapshot; 47 | try { 48 | snapshot = OscarClient.sGson.fromJson(isr, Snapshot.class); 49 | } catch (Throwable t) { 50 | CloudLogger.log(t); 51 | return null; 52 | } 53 | return snapshot; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/database/UserRecord.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.database; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import io.pijun.george.Hex; 6 | 7 | public class UserRecord { 8 | 9 | public long id; 10 | public byte[] userId; 11 | public String username; 12 | public byte[] publicKey; 13 | 14 | @NonNull 15 | @Override 16 | public String toString() { 17 | return "UserRecord{" + 18 | "id=" + id + 19 | ", userId=" + Hex.toHexString(userId) + 20 | ", username='" + username + '\'' + 21 | ", publicKey=" + Hex.toHexString(publicKey) + 22 | '}'; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/network/Network.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.network; 2 | 3 | import android.content.Context; 4 | import android.net.ConnectivityManager; 5 | 6 | import androidx.annotation.NonNull; 7 | 8 | import io.pijun.george.L; 9 | 10 | public class Network { 11 | 12 | /** 13 | * Determine whether background data usage is restricted for this app. 14 | * @param context A Context object 15 | * @return true if background data is restricted. false, otherwise. 16 | */ 17 | public static boolean isBackgroundDataRestricted(@NonNull Context context) { 18 | ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 19 | if (connMgr == null) { 20 | L.w("ConnectivityManager was null!"); 21 | return false; 22 | } 23 | 24 | int status = connMgr.getRestrictBackgroundStatus(); 25 | return status == ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/service/BootReceiver.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.service; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.BroadcastReceiver; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | 8 | import io.pijun.george.L; 9 | 10 | public class BootReceiver extends BroadcastReceiver { 11 | @SuppressLint("UnsafeProtectedBroadcastReceiver") 12 | @Override 13 | public void onReceive(Context context, Intent intent) { 14 | L.i("BootReceiver.onReceive"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/view/MyLocationView.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.view; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.Canvas; 6 | import android.graphics.Color; 7 | import android.graphics.Paint; 8 | 9 | import androidx.annotation.NonNull; 10 | import androidx.core.content.ContextCompat; 11 | import io.pijun.george.Utils; 12 | import xyz.zood.george.R; 13 | 14 | public class MyLocationView { 15 | 16 | public static Bitmap getBitmap(@NonNull Context ctx) { 17 | int size = Utils.dpsToPix(ctx, 24); 18 | Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); 19 | Canvas canvas = new Canvas(bitmap); 20 | float cx = size/2.0f; 21 | float cy = size/2.0f; 22 | 23 | Paint white = new Paint(); 24 | white.setStyle(Paint.Style.FILL); 25 | white.setColor(Color.WHITE); 26 | white.setAntiAlias(true); 27 | white.setShadowLayer(3, 0, 1, 0x33000000); 28 | float whiteRadius = Utils.dpsToPix(ctx, 24)/2.0f; 29 | canvas.drawCircle(cx, cy, whiteRadius, white); 30 | 31 | Paint green = new Paint(); 32 | green.setStyle(Paint.Style.FILL); 33 | green.setColor(ContextCompat.getColor(ctx, R.color.zood_blue)); 34 | green.setAntiAlias(true); 35 | float greenRadius = Utils.dpsToPix(ctx, 10)/2.0f; 36 | canvas.drawCircle(cx, cy, greenRadius, green); 37 | 38 | return bitmap; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/view/ProfileListItemViewHolder.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.view; 2 | 3 | import android.view.View; 4 | import android.widget.TextView; 5 | 6 | import androidx.recyclerview.widget.RecyclerView; 7 | 8 | import xyz.zood.george.R; 9 | 10 | public class ProfileListItemViewHolder extends RecyclerView.ViewHolder { 11 | 12 | public final AvatarView avatar; 13 | public final TextView username; 14 | 15 | public ProfileListItemViewHolder(View itemView) { 16 | super(itemView); 17 | 18 | this.avatar = itemView.findViewById(R.id.avatar); 19 | this.username = itemView.findViewById(R.id.username); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/io/pijun/george/view/RecyclerViewAdapterItem.java: -------------------------------------------------------------------------------- 1 | package io.pijun.george.view; 2 | 3 | import androidx.annotation.LayoutRes; 4 | 5 | public class RecyclerViewAdapterItem { 6 | 7 | @LayoutRes 8 | public final int viewType; 9 | public final long id; 10 | 11 | public RecyclerViewAdapterItem(@LayoutRes int viewType, long id) { 12 | this.viewType = viewType; 13 | this.id = id; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/AppInForegroundObserver.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.lifecycle.DefaultLifecycleObserver; 5 | import androidx.lifecycle.LifecycleOwner; 6 | 7 | import io.pijun.george.App; 8 | 9 | public class AppInForegroundObserver implements DefaultLifecycleObserver { 10 | 11 | @Override 12 | public void onStart(@NonNull LifecycleOwner owner) { 13 | App.isInForeground = true; 14 | } 15 | 16 | @Override 17 | public void onStop(@NonNull LifecycleOwner owner) { 18 | App.isInForeground = false; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/BackPressInterceptor.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george; 2 | 3 | public interface BackPressInterceptor { 4 | 5 | /** 6 | * Method that an activities fragments can implement to receive notifications about user 7 | * back button presses. The interceptor should return true when it consumes the back 8 | * press, and false otherwise. 9 | * @return true if the back press was consume; false otherwise. 10 | */ 11 | boolean onBackPressed(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/BackPressNotifier.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george; 2 | 3 | import androidx.annotation.Nullable; 4 | 5 | public interface BackPressNotifier { 6 | void setBackPressInterceptor(@Nullable BackPressInterceptor interceptor); 7 | } 8 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/LicensesFragment.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george; 2 | 3 | import android.os.Bundle; 4 | 5 | import androidx.annotation.NonNull; 6 | import androidx.fragment.app.Fragment; 7 | import androidx.fragment.app.FragmentManager; 8 | 9 | import android.text.util.Linkify; 10 | import android.util.Pair; 11 | import android.view.LayoutInflater; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | 15 | import io.pijun.george.L; 16 | import xyz.zood.george.databinding.FragmentLicensesBinding; 17 | 18 | public class LicensesFragment extends Fragment implements LibrariesAdapter.LibrariesAdapterListener { 19 | 20 | public LicensesFragment() {} 21 | 22 | public static LicensesFragment newInstance() { 23 | return new LicensesFragment(); 24 | } 25 | 26 | @Override 27 | public void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | } 30 | 31 | @Override 32 | public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 33 | FragmentLicensesBinding binding = FragmentLicensesBinding.inflate(inflater, container, false); 34 | binding.librariesList.setAdapter(new LibrariesAdapter(this)); 35 | binding.back.setOnClickListener(v -> getParentFragmentManager().popBackStack()); 36 | 37 | return binding.getRoot(); 38 | } 39 | 40 | //region LibrariesAdapterListener 41 | 42 | @Override 43 | public void onLibraryItemSelected(Pair libItem) { 44 | LicenseTextFragment f = LicenseTextFragment.newInstance(libItem.second); 45 | FragmentManager mgr = getParentFragmentManager(); 46 | mgr.beginTransaction() 47 | .setCustomAnimations(R.animator.new_enter_from_right, 48 | R.animator.new_exit_to_left, 49 | R.animator.new_enter_from_left, 50 | R.animator.new_exit_to_right) 51 | .replace(R.id.fragment_host, f) 52 | .addToBackStack(null) 53 | .commit(); 54 | } 55 | } -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/MapLibreMapLifecycleObserver.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.lifecycle.DefaultLifecycleObserver; 5 | import androidx.lifecycle.LifecycleOwner; 6 | 7 | import org.maplibre.android.maps.MapView; 8 | 9 | public class MapLibreMapLifecycleObserver implements DefaultLifecycleObserver { 10 | 11 | @NonNull private final MapView map; 12 | 13 | MapLibreMapLifecycleObserver(@NonNull MapView map) { 14 | this.map = map; 15 | } 16 | 17 | @Override 18 | public void onStart(@NonNull LifecycleOwner owner) { 19 | map.onStart(); 20 | } 21 | 22 | @Override 23 | public void onResume(@NonNull LifecycleOwner owner) { 24 | map.onResume(); 25 | } 26 | 27 | @Override 28 | public void onPause(@NonNull LifecycleOwner owner) { 29 | map.onPause(); 30 | } 31 | 32 | @Override 33 | public void onStop(@NonNull LifecycleOwner owner) { 34 | map.onStop(); 35 | } 36 | 37 | @Override 38 | public void onDestroy(@NonNull LifecycleOwner owner) { 39 | map.onDestroy(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/Permissions.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george; 2 | 3 | import android.Manifest; 4 | import android.content.Context; 5 | import android.content.pm.PackageManager; 6 | 7 | import androidx.annotation.AnyThread; 8 | import androidx.annotation.CheckResult; 9 | import androidx.annotation.NonNull; 10 | import androidx.core.content.ContextCompat; 11 | 12 | // Ugly method names because https://stackoverflow.com/a/36193309/211180 13 | public class Permissions { 14 | 15 | @SuppressWarnings("BooleanMethodIsAlwaysInverted") 16 | @AnyThread @CheckResult 17 | public static boolean checkBackgroundLocationPermission(@NonNull Context ctx) { 18 | return ContextCompat.checkSelfPermission(ctx, Manifest.permission.ACCESS_BACKGROUND_LOCATION) == PackageManager.PERMISSION_GRANTED; 19 | } 20 | 21 | @SuppressWarnings("BooleanMethodIsAlwaysInverted") 22 | @AnyThread @CheckResult 23 | public static boolean checkForegroundLocationPermission(@NonNull Context ctx) { 24 | for (String perm : getForegroundLocationPermissions()) { 25 | if (ContextCompat.checkSelfPermission(ctx, perm) != PackageManager.PERMISSION_GRANTED) { 26 | return false; 27 | } 28 | } 29 | 30 | return true; 31 | } 32 | 33 | @AnyThread @CheckResult 34 | public static boolean checkActivityRecognitionPermission(@NonNull Context ctx) { 35 | return ContextCompat.checkSelfPermission(ctx, Manifest.permission.ACTIVITY_RECOGNITION) == PackageManager.PERMISSION_GRANTED; 36 | } 37 | 38 | @NonNull @AnyThread @CheckResult 39 | public static String[] getActivityRecognitionPermissions() { 40 | return new String[]{Manifest.permission.ACTIVITY_RECOGNITION}; 41 | } 42 | 43 | @NonNull @AnyThread @CheckResult 44 | public static String[] getBackgroundLocationPermissions() { 45 | return new String[]{Manifest.permission.ACCESS_BACKGROUND_LOCATION}; 46 | } 47 | 48 | @NonNull @AnyThread @CheckResult 49 | public static String[] getForegroundLocationPermissions() { 50 | return new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/SafetyNumber.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george; 2 | 3 | import androidx.annotation.AnyThread; 4 | import androidx.annotation.CheckResult; 5 | import androidx.annotation.NonNull; 6 | 7 | import java.util.Locale; 8 | 9 | public class SafetyNumber { 10 | 11 | @NonNull @CheckResult @AnyThread 12 | public static String toSafetyNumber(@NonNull byte[] bytes, int columns, @NonNull String spacing) { 13 | if (bytes.length % 2 != 0) { 14 | throw new RuntimeException("Bytes count should be a multiple of 2"); 15 | } 16 | if (columns < 1) { 17 | throw new RuntimeException("Column count should be >= 1"); 18 | } 19 | 20 | int col = 0; 21 | StringBuilder sn = new StringBuilder(); 22 | for (int i=0; i= columns) { 29 | sn.append('\n'); 30 | col = 0; 31 | } else { 32 | sn.append(spacing); 33 | } 34 | } 35 | 36 | return sn.toString().trim(); 37 | } 38 | 39 | private static int toUnsignedInt(byte b) { 40 | return ((int) b) & 0xff; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/animation/LatLngEvaluator.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george.animation; 2 | 3 | import android.animation.TypeEvaluator; 4 | 5 | import org.maplibre.android.geometry.LatLng; 6 | 7 | public class LatLngEvaluator implements TypeEvaluator { 8 | @Override 9 | public LatLng evaluate(float fraction, LatLng startValue, LatLng endValue) { 10 | double lat = startValue.getLatitude() 11 | + ((endValue.getLatitude() - startValue.getLatitude()) * fraction); 12 | double lng = startValue.getLongitude() 13 | + ((endValue.getLongitude() - startValue.getLongitude()) * fraction); 14 | return new LatLng(lat, lng); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/animation/PointEvaluator.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george.animation; 2 | 3 | import android.animation.TypeEvaluator; 4 | 5 | import org.maplibre.geojson.Point; 6 | 7 | public class PointEvaluator implements TypeEvaluator { 8 | 9 | @Override 10 | public Point evaluate(float fraction, Point startValue, Point endValue) { 11 | double lat = startValue.latitude() 12 | + ((endValue.latitude() - startValue.latitude()) * fraction); 13 | double lng = startValue.longitude() 14 | + ((endValue.longitude() - startValue.longitude()) * fraction); 15 | return Point.fromLngLat(lng, lat); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/animation/PointGeoJsonSource.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george.animation; 2 | 3 | import android.animation.ObjectAnimator; 4 | import android.animation.ValueAnimator; 5 | 6 | import androidx.annotation.NonNull; 7 | 8 | import org.maplibre.android.style.sources.GeoJsonSource; 9 | import org.maplibre.geojson.Feature; 10 | import org.maplibre.geojson.Point; 11 | 12 | public class PointGeoJsonSource { 13 | 14 | @NonNull private final GeoJsonSource src; 15 | 16 | private PointGeoJsonSource(@NonNull GeoJsonSource src) { 17 | this.src = src; 18 | } 19 | 20 | public static void animateTo(@NonNull GeoJsonSource src, Point start, Point end) { 21 | PointGeoJsonSource pgjs = new PointGeoJsonSource(src); 22 | ValueAnimator ptAnimator = ObjectAnimator.ofObject(pgjs, "position", new PointEvaluator(), start, end); 23 | ptAnimator.setDuration(500); 24 | ptAnimator.start(); 25 | } 26 | 27 | public void setPosition(Point p) { 28 | src.setGeoJson(Feature.fromGeometry(p)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/animation/SymbolPosition.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george.animation; 2 | 3 | import android.animation.ObjectAnimator; 4 | import android.animation.ValueAnimator; 5 | 6 | import androidx.annotation.NonNull; 7 | 8 | import org.maplibre.android.geometry.LatLng; 9 | import org.maplibre.android.plugins.annotation.Symbol; 10 | import org.maplibre.android.plugins.annotation.SymbolManager; 11 | 12 | public class SymbolPosition { 13 | 14 | @NonNull 15 | private final SymbolManager sm; 16 | @NonNull private final Symbol s; 17 | 18 | private SymbolPosition(@NonNull SymbolManager sm, @NonNull Symbol s) { 19 | this.sm = sm; 20 | this.s = s; 21 | } 22 | 23 | public static void animateTo(@NonNull SymbolManager sm, @NonNull Symbol s, LatLng pos) { 24 | SymbolPosition sp = new SymbolPosition(sm, s); 25 | ValueAnimator posAnimator = ObjectAnimator.ofObject(sp, "position", new LatLngEvaluator(), s.getLatLng(), pos); 26 | posAnimator.setDuration(500); // 500 ms 27 | posAnimator.start(); 28 | } 29 | 30 | public LatLng getPosition() { 31 | return s.getLatLng(); 32 | } 33 | 34 | public void setPosition(LatLng ll) { 35 | s.setLatLng(ll); 36 | sm.update(s); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/notifier/ClientNotConnectedNotifier.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george.notifier; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.annotation.UiThread; 5 | import androidx.fragment.app.FragmentActivity; 6 | 7 | import io.pijun.george.Utils; 8 | import xyz.zood.george.R; 9 | import xyz.zood.george.widget.BannerView; 10 | 11 | public class ClientNotConnectedNotifier implements BannerView.ItemClickListener { 12 | 13 | @NonNull 14 | private final BannerView banner; 15 | @NonNull private final FragmentActivity activity; 16 | private static final int bannerItemId = 110348; 17 | 18 | public ClientNotConnectedNotifier(@NonNull FragmentActivity activity, @NonNull BannerView banner) { 19 | this.banner = banner; 20 | this.activity = activity; 21 | } 22 | 23 | @UiThread 24 | public void hide() { 25 | banner.removeItem(bannerItemId); 26 | } 27 | 28 | @Override 29 | public void onBannerItemClick(int id) { 30 | Utils.showAlert(activity, 0, R.string.unable_to_connect_msg, activity.getSupportFragmentManager()); 31 | } 32 | 33 | @UiThread 34 | public void show() { 35 | banner.addItem(activity.getString(R.string.unable_to_connect_to_zood_servers), activity.getString(R.string.info), bannerItemId, this); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/receiver/ScreenOnReceiver.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george.receiver; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | 7 | import androidx.core.content.ContextCompat; 8 | import io.pijun.george.L; 9 | import xyz.zood.george.service.ScreamerService; 10 | 11 | public class ScreenOnReceiver extends BroadcastReceiver { 12 | 13 | @Override 14 | public void onReceive(Context context, Intent intent) { 15 | L.i("ScreenOnReceiver.onReceive"); 16 | 17 | Intent i = ScreamerService.newStopIntent(context, false); 18 | ContextCompat.startForegroundService(context, i); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/time/HoursMinutesSeconds.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george.time; 2 | 3 | public class HoursMinutesSeconds { 4 | 5 | public final int hours; 6 | public final int minutes; 7 | public final int seconds; 8 | 9 | public HoursMinutesSeconds(long milliseconds) { 10 | int secs = (int)(milliseconds / 1000); 11 | hours = secs / 3600; 12 | int surplusSeconds = secs % 3600; 13 | minutes = surplusSeconds / 60; 14 | seconds = surplusSeconds % 60; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/viewmodels/Event.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george.viewmodels; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.annotation.Nullable; 5 | 6 | public class Event { 7 | 8 | private boolean handled; 9 | private final T value; 10 | 11 | public Event(@NonNull T value) { 12 | this.value = value; 13 | } 14 | 15 | @Nullable 16 | public T getEventIfNotHandled() { 17 | if (handled) { 18 | return null; 19 | } 20 | 21 | handled = true; 22 | return value; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/widget/AuthenticationProgressDialog.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george.widget; 2 | 3 | import android.os.Bundle; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.view.Window; 8 | 9 | import androidx.annotation.NonNull; 10 | import androidx.annotation.Nullable; 11 | import androidx.fragment.app.DialogFragment; 12 | 13 | import xyz.zood.george.R; 14 | 15 | public class AuthenticationProgressDialog extends DialogFragment { 16 | 17 | public AuthenticationProgressDialog() { 18 | setCancelable(false); 19 | } 20 | 21 | @Nullable 22 | @Override 23 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 24 | View view = inflater.inflate(R.layout.fragment_authentication_progress_dialog, container, false); 25 | 26 | // give the window rounded corners 27 | Window win = getDialog().getWindow(); 28 | if (win != null) { 29 | win.setBackgroundDrawableResource(R.drawable.rounded_background); 30 | } 31 | 32 | return view; 33 | } 34 | 35 | @Override 36 | public void onStart() { 37 | super.onStart(); 38 | 39 | // Because we used a custom background on onCreateView, we need to re-apply the layout size 40 | // This doesn't work if we do it in onCreateView 41 | Window win = getDialog().getWindow(); 42 | if (win != null) { 43 | win.setLayout((int)getResources().getDimension(R.dimen.dialog_width), ViewGroup.LayoutParams.WRAP_CONTENT); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/widget/SettingsListItemViewHolder.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george.widget; 2 | 3 | import android.view.View; 4 | 5 | import androidx.annotation.NonNull; 6 | import androidx.recyclerview.widget.RecyclerView; 7 | 8 | import com.google.android.material.textview.MaterialTextView; 9 | 10 | public class SettingsListItemViewHolder extends RecyclerView.ViewHolder { 11 | 12 | public final MaterialTextView textView; 13 | 14 | public SettingsListItemViewHolder(@NonNull View itemView) { 15 | super(itemView); 16 | 17 | this.textView = (MaterialTextView) itemView; 18 | } 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/widget/SlidableCL.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | 6 | import androidx.constraintlayout.widget.ConstraintLayout; 7 | 8 | @SuppressWarnings("unused") 9 | public class SlidableCL extends ConstraintLayout { 10 | public SlidableCL(Context context) { 11 | super(context); 12 | } 13 | 14 | public SlidableCL(Context context, AttributeSet attrs) { 15 | super(context, attrs); 16 | } 17 | 18 | public SlidableCL(Context context, AttributeSet attrs, int defStyleAttr) { 19 | super(context, attrs, defStyleAttr); 20 | } 21 | 22 | public float getXFraction() { 23 | final int width = getWidth(); 24 | if (width != 0) { 25 | return getX() / getWidth(); 26 | } 27 | return getX(); 28 | } 29 | 30 | public void setXFraction(float xFraction) { 31 | final int width = getWidth(); 32 | setX((width > 0) ? (xFraction * width) : -9999); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/zood/george/widget/SlidableScrollView.java: -------------------------------------------------------------------------------- 1 | package xyz.zood.george.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.ScrollView; 6 | 7 | @SuppressWarnings("unused") 8 | public class SlidableScrollView extends ScrollView { 9 | public SlidableScrollView(Context context) { 10 | super(context); 11 | } 12 | 13 | public SlidableScrollView(Context context, AttributeSet attrs) { 14 | super(context, attrs); 15 | } 16 | 17 | public SlidableScrollView(Context context, AttributeSet attrs, int defStyleAttr) { 18 | super(context, attrs, defStyleAttr); 19 | } 20 | 21 | public SlidableScrollView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 22 | super(context, attrs, defStyleAttr, defStyleRes); 23 | } 24 | 25 | public float getXFraction() { 26 | final int width = getWidth(); 27 | if (width != 0) { 28 | return getX() / getWidth(); 29 | } 30 | return getX(); 31 | } 32 | 33 | public void setXFraction(float xFraction) { 34 | final int width = getWidth(); 35 | setX((width > 0) ? (xFraction * width) : -9999); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/res/animator/fade_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/animator/fade_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/animator/new_enter_from_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | 11 | 12 | 13 | 14 | 19 | 24 | 25 | 26 | 27 | 32 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/animator/new_enter_from_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | 11 | 12 | 13 | 14 | 19 | 24 | 25 | 26 | 27 | 32 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/animator/new_exit_to_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | 11 | 12 | 13 | 14 | 19 | 24 | 25 | 26 | 27 | 32 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/animator/new_exit_to_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | 11 | 12 | 13 | 14 | 19 | 24 | 25 | 26 | 27 | 32 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/color/avatar_border.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/color/fab_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/color/my_location_fab_tint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/color/switch_thumb.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/color/switch_track.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/color/text_button_text_and_icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/color/timed_share_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/color/timed_share_fab_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/color/timed_share_fab_tint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/george_clooney.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/drawable-xxhdpi/george_clooney.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/location_logo_113dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/drawable-xxxhdpi/location_logo_113dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_add_circle_outline.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_arrow_back_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_check_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_chevron_left_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_clear_black_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_close_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_cloud.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_content_copy_black_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_info_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_location_on_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_my_location_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_outlined_exit_to_app_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_outlined_notifications_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_outlined_person_add_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_outlined_privacy_tip_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_pin.xml: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_position_service.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_refresh_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_refresh_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_remove_circle_outline.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_schedule_black_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_settings.xml: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_share_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_battery_20_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_battery_30_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_battery_50_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_battery_60_20dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_battery_80_20dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_battery_90_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_battery_charging_20_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_battery_charging_30_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_battery_charging_50_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_battery_charging_60_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_battery_charging_80_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_battery_charging_90_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_battery_charging_full_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_battery_full_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_bike_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_car_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_more_vert_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_navigation_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_person_add_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_settings_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sharp_walk_20dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_timed_share.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_timed_share_map_texture_off.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 14 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_timed_share_map_texture_on.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 14 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/invalid_user_icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/page_indicator.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/radial_button_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/rounded_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/font/montserrat.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 14 | 15 | 16 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/font/montserrat_bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/font/montserrat_bold.ttf -------------------------------------------------------------------------------- /app/src/main/res/font/montserrat_extra_bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/font/montserrat_extra_bold.ttf -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_log.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | 16 | 17 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/banner_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 22 | 31 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_authentication_progress_dialog.xml: -------------------------------------------------------------------------------- 1 | 6 | 19 | 20 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_friends_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_license_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/friends_bar_add_friend.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/friends_bar_divider.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/friends_bar_friend.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/friends_bar_margin.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/src/main/res/layout/library_list_item.xml: -------------------------------------------------------------------------------- 1 | 7 | 21 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/settings_list_item.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/src/main/res/menu/activity_log.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/menu/activity_safety_number.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/menu/info_panel_overflow.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/menu/profile_photo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-hdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-mdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | @color/zood_blue 4 | @color/zood_navy 5 | @color/zood_blue 6 | 7 | #4d34cc54 8 | #A0000000 9 | #3032b6f4 10 | 11 | #8ddfff 12 | #5cd1ff 13 | #09a8e6 14 | 15 | #805cd1ff 16 | 17 | #ff5d58 18 | #e41c16 19 | #b80c06 20 | 21 | #3c4466 22 | 23 | #f6921e 24 | 25 | #3cdd56 26 | 27 | #ffe422 28 | #46585e 29 | #8046585e 30 | 31 | #000000 32 | #333333 33 | #666666 34 | #999999 35 | #cccccc 36 | #e5e5e5 37 | #f2f2f2 38 | 39 | #252525 40 | #727272 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 1dp 6 | 2dp 7 | 4dp 8 | 8dp 9 | 10dp 10 | 12dp 11 | 16dp 12 | 24dp 13 | 28dp 14 | 32dp 15 | 36dp 16 | 40dp 17 | 42dp 18 | 45dp 19 | 48dp 20 | 64dp 21 | 96dp 22 | 56dp 23 | 100dp 24 | 280dp 25 | 26 | 64dp 27 | 28 | 15sp 29 | 19sp 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/values/timings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 400 4 | 200 5 | 6 | 0.95 7 | -------------------------------------------------------------------------------- /app/src/main/res/xml/file_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | mavenCentral() 6 | google() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:8.9.2' 10 | classpath 'com.google.gms:google-services:4.4.2' 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | mavenCentral() 20 | google() 21 | maven { url 'https://maven.google.com' } 22 | } 23 | } 24 | 25 | tasks.register('clean', Delete) { 26 | delete rootProject.layout.buildDirectory 27 | } 28 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | ## For more details on how to configure your build environment visit 2 | # http://www.gradle.org/docs/current/userguide/build_environment.html 3 | # 4 | # Specifies the JVM arguments used for the daemon process. 5 | # The setting is particularly useful for tweaking memory settings. 6 | # Default value: -Xmx1024m -XX:MaxPermSize=256m 7 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 8 | # 9 | # When configured, Gradle will run in incubating parallel mode. 10 | # This option should only be used with decoupled projects. More details, visit 11 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 12 | # org.gradle.parallel=true 13 | #Tue Jul 23 20:41:08 PDT 2019 14 | android.debug.obsoleteApi=true 15 | android.enableJetifier=false 16 | org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" 17 | android.useAndroidX=true 18 | android.nonTransitiveRClass=false 19 | android.nonFinalResIds=false 20 | org.gradle.configuration-cache=true 21 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Jul 01 22:05:52 PDT 2023 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /sodium/include/sodium/core.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef sodium_core_H 3 | #define sodium_core_H 4 | 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | SODIUM_EXPORT 12 | int sodium_init(void) 13 | __attribute__ ((warn_unused_result)); 14 | 15 | /* ---- */ 16 | 17 | SODIUM_EXPORT 18 | int sodium_set_misuse_handler(void (*handler)(void)); 19 | 20 | SODIUM_EXPORT 21 | void sodium_misuse(void) 22 | __attribute__ ((noreturn)); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_auth.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_auth_H 2 | #define crypto_auth_H 3 | 4 | #include 5 | 6 | #include "crypto_auth_hmacsha512256.h" 7 | #include "export.h" 8 | 9 | #ifdef __cplusplus 10 | # ifdef __GNUC__ 11 | # pragma GCC diagnostic ignored "-Wlong-long" 12 | # endif 13 | extern "C" { 14 | #endif 15 | 16 | #define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES 17 | SODIUM_EXPORT 18 | size_t crypto_auth_bytes(void); 19 | 20 | #define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES 21 | SODIUM_EXPORT 22 | size_t crypto_auth_keybytes(void); 23 | 24 | #define crypto_auth_PRIMITIVE "hmacsha512256" 25 | SODIUM_EXPORT 26 | const char *crypto_auth_primitive(void); 27 | 28 | SODIUM_EXPORT 29 | int crypto_auth(unsigned char *out, const unsigned char *in, 30 | unsigned long long inlen, const unsigned char *k) 31 | __attribute__ ((nonnull(1, 4))); 32 | 33 | SODIUM_EXPORT 34 | int crypto_auth_verify(const unsigned char *h, const unsigned char *in, 35 | unsigned long long inlen, const unsigned char *k) 36 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); 37 | 38 | SODIUM_EXPORT 39 | void crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES]) 40 | __attribute__ ((nonnull)); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_auth_hmacsha256.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_auth_hmacsha256_H 2 | #define crypto_auth_hmacsha256_H 3 | 4 | #include 5 | #include "crypto_hash_sha256.h" 6 | #include "export.h" 7 | 8 | #ifdef __cplusplus 9 | # ifdef __GNUC__ 10 | # pragma GCC diagnostic ignored "-Wlong-long" 11 | # endif 12 | extern "C" { 13 | #endif 14 | 15 | #define crypto_auth_hmacsha256_BYTES 32U 16 | SODIUM_EXPORT 17 | size_t crypto_auth_hmacsha256_bytes(void); 18 | 19 | #define crypto_auth_hmacsha256_KEYBYTES 32U 20 | SODIUM_EXPORT 21 | size_t crypto_auth_hmacsha256_keybytes(void); 22 | 23 | SODIUM_EXPORT 24 | int crypto_auth_hmacsha256(unsigned char *out, 25 | const unsigned char *in, 26 | unsigned long long inlen, 27 | const unsigned char *k) __attribute__ ((nonnull(1, 4))); 28 | 29 | SODIUM_EXPORT 30 | int crypto_auth_hmacsha256_verify(const unsigned char *h, 31 | const unsigned char *in, 32 | unsigned long long inlen, 33 | const unsigned char *k) 34 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); 35 | 36 | /* ------------------------------------------------------------------------- */ 37 | 38 | typedef struct crypto_auth_hmacsha256_state { 39 | crypto_hash_sha256_state ictx; 40 | crypto_hash_sha256_state octx; 41 | } crypto_auth_hmacsha256_state; 42 | 43 | SODIUM_EXPORT 44 | size_t crypto_auth_hmacsha256_statebytes(void); 45 | 46 | SODIUM_EXPORT 47 | int crypto_auth_hmacsha256_init(crypto_auth_hmacsha256_state *state, 48 | const unsigned char *key, 49 | size_t keylen) __attribute__ ((nonnull)); 50 | 51 | SODIUM_EXPORT 52 | int crypto_auth_hmacsha256_update(crypto_auth_hmacsha256_state *state, 53 | const unsigned char *in, 54 | unsigned long long inlen) 55 | __attribute__ ((nonnull(1))); 56 | 57 | SODIUM_EXPORT 58 | int crypto_auth_hmacsha256_final(crypto_auth_hmacsha256_state *state, 59 | unsigned char *out) __attribute__ ((nonnull)); 60 | 61 | 62 | SODIUM_EXPORT 63 | void crypto_auth_hmacsha256_keygen(unsigned char k[crypto_auth_hmacsha256_KEYBYTES]) 64 | __attribute__ ((nonnull)); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_auth_hmacsha512.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_auth_hmacsha512_H 2 | #define crypto_auth_hmacsha512_H 3 | 4 | #include 5 | #include "crypto_hash_sha512.h" 6 | #include "export.h" 7 | 8 | #ifdef __cplusplus 9 | # ifdef __GNUC__ 10 | # pragma GCC diagnostic ignored "-Wlong-long" 11 | # endif 12 | extern "C" { 13 | #endif 14 | 15 | #define crypto_auth_hmacsha512_BYTES 64U 16 | SODIUM_EXPORT 17 | size_t crypto_auth_hmacsha512_bytes(void); 18 | 19 | #define crypto_auth_hmacsha512_KEYBYTES 32U 20 | SODIUM_EXPORT 21 | size_t crypto_auth_hmacsha512_keybytes(void); 22 | 23 | SODIUM_EXPORT 24 | int crypto_auth_hmacsha512(unsigned char *out, 25 | const unsigned char *in, 26 | unsigned long long inlen, 27 | const unsigned char *k) __attribute__ ((nonnull(1, 4))); 28 | 29 | SODIUM_EXPORT 30 | int crypto_auth_hmacsha512_verify(const unsigned char *h, 31 | const unsigned char *in, 32 | unsigned long long inlen, 33 | const unsigned char *k) 34 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); 35 | 36 | /* ------------------------------------------------------------------------- */ 37 | 38 | typedef struct crypto_auth_hmacsha512_state { 39 | crypto_hash_sha512_state ictx; 40 | crypto_hash_sha512_state octx; 41 | } crypto_auth_hmacsha512_state; 42 | 43 | SODIUM_EXPORT 44 | size_t crypto_auth_hmacsha512_statebytes(void); 45 | 46 | SODIUM_EXPORT 47 | int crypto_auth_hmacsha512_init(crypto_auth_hmacsha512_state *state, 48 | const unsigned char *key, 49 | size_t keylen) __attribute__ ((nonnull)); 50 | 51 | SODIUM_EXPORT 52 | int crypto_auth_hmacsha512_update(crypto_auth_hmacsha512_state *state, 53 | const unsigned char *in, 54 | unsigned long long inlen) __attribute__ ((nonnull(1))); 55 | 56 | SODIUM_EXPORT 57 | int crypto_auth_hmacsha512_final(crypto_auth_hmacsha512_state *state, 58 | unsigned char *out) __attribute__ ((nonnull)); 59 | 60 | SODIUM_EXPORT 61 | void crypto_auth_hmacsha512_keygen(unsigned char k[crypto_auth_hmacsha512_KEYBYTES]) 62 | __attribute__ ((nonnull)); 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_auth_hmacsha512256.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_auth_hmacsha512256_H 2 | #define crypto_auth_hmacsha512256_H 3 | 4 | #include 5 | #include "crypto_auth_hmacsha512.h" 6 | #include "export.h" 7 | 8 | #ifdef __cplusplus 9 | # ifdef __GNUC__ 10 | # pragma GCC diagnostic ignored "-Wlong-long" 11 | # endif 12 | extern "C" { 13 | #endif 14 | 15 | #define crypto_auth_hmacsha512256_BYTES 32U 16 | SODIUM_EXPORT 17 | size_t crypto_auth_hmacsha512256_bytes(void); 18 | 19 | #define crypto_auth_hmacsha512256_KEYBYTES 32U 20 | SODIUM_EXPORT 21 | size_t crypto_auth_hmacsha512256_keybytes(void); 22 | 23 | SODIUM_EXPORT 24 | int crypto_auth_hmacsha512256(unsigned char *out, 25 | const unsigned char *in, 26 | unsigned long long inlen, 27 | const unsigned char *k) __attribute__ ((nonnull(1, 4))); 28 | 29 | SODIUM_EXPORT 30 | int crypto_auth_hmacsha512256_verify(const unsigned char *h, 31 | const unsigned char *in, 32 | unsigned long long inlen, 33 | const unsigned char *k) 34 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); 35 | 36 | /* ------------------------------------------------------------------------- */ 37 | 38 | typedef crypto_auth_hmacsha512_state crypto_auth_hmacsha512256_state; 39 | 40 | SODIUM_EXPORT 41 | size_t crypto_auth_hmacsha512256_statebytes(void); 42 | 43 | SODIUM_EXPORT 44 | int crypto_auth_hmacsha512256_init(crypto_auth_hmacsha512256_state *state, 45 | const unsigned char *key, 46 | size_t keylen) __attribute__ ((nonnull)); 47 | 48 | SODIUM_EXPORT 49 | int crypto_auth_hmacsha512256_update(crypto_auth_hmacsha512256_state *state, 50 | const unsigned char *in, 51 | unsigned long long inlen) __attribute__ ((nonnull(1))); 52 | 53 | SODIUM_EXPORT 54 | int crypto_auth_hmacsha512256_final(crypto_auth_hmacsha512256_state *state, 55 | unsigned char *out) __attribute__ ((nonnull)); 56 | 57 | SODIUM_EXPORT 58 | void crypto_auth_hmacsha512256_keygen(unsigned char k[crypto_auth_hmacsha512256_KEYBYTES]) 59 | __attribute__ ((nonnull)); 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_core_hchacha20.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_core_hchacha20_H 2 | #define crypto_core_hchacha20_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_core_hchacha20_OUTPUTBYTES 32U 12 | SODIUM_EXPORT 13 | size_t crypto_core_hchacha20_outputbytes(void); 14 | 15 | #define crypto_core_hchacha20_INPUTBYTES 16U 16 | SODIUM_EXPORT 17 | size_t crypto_core_hchacha20_inputbytes(void); 18 | 19 | #define crypto_core_hchacha20_KEYBYTES 32U 20 | SODIUM_EXPORT 21 | size_t crypto_core_hchacha20_keybytes(void); 22 | 23 | #define crypto_core_hchacha20_CONSTBYTES 16U 24 | SODIUM_EXPORT 25 | size_t crypto_core_hchacha20_constbytes(void); 26 | 27 | SODIUM_EXPORT 28 | int crypto_core_hchacha20(unsigned char *out, const unsigned char *in, 29 | const unsigned char *k, const unsigned char *c) 30 | __attribute__ ((nonnull(1, 2, 3))); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_core_hsalsa20.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_core_hsalsa20_H 2 | #define crypto_core_hsalsa20_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_core_hsalsa20_OUTPUTBYTES 32U 12 | SODIUM_EXPORT 13 | size_t crypto_core_hsalsa20_outputbytes(void); 14 | 15 | #define crypto_core_hsalsa20_INPUTBYTES 16U 16 | SODIUM_EXPORT 17 | size_t crypto_core_hsalsa20_inputbytes(void); 18 | 19 | #define crypto_core_hsalsa20_KEYBYTES 32U 20 | SODIUM_EXPORT 21 | size_t crypto_core_hsalsa20_keybytes(void); 22 | 23 | #define crypto_core_hsalsa20_CONSTBYTES 16U 24 | SODIUM_EXPORT 25 | size_t crypto_core_hsalsa20_constbytes(void); 26 | 27 | SODIUM_EXPORT 28 | int crypto_core_hsalsa20(unsigned char *out, const unsigned char *in, 29 | const unsigned char *k, const unsigned char *c) 30 | __attribute__ ((nonnull(1, 2, 3))); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_core_salsa20.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_core_salsa20_H 2 | #define crypto_core_salsa20_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_core_salsa20_OUTPUTBYTES 64U 12 | SODIUM_EXPORT 13 | size_t crypto_core_salsa20_outputbytes(void); 14 | 15 | #define crypto_core_salsa20_INPUTBYTES 16U 16 | SODIUM_EXPORT 17 | size_t crypto_core_salsa20_inputbytes(void); 18 | 19 | #define crypto_core_salsa20_KEYBYTES 32U 20 | SODIUM_EXPORT 21 | size_t crypto_core_salsa20_keybytes(void); 22 | 23 | #define crypto_core_salsa20_CONSTBYTES 16U 24 | SODIUM_EXPORT 25 | size_t crypto_core_salsa20_constbytes(void); 26 | 27 | SODIUM_EXPORT 28 | int crypto_core_salsa20(unsigned char *out, const unsigned char *in, 29 | const unsigned char *k, const unsigned char *c) 30 | __attribute__ ((nonnull(1, 2, 3))); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_core_salsa2012.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_core_salsa2012_H 2 | #define crypto_core_salsa2012_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_core_salsa2012_OUTPUTBYTES 64U 12 | SODIUM_EXPORT 13 | size_t crypto_core_salsa2012_outputbytes(void); 14 | 15 | #define crypto_core_salsa2012_INPUTBYTES 16U 16 | SODIUM_EXPORT 17 | size_t crypto_core_salsa2012_inputbytes(void); 18 | 19 | #define crypto_core_salsa2012_KEYBYTES 32U 20 | SODIUM_EXPORT 21 | size_t crypto_core_salsa2012_keybytes(void); 22 | 23 | #define crypto_core_salsa2012_CONSTBYTES 16U 24 | SODIUM_EXPORT 25 | size_t crypto_core_salsa2012_constbytes(void); 26 | 27 | SODIUM_EXPORT 28 | int crypto_core_salsa2012(unsigned char *out, const unsigned char *in, 29 | const unsigned char *k, const unsigned char *c) 30 | __attribute__ ((nonnull(1, 2, 3))); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_core_salsa208.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_core_salsa208_H 2 | #define crypto_core_salsa208_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_core_salsa208_OUTPUTBYTES 64U 12 | SODIUM_EXPORT 13 | size_t crypto_core_salsa208_outputbytes(void) 14 | __attribute__ ((deprecated)); 15 | 16 | #define crypto_core_salsa208_INPUTBYTES 16U 17 | SODIUM_EXPORT 18 | size_t crypto_core_salsa208_inputbytes(void) 19 | __attribute__ ((deprecated)); 20 | 21 | #define crypto_core_salsa208_KEYBYTES 32U 22 | SODIUM_EXPORT 23 | size_t crypto_core_salsa208_keybytes(void) 24 | __attribute__ ((deprecated)); 25 | 26 | #define crypto_core_salsa208_CONSTBYTES 16U 27 | SODIUM_EXPORT 28 | size_t crypto_core_salsa208_constbytes(void) 29 | __attribute__ ((deprecated)); 30 | 31 | SODIUM_EXPORT 32 | int crypto_core_salsa208(unsigned char *out, const unsigned char *in, 33 | const unsigned char *k, const unsigned char *c) 34 | __attribute__ ((nonnull(1, 2, 3))); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_hash.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_hash_H 2 | #define crypto_hash_H 3 | 4 | /* 5 | * WARNING: Unless you absolutely need to use SHA512 for interoperability, 6 | * purposes, you might want to consider crypto_generichash() instead. 7 | * Unlike SHA512, crypto_generichash() is not vulnerable to length 8 | * extension attacks. 9 | */ 10 | 11 | #include 12 | 13 | #include "crypto_hash_sha512.h" 14 | #include "export.h" 15 | 16 | #ifdef __cplusplus 17 | # ifdef __GNUC__ 18 | # pragma GCC diagnostic ignored "-Wlong-long" 19 | # endif 20 | extern "C" { 21 | #endif 22 | 23 | #define crypto_hash_BYTES crypto_hash_sha512_BYTES 24 | SODIUM_EXPORT 25 | size_t crypto_hash_bytes(void); 26 | 27 | SODIUM_EXPORT 28 | int crypto_hash(unsigned char *out, const unsigned char *in, 29 | unsigned long long inlen) __attribute__ ((nonnull(1))); 30 | 31 | #define crypto_hash_PRIMITIVE "sha512" 32 | SODIUM_EXPORT 33 | const char *crypto_hash_primitive(void) 34 | __attribute__ ((warn_unused_result)); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_hash_sha256.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_hash_sha256_H 2 | #define crypto_hash_sha256_H 3 | 4 | /* 5 | * WARNING: Unless you absolutely need to use SHA256 for interoperability, 6 | * purposes, you might want to consider crypto_generichash() instead. 7 | * Unlike SHA256, crypto_generichash() is not vulnerable to length 8 | * extension attacks. 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include "export.h" 16 | 17 | #ifdef __cplusplus 18 | # ifdef __GNUC__ 19 | # pragma GCC diagnostic ignored "-Wlong-long" 20 | # endif 21 | extern "C" { 22 | #endif 23 | 24 | typedef struct crypto_hash_sha256_state { 25 | uint32_t state[8]; 26 | uint64_t count; 27 | uint8_t buf[64]; 28 | } crypto_hash_sha256_state; 29 | 30 | SODIUM_EXPORT 31 | size_t crypto_hash_sha256_statebytes(void); 32 | 33 | #define crypto_hash_sha256_BYTES 32U 34 | SODIUM_EXPORT 35 | size_t crypto_hash_sha256_bytes(void); 36 | 37 | SODIUM_EXPORT 38 | int crypto_hash_sha256(unsigned char *out, const unsigned char *in, 39 | unsigned long long inlen) __attribute__ ((nonnull(1))); 40 | 41 | SODIUM_EXPORT 42 | int crypto_hash_sha256_init(crypto_hash_sha256_state *state) 43 | __attribute__ ((nonnull)); 44 | 45 | SODIUM_EXPORT 46 | int crypto_hash_sha256_update(crypto_hash_sha256_state *state, 47 | const unsigned char *in, 48 | unsigned long long inlen) 49 | __attribute__ ((nonnull(1))); 50 | 51 | SODIUM_EXPORT 52 | int crypto_hash_sha256_final(crypto_hash_sha256_state *state, 53 | unsigned char *out) 54 | __attribute__ ((nonnull)); 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_hash_sha512.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_hash_sha512_H 2 | #define crypto_hash_sha512_H 3 | 4 | /* 5 | * WARNING: Unless you absolutely need to use SHA512 for interoperability, 6 | * purposes, you might want to consider crypto_generichash() instead. 7 | * Unlike SHA512, crypto_generichash() is not vulnerable to length 8 | * extension attacks. 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include "export.h" 16 | 17 | #ifdef __cplusplus 18 | # ifdef __GNUC__ 19 | # pragma GCC diagnostic ignored "-Wlong-long" 20 | # endif 21 | extern "C" { 22 | #endif 23 | 24 | typedef struct crypto_hash_sha512_state { 25 | uint64_t state[8]; 26 | uint64_t count[2]; 27 | uint8_t buf[128]; 28 | } crypto_hash_sha512_state; 29 | 30 | SODIUM_EXPORT 31 | size_t crypto_hash_sha512_statebytes(void); 32 | 33 | #define crypto_hash_sha512_BYTES 64U 34 | SODIUM_EXPORT 35 | size_t crypto_hash_sha512_bytes(void); 36 | 37 | SODIUM_EXPORT 38 | int crypto_hash_sha512(unsigned char *out, const unsigned char *in, 39 | unsigned long long inlen) __attribute__ ((nonnull(1))); 40 | 41 | SODIUM_EXPORT 42 | int crypto_hash_sha512_init(crypto_hash_sha512_state *state) 43 | __attribute__ ((nonnull)); 44 | 45 | SODIUM_EXPORT 46 | int crypto_hash_sha512_update(crypto_hash_sha512_state *state, 47 | const unsigned char *in, 48 | unsigned long long inlen) 49 | __attribute__ ((nonnull(1))); 50 | 51 | SODIUM_EXPORT 52 | int crypto_hash_sha512_final(crypto_hash_sha512_state *state, 53 | unsigned char *out) 54 | __attribute__ ((nonnull)); 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_kdf.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_kdf_H 2 | #define crypto_kdf_H 3 | 4 | #include 5 | #include 6 | 7 | #include "crypto_kdf_blake2b.h" 8 | #include "export.h" 9 | 10 | #ifdef __cplusplus 11 | # ifdef __GNUC__ 12 | # pragma GCC diagnostic ignored "-Wlong-long" 13 | # endif 14 | extern "C" { 15 | #endif 16 | 17 | #define crypto_kdf_BYTES_MIN crypto_kdf_blake2b_BYTES_MIN 18 | SODIUM_EXPORT 19 | size_t crypto_kdf_bytes_min(void); 20 | 21 | #define crypto_kdf_BYTES_MAX crypto_kdf_blake2b_BYTES_MAX 22 | SODIUM_EXPORT 23 | size_t crypto_kdf_bytes_max(void); 24 | 25 | #define crypto_kdf_CONTEXTBYTES crypto_kdf_blake2b_CONTEXTBYTES 26 | SODIUM_EXPORT 27 | size_t crypto_kdf_contextbytes(void); 28 | 29 | #define crypto_kdf_KEYBYTES crypto_kdf_blake2b_KEYBYTES 30 | SODIUM_EXPORT 31 | size_t crypto_kdf_keybytes(void); 32 | 33 | #define crypto_kdf_PRIMITIVE "blake2b" 34 | SODIUM_EXPORT 35 | const char *crypto_kdf_primitive(void) 36 | __attribute__ ((warn_unused_result)); 37 | 38 | SODIUM_EXPORT 39 | int crypto_kdf_derive_from_key(unsigned char *subkey, size_t subkey_len, 40 | uint64_t subkey_id, 41 | const char ctx[crypto_kdf_CONTEXTBYTES], 42 | const unsigned char key[crypto_kdf_KEYBYTES]) 43 | __attribute__ ((nonnull)); 44 | 45 | SODIUM_EXPORT 46 | void crypto_kdf_keygen(unsigned char k[crypto_kdf_KEYBYTES]) 47 | __attribute__ ((nonnull)); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_kdf_blake2b.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_kdf_blake2b_H 2 | #define crypto_kdf_blake2b_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "export.h" 9 | 10 | #ifdef __cplusplus 11 | # ifdef __GNUC__ 12 | # pragma GCC diagnostic ignored "-Wlong-long" 13 | # endif 14 | extern "C" { 15 | #endif 16 | 17 | #define crypto_kdf_blake2b_BYTES_MIN 16 18 | SODIUM_EXPORT 19 | size_t crypto_kdf_blake2b_bytes_min(void); 20 | 21 | #define crypto_kdf_blake2b_BYTES_MAX 64 22 | SODIUM_EXPORT 23 | size_t crypto_kdf_blake2b_bytes_max(void); 24 | 25 | #define crypto_kdf_blake2b_CONTEXTBYTES 8 26 | SODIUM_EXPORT 27 | size_t crypto_kdf_blake2b_contextbytes(void); 28 | 29 | #define crypto_kdf_blake2b_KEYBYTES 32 30 | SODIUM_EXPORT 31 | size_t crypto_kdf_blake2b_keybytes(void); 32 | 33 | SODIUM_EXPORT 34 | int crypto_kdf_blake2b_derive_from_key(unsigned char *subkey, size_t subkey_len, 35 | uint64_t subkey_id, 36 | const char ctx[crypto_kdf_blake2b_CONTEXTBYTES], 37 | const unsigned char key[crypto_kdf_blake2b_KEYBYTES]) 38 | __attribute__ ((nonnull)); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_onetimeauth.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_onetimeauth_H 2 | #define crypto_onetimeauth_H 3 | 4 | #include 5 | 6 | #include "crypto_onetimeauth_poly1305.h" 7 | #include "export.h" 8 | 9 | #ifdef __cplusplus 10 | # ifdef __GNUC__ 11 | # pragma GCC diagnostic ignored "-Wlong-long" 12 | # endif 13 | extern "C" { 14 | #endif 15 | 16 | typedef crypto_onetimeauth_poly1305_state crypto_onetimeauth_state; 17 | 18 | SODIUM_EXPORT 19 | size_t crypto_onetimeauth_statebytes(void); 20 | 21 | #define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES 22 | SODIUM_EXPORT 23 | size_t crypto_onetimeauth_bytes(void); 24 | 25 | #define crypto_onetimeauth_KEYBYTES crypto_onetimeauth_poly1305_KEYBYTES 26 | SODIUM_EXPORT 27 | size_t crypto_onetimeauth_keybytes(void); 28 | 29 | #define crypto_onetimeauth_PRIMITIVE "poly1305" 30 | SODIUM_EXPORT 31 | const char *crypto_onetimeauth_primitive(void); 32 | 33 | SODIUM_EXPORT 34 | int crypto_onetimeauth(unsigned char *out, const unsigned char *in, 35 | unsigned long long inlen, const unsigned char *k) 36 | __attribute__ ((nonnull(1, 4))); 37 | 38 | SODIUM_EXPORT 39 | int crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in, 40 | unsigned long long inlen, const unsigned char *k) 41 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4))); 42 | 43 | SODIUM_EXPORT 44 | int crypto_onetimeauth_init(crypto_onetimeauth_state *state, 45 | const unsigned char *key) __attribute__ ((nonnull)); 46 | 47 | SODIUM_EXPORT 48 | int crypto_onetimeauth_update(crypto_onetimeauth_state *state, 49 | const unsigned char *in, 50 | unsigned long long inlen) 51 | __attribute__ ((nonnull(1))); 52 | 53 | SODIUM_EXPORT 54 | int crypto_onetimeauth_final(crypto_onetimeauth_state *state, 55 | unsigned char *out) __attribute__ ((nonnull)); 56 | 57 | SODIUM_EXPORT 58 | void crypto_onetimeauth_keygen(unsigned char k[crypto_onetimeauth_KEYBYTES]) 59 | __attribute__ ((nonnull)); 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_scalarmult.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_scalarmult_H 2 | #define crypto_scalarmult_H 3 | 4 | #include 5 | 6 | #include "crypto_scalarmult_curve25519.h" 7 | #include "export.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #define crypto_scalarmult_BYTES crypto_scalarmult_curve25519_BYTES 14 | SODIUM_EXPORT 15 | size_t crypto_scalarmult_bytes(void); 16 | 17 | #define crypto_scalarmult_SCALARBYTES crypto_scalarmult_curve25519_SCALARBYTES 18 | SODIUM_EXPORT 19 | size_t crypto_scalarmult_scalarbytes(void); 20 | 21 | #define crypto_scalarmult_PRIMITIVE "curve25519" 22 | SODIUM_EXPORT 23 | const char *crypto_scalarmult_primitive(void); 24 | 25 | SODIUM_EXPORT 26 | int crypto_scalarmult_base(unsigned char *q, const unsigned char *n) 27 | __attribute__ ((nonnull)); 28 | 29 | /* 30 | * NOTE: Do not use the result of this function directly for key exchange. 31 | * 32 | * Hash the result with the public keys in order to compute a shared 33 | * secret key: H(q || client_pk || server_pk) 34 | * 35 | * Or unless this is not an option, use the crypto_kx() API instead. 36 | */ 37 | SODIUM_EXPORT 38 | int crypto_scalarmult(unsigned char *q, const unsigned char *n, 39 | const unsigned char *p) 40 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_scalarmult_curve25519.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_scalarmult_curve25519_H 2 | #define crypto_scalarmult_curve25519_H 3 | 4 | #include 5 | 6 | #include "export.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | #define crypto_scalarmult_curve25519_BYTES 32U 13 | SODIUM_EXPORT 14 | size_t crypto_scalarmult_curve25519_bytes(void); 15 | 16 | #define crypto_scalarmult_curve25519_SCALARBYTES 32U 17 | SODIUM_EXPORT 18 | size_t crypto_scalarmult_curve25519_scalarbytes(void); 19 | 20 | /* 21 | * NOTE: Do not use the result of this function directly for key exchange. 22 | * 23 | * Hash the result with the public keys in order to compute a shared 24 | * secret key: H(q || client_pk || server_pk) 25 | * 26 | * Or unless this is not an option, use the crypto_kx() API instead. 27 | */ 28 | SODIUM_EXPORT 29 | int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n, 30 | const unsigned char *p) 31 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); 32 | 33 | SODIUM_EXPORT 34 | int crypto_scalarmult_curve25519_base(unsigned char *q, 35 | const unsigned char *n) 36 | __attribute__ ((nonnull)); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_scalarmult_ed25519.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef crypto_scalarmult_ed25519_H 3 | #define crypto_scalarmult_ed25519_H 4 | 5 | #include 6 | 7 | #include "export.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #define crypto_scalarmult_ed25519_BYTES 32U 14 | SODIUM_EXPORT 15 | size_t crypto_scalarmult_ed25519_bytes(void); 16 | 17 | #define crypto_scalarmult_ed25519_SCALARBYTES 32U 18 | SODIUM_EXPORT 19 | size_t crypto_scalarmult_ed25519_scalarbytes(void); 20 | 21 | /* 22 | * NOTE: Do not use the result of this function directly for key exchange. 23 | * 24 | * Hash the result with the public keys in order to compute a shared 25 | * secret key: H(q || client_pk || server_pk) 26 | * 27 | * Or unless this is not an option, use the crypto_kx() API instead. 28 | */ 29 | SODIUM_EXPORT 30 | int crypto_scalarmult_ed25519(unsigned char *q, const unsigned char *n, 31 | const unsigned char *p) 32 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); 33 | 34 | SODIUM_EXPORT 35 | int crypto_scalarmult_ed25519_noclamp(unsigned char *q, const unsigned char *n, 36 | const unsigned char *p) 37 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); 38 | 39 | SODIUM_EXPORT 40 | int crypto_scalarmult_ed25519_base(unsigned char *q, const unsigned char *n) 41 | __attribute__ ((nonnull)); 42 | 43 | SODIUM_EXPORT 44 | int crypto_scalarmult_ed25519_base_noclamp(unsigned char *q, const unsigned char *n) 45 | __attribute__ ((nonnull)); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_scalarmult_ristretto255.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef crypto_scalarmult_ristretto255_H 3 | #define crypto_scalarmult_ristretto255_H 4 | 5 | #include 6 | 7 | #include "export.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #define crypto_scalarmult_ristretto255_BYTES 32U 14 | SODIUM_EXPORT 15 | size_t crypto_scalarmult_ristretto255_bytes(void); 16 | 17 | #define crypto_scalarmult_ristretto255_SCALARBYTES 32U 18 | SODIUM_EXPORT 19 | size_t crypto_scalarmult_ristretto255_scalarbytes(void); 20 | 21 | /* 22 | * NOTE: Do not use the result of this function directly for key exchange. 23 | * 24 | * Hash the result with the public keys in order to compute a shared 25 | * secret key: H(q || client_pk || server_pk) 26 | * 27 | * Or unless this is not an option, use the crypto_kx() API instead. 28 | */ 29 | SODIUM_EXPORT 30 | int crypto_scalarmult_ristretto255(unsigned char *q, const unsigned char *n, 31 | const unsigned char *p) 32 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); 33 | 34 | SODIUM_EXPORT 35 | int crypto_scalarmult_ristretto255_base(unsigned char *q, 36 | const unsigned char *n) 37 | __attribute__ ((nonnull)); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_shorthash.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_shorthash_H 2 | #define crypto_shorthash_H 3 | 4 | #include 5 | 6 | #include "crypto_shorthash_siphash24.h" 7 | #include "export.h" 8 | 9 | #ifdef __cplusplus 10 | # ifdef __GNUC__ 11 | # pragma GCC diagnostic ignored "-Wlong-long" 12 | # endif 13 | extern "C" { 14 | #endif 15 | 16 | #define crypto_shorthash_BYTES crypto_shorthash_siphash24_BYTES 17 | SODIUM_EXPORT 18 | size_t crypto_shorthash_bytes(void); 19 | 20 | #define crypto_shorthash_KEYBYTES crypto_shorthash_siphash24_KEYBYTES 21 | SODIUM_EXPORT 22 | size_t crypto_shorthash_keybytes(void); 23 | 24 | #define crypto_shorthash_PRIMITIVE "siphash24" 25 | SODIUM_EXPORT 26 | const char *crypto_shorthash_primitive(void); 27 | 28 | SODIUM_EXPORT 29 | int crypto_shorthash(unsigned char *out, const unsigned char *in, 30 | unsigned long long inlen, const unsigned char *k) 31 | __attribute__ ((nonnull(1, 4))); 32 | 33 | SODIUM_EXPORT 34 | void crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES]) 35 | __attribute__ ((nonnull)); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_shorthash_siphash24.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_shorthash_siphash24_H 2 | #define crypto_shorthash_siphash24_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | # ifdef __GNUC__ 9 | # pragma GCC diagnostic ignored "-Wlong-long" 10 | # endif 11 | extern "C" { 12 | #endif 13 | 14 | /* -- 64-bit output -- */ 15 | 16 | #define crypto_shorthash_siphash24_BYTES 8U 17 | SODIUM_EXPORT 18 | size_t crypto_shorthash_siphash24_bytes(void); 19 | 20 | #define crypto_shorthash_siphash24_KEYBYTES 16U 21 | SODIUM_EXPORT 22 | size_t crypto_shorthash_siphash24_keybytes(void); 23 | 24 | SODIUM_EXPORT 25 | int crypto_shorthash_siphash24(unsigned char *out, const unsigned char *in, 26 | unsigned long long inlen, const unsigned char *k) 27 | __attribute__ ((nonnull(1, 4))); 28 | 29 | #ifndef SODIUM_LIBRARY_MINIMAL 30 | /* -- 128-bit output -- */ 31 | 32 | #define crypto_shorthash_siphashx24_BYTES 16U 33 | SODIUM_EXPORT 34 | size_t crypto_shorthash_siphashx24_bytes(void); 35 | 36 | #define crypto_shorthash_siphashx24_KEYBYTES 16U 37 | SODIUM_EXPORT 38 | size_t crypto_shorthash_siphashx24_keybytes(void); 39 | 40 | SODIUM_EXPORT 41 | int crypto_shorthash_siphashx24(unsigned char *out, const unsigned char *in, 42 | unsigned long long inlen, const unsigned char *k) 43 | __attribute__ ((nonnull(1, 4))); 44 | #endif 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_sign_edwards25519sha512batch.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_sign_edwards25519sha512batch_H 2 | #define crypto_sign_edwards25519sha512batch_H 3 | 4 | /* 5 | * WARNING: This construction was a prototype, which should not be used 6 | * any more in new projects. 7 | * 8 | * crypto_sign_edwards25519sha512batch is provided for applications 9 | * initially built with NaCl, but as recommended by the author of this 10 | * construction, new applications should use ed25519 instead. 11 | * 12 | * In Sodium, you should use the high-level crypto_sign_*() functions instead. 13 | */ 14 | 15 | #include 16 | #include "export.h" 17 | 18 | #ifdef __cplusplus 19 | # ifdef __GNUC__ 20 | # pragma GCC diagnostic ignored "-Wlong-long" 21 | # endif 22 | extern "C" { 23 | #endif 24 | 25 | #define crypto_sign_edwards25519sha512batch_BYTES 64U 26 | #define crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES 32U 27 | #define crypto_sign_edwards25519sha512batch_SECRETKEYBYTES (32U + 32U) 28 | #define crypto_sign_edwards25519sha512batch_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_edwards25519sha512batch_BYTES) 29 | 30 | SODIUM_EXPORT 31 | int crypto_sign_edwards25519sha512batch(unsigned char *sm, 32 | unsigned long long *smlen_p, 33 | const unsigned char *m, 34 | unsigned long long mlen, 35 | const unsigned char *sk) 36 | __attribute__ ((deprecated)) __attribute__ ((nonnull(1, 5))); 37 | 38 | SODIUM_EXPORT 39 | int crypto_sign_edwards25519sha512batch_open(unsigned char *m, 40 | unsigned long long *mlen_p, 41 | const unsigned char *sm, 42 | unsigned long long smlen, 43 | const unsigned char *pk) 44 | __attribute__ ((deprecated)) __attribute__ ((nonnull(3, 5))); 45 | 46 | SODIUM_EXPORT 47 | int crypto_sign_edwards25519sha512batch_keypair(unsigned char *pk, 48 | unsigned char *sk) 49 | __attribute__ ((deprecated)) __attribute__ ((nonnull)); 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_stream.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_stream_H 2 | #define crypto_stream_H 3 | 4 | /* 5 | * WARNING: This is just a stream cipher. It is NOT authenticated encryption. 6 | * While it provides some protection against eavesdropping, it does NOT 7 | * provide any security against active attacks. 8 | * Unless you know what you're doing, what you are looking for is probably 9 | * the crypto_box functions. 10 | */ 11 | 12 | #include 13 | 14 | #include "crypto_stream_xsalsa20.h" 15 | #include "export.h" 16 | 17 | #ifdef __cplusplus 18 | # ifdef __GNUC__ 19 | # pragma GCC diagnostic ignored "-Wlong-long" 20 | # endif 21 | extern "C" { 22 | #endif 23 | 24 | #define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES 25 | SODIUM_EXPORT 26 | size_t crypto_stream_keybytes(void); 27 | 28 | #define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES 29 | SODIUM_EXPORT 30 | size_t crypto_stream_noncebytes(void); 31 | 32 | #define crypto_stream_MESSAGEBYTES_MAX crypto_stream_xsalsa20_MESSAGEBYTES_MAX 33 | SODIUM_EXPORT 34 | size_t crypto_stream_messagebytes_max(void); 35 | 36 | #define crypto_stream_PRIMITIVE "xsalsa20" 37 | SODIUM_EXPORT 38 | const char *crypto_stream_primitive(void); 39 | 40 | SODIUM_EXPORT 41 | int crypto_stream(unsigned char *c, unsigned long long clen, 42 | const unsigned char *n, const unsigned char *k) 43 | __attribute__ ((nonnull)); 44 | 45 | SODIUM_EXPORT 46 | int crypto_stream_xor(unsigned char *c, const unsigned char *m, 47 | unsigned long long mlen, const unsigned char *n, 48 | const unsigned char *k) 49 | __attribute__ ((nonnull)); 50 | 51 | SODIUM_EXPORT 52 | void crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES]) 53 | __attribute__ ((nonnull)); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_stream_salsa20.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_stream_salsa20_H 2 | #define crypto_stream_salsa20_H 3 | 4 | /* 5 | * WARNING: This is just a stream cipher. It is NOT authenticated encryption. 6 | * While it provides some protection against eavesdropping, it does NOT 7 | * provide any security against active attacks. 8 | * Unless you know what you're doing, what you are looking for is probably 9 | * the crypto_box functions. 10 | */ 11 | 12 | #include 13 | #include 14 | #include "export.h" 15 | 16 | #ifdef __cplusplus 17 | # ifdef __GNUC__ 18 | # pragma GCC diagnostic ignored "-Wlong-long" 19 | # endif 20 | extern "C" { 21 | #endif 22 | 23 | #define crypto_stream_salsa20_KEYBYTES 32U 24 | SODIUM_EXPORT 25 | size_t crypto_stream_salsa20_keybytes(void); 26 | 27 | #define crypto_stream_salsa20_NONCEBYTES 8U 28 | SODIUM_EXPORT 29 | size_t crypto_stream_salsa20_noncebytes(void); 30 | 31 | #define crypto_stream_salsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX 32 | SODIUM_EXPORT 33 | size_t crypto_stream_salsa20_messagebytes_max(void); 34 | 35 | SODIUM_EXPORT 36 | int crypto_stream_salsa20(unsigned char *c, unsigned long long clen, 37 | const unsigned char *n, const unsigned char *k) 38 | __attribute__ ((nonnull)); 39 | 40 | SODIUM_EXPORT 41 | int crypto_stream_salsa20_xor(unsigned char *c, const unsigned char *m, 42 | unsigned long long mlen, const unsigned char *n, 43 | const unsigned char *k) 44 | __attribute__ ((nonnull)); 45 | 46 | SODIUM_EXPORT 47 | int crypto_stream_salsa20_xor_ic(unsigned char *c, const unsigned char *m, 48 | unsigned long long mlen, 49 | const unsigned char *n, uint64_t ic, 50 | const unsigned char *k) 51 | __attribute__ ((nonnull)); 52 | 53 | SODIUM_EXPORT 54 | void crypto_stream_salsa20_keygen(unsigned char k[crypto_stream_salsa20_KEYBYTES]) 55 | __attribute__ ((nonnull)); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_stream_salsa2012.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_stream_salsa2012_H 2 | #define crypto_stream_salsa2012_H 3 | 4 | /* 5 | * WARNING: This is just a stream cipher. It is NOT authenticated encryption. 6 | * While it provides some protection against eavesdropping, it does NOT 7 | * provide any security against active attacks. 8 | * Unless you know what you're doing, what you are looking for is probably 9 | * the crypto_box functions. 10 | */ 11 | 12 | #include 13 | #include "export.h" 14 | 15 | #ifdef __cplusplus 16 | # ifdef __GNUC__ 17 | # pragma GCC diagnostic ignored "-Wlong-long" 18 | # endif 19 | extern "C" { 20 | #endif 21 | 22 | #define crypto_stream_salsa2012_KEYBYTES 32U 23 | SODIUM_EXPORT 24 | size_t crypto_stream_salsa2012_keybytes(void); 25 | 26 | #define crypto_stream_salsa2012_NONCEBYTES 8U 27 | SODIUM_EXPORT 28 | size_t crypto_stream_salsa2012_noncebytes(void); 29 | 30 | #define crypto_stream_salsa2012_MESSAGEBYTES_MAX SODIUM_SIZE_MAX 31 | SODIUM_EXPORT 32 | size_t crypto_stream_salsa2012_messagebytes_max(void); 33 | 34 | SODIUM_EXPORT 35 | int crypto_stream_salsa2012(unsigned char *c, unsigned long long clen, 36 | const unsigned char *n, const unsigned char *k) 37 | __attribute__ ((nonnull)); 38 | 39 | SODIUM_EXPORT 40 | int crypto_stream_salsa2012_xor(unsigned char *c, const unsigned char *m, 41 | unsigned long long mlen, const unsigned char *n, 42 | const unsigned char *k) 43 | __attribute__ ((nonnull)); 44 | 45 | SODIUM_EXPORT 46 | void crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES]) 47 | __attribute__ ((nonnull)); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_stream_salsa208.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_stream_salsa208_H 2 | #define crypto_stream_salsa208_H 3 | 4 | /* 5 | * WARNING: This is just a stream cipher. It is NOT authenticated encryption. 6 | * While it provides some protection against eavesdropping, it does NOT 7 | * provide any security against active attacks. 8 | * Unless you know what you're doing, what you are looking for is probably 9 | * the crypto_box functions. 10 | */ 11 | 12 | #include 13 | #include "export.h" 14 | 15 | #ifdef __cplusplus 16 | # ifdef __GNUC__ 17 | # pragma GCC diagnostic ignored "-Wlong-long" 18 | # endif 19 | extern "C" { 20 | #endif 21 | 22 | #define crypto_stream_salsa208_KEYBYTES 32U 23 | SODIUM_EXPORT 24 | size_t crypto_stream_salsa208_keybytes(void) 25 | __attribute__ ((deprecated)); 26 | 27 | #define crypto_stream_salsa208_NONCEBYTES 8U 28 | SODIUM_EXPORT 29 | size_t crypto_stream_salsa208_noncebytes(void) 30 | __attribute__ ((deprecated)); 31 | 32 | #define crypto_stream_salsa208_MESSAGEBYTES_MAX SODIUM_SIZE_MAX 33 | SODIUM_EXPORT 34 | size_t crypto_stream_salsa208_messagebytes_max(void) 35 | __attribute__ ((deprecated)); 36 | 37 | SODIUM_EXPORT 38 | int crypto_stream_salsa208(unsigned char *c, unsigned long long clen, 39 | const unsigned char *n, const unsigned char *k) 40 | __attribute__ ((deprecated)) __attribute__ ((nonnull)); 41 | 42 | SODIUM_EXPORT 43 | int crypto_stream_salsa208_xor(unsigned char *c, const unsigned char *m, 44 | unsigned long long mlen, const unsigned char *n, 45 | const unsigned char *k) 46 | __attribute__ ((deprecated)) __attribute__ ((nonnull)); 47 | 48 | SODIUM_EXPORT 49 | void crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES]) 50 | __attribute__ ((deprecated)) __attribute__ ((nonnull)); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_stream_xchacha20.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_stream_xchacha20_H 2 | #define crypto_stream_xchacha20_H 3 | 4 | /* 5 | * WARNING: This is just a stream cipher. It is NOT authenticated encryption. 6 | * While it provides some protection against eavesdropping, it does NOT 7 | * provide any security against active attacks. 8 | * Unless you know what you're doing, what you are looking for is probably 9 | * the crypto_box functions. 10 | */ 11 | 12 | #include 13 | #include 14 | #include "export.h" 15 | 16 | #ifdef __cplusplus 17 | # ifdef __GNUC__ 18 | # pragma GCC diagnostic ignored "-Wlong-long" 19 | # endif 20 | extern "C" { 21 | #endif 22 | 23 | #define crypto_stream_xchacha20_KEYBYTES 32U 24 | SODIUM_EXPORT 25 | size_t crypto_stream_xchacha20_keybytes(void); 26 | 27 | #define crypto_stream_xchacha20_NONCEBYTES 24U 28 | SODIUM_EXPORT 29 | size_t crypto_stream_xchacha20_noncebytes(void); 30 | 31 | #define crypto_stream_xchacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX 32 | SODIUM_EXPORT 33 | size_t crypto_stream_xchacha20_messagebytes_max(void); 34 | 35 | SODIUM_EXPORT 36 | int crypto_stream_xchacha20(unsigned char *c, unsigned long long clen, 37 | const unsigned char *n, const unsigned char *k) 38 | __attribute__ ((nonnull)); 39 | 40 | SODIUM_EXPORT 41 | int crypto_stream_xchacha20_xor(unsigned char *c, const unsigned char *m, 42 | unsigned long long mlen, const unsigned char *n, 43 | const unsigned char *k) 44 | __attribute__ ((nonnull)); 45 | 46 | SODIUM_EXPORT 47 | int crypto_stream_xchacha20_xor_ic(unsigned char *c, const unsigned char *m, 48 | unsigned long long mlen, 49 | const unsigned char *n, uint64_t ic, 50 | const unsigned char *k) 51 | __attribute__ ((nonnull)); 52 | 53 | SODIUM_EXPORT 54 | void crypto_stream_xchacha20_keygen(unsigned char k[crypto_stream_xchacha20_KEYBYTES]) 55 | __attribute__ ((nonnull)); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_stream_xsalsa20.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_stream_xsalsa20_H 2 | #define crypto_stream_xsalsa20_H 3 | 4 | /* 5 | * WARNING: This is just a stream cipher. It is NOT authenticated encryption. 6 | * While it provides some protection against eavesdropping, it does NOT 7 | * provide any security against active attacks. 8 | * Unless you know what you're doing, what you are looking for is probably 9 | * the crypto_box functions. 10 | */ 11 | 12 | #include 13 | #include 14 | #include "export.h" 15 | 16 | #ifdef __cplusplus 17 | # ifdef __GNUC__ 18 | # pragma GCC diagnostic ignored "-Wlong-long" 19 | # endif 20 | extern "C" { 21 | #endif 22 | 23 | #define crypto_stream_xsalsa20_KEYBYTES 32U 24 | SODIUM_EXPORT 25 | size_t crypto_stream_xsalsa20_keybytes(void); 26 | 27 | #define crypto_stream_xsalsa20_NONCEBYTES 24U 28 | SODIUM_EXPORT 29 | size_t crypto_stream_xsalsa20_noncebytes(void); 30 | 31 | #define crypto_stream_xsalsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX 32 | SODIUM_EXPORT 33 | size_t crypto_stream_xsalsa20_messagebytes_max(void); 34 | 35 | SODIUM_EXPORT 36 | int crypto_stream_xsalsa20(unsigned char *c, unsigned long long clen, 37 | const unsigned char *n, const unsigned char *k) 38 | __attribute__ ((nonnull)); 39 | 40 | SODIUM_EXPORT 41 | int crypto_stream_xsalsa20_xor(unsigned char *c, const unsigned char *m, 42 | unsigned long long mlen, const unsigned char *n, 43 | const unsigned char *k) 44 | __attribute__ ((nonnull)); 45 | 46 | SODIUM_EXPORT 47 | int crypto_stream_xsalsa20_xor_ic(unsigned char *c, const unsigned char *m, 48 | unsigned long long mlen, 49 | const unsigned char *n, uint64_t ic, 50 | const unsigned char *k) 51 | __attribute__ ((nonnull)); 52 | 53 | SODIUM_EXPORT 54 | void crypto_stream_xsalsa20_keygen(unsigned char k[crypto_stream_xsalsa20_KEYBYTES]) 55 | __attribute__ ((nonnull)); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_verify_16.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_verify_16_H 2 | #define crypto_verify_16_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_verify_16_BYTES 16U 12 | SODIUM_EXPORT 13 | size_t crypto_verify_16_bytes(void); 14 | 15 | SODIUM_EXPORT 16 | int crypto_verify_16(const unsigned char *x, const unsigned char *y) 17 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_verify_32.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_verify_32_H 2 | #define crypto_verify_32_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_verify_32_BYTES 32U 12 | SODIUM_EXPORT 13 | size_t crypto_verify_32_bytes(void); 14 | 15 | SODIUM_EXPORT 16 | int crypto_verify_32(const unsigned char *x, const unsigned char *y) 17 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /sodium/include/sodium/crypto_verify_64.h: -------------------------------------------------------------------------------- 1 | #ifndef crypto_verify_64_H 2 | #define crypto_verify_64_H 3 | 4 | #include 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define crypto_verify_64_BYTES 64U 12 | SODIUM_EXPORT 13 | size_t crypto_verify_64_bytes(void); 14 | 15 | SODIUM_EXPORT 16 | int crypto_verify_64(const unsigned char *x, const unsigned char *y) 17 | __attribute__ ((warn_unused_result)) __attribute__ ((nonnull)); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /sodium/include/sodium/export.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef sodium_export_H 3 | #define sodium_export_H 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #if !defined(__clang__) && !defined(__GNUC__) 10 | # ifdef __attribute__ 11 | # undef __attribute__ 12 | # endif 13 | # define __attribute__(a) 14 | #endif 15 | 16 | #ifdef SODIUM_STATIC 17 | # define SODIUM_EXPORT 18 | # define SODIUM_EXPORT_WEAK 19 | #else 20 | # if defined(_MSC_VER) 21 | # ifdef SODIUM_DLL_EXPORT 22 | # define SODIUM_EXPORT __declspec(dllexport) 23 | # else 24 | # define SODIUM_EXPORT __declspec(dllimport) 25 | # endif 26 | # else 27 | # if defined(__SUNPRO_C) 28 | # ifndef __GNU_C__ 29 | # define SODIUM_EXPORT __attribute__ (visibility(__global)) 30 | # else 31 | # define SODIUM_EXPORT __attribute__ __global 32 | # endif 33 | # elif defined(_MSG_VER) 34 | # define SODIUM_EXPORT extern __declspec(dllexport) 35 | # else 36 | # define SODIUM_EXPORT __attribute__ ((visibility ("default"))) 37 | # endif 38 | # endif 39 | # if defined(__ELF__) && !defined(SODIUM_DISABLE_WEAK_FUNCTIONS) 40 | # define SODIUM_EXPORT_WEAK SODIUM_EXPORT __attribute__((weak)) 41 | # else 42 | # define SODIUM_EXPORT_WEAK SODIUM_EXPORT 43 | # endif 44 | #endif 45 | 46 | #ifndef CRYPTO_ALIGN 47 | # if defined(__INTEL_COMPILER) || defined(_MSC_VER) 48 | # define CRYPTO_ALIGN(x) __declspec(align(x)) 49 | # else 50 | # define CRYPTO_ALIGN(x) __attribute__ ((aligned(x))) 51 | # endif 52 | #endif 53 | 54 | #define SODIUM_MIN(A, B) ((A) < (B) ? (A) : (B)) 55 | #define SODIUM_SIZE_MAX SODIUM_MIN(UINT64_MAX, SIZE_MAX) 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /sodium/include/sodium/randombytes.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef randombytes_H 3 | #define randombytes_H 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #include "export.h" 11 | 12 | #ifdef __cplusplus 13 | # ifdef __GNUC__ 14 | # pragma GCC diagnostic ignored "-Wlong-long" 15 | # endif 16 | extern "C" { 17 | #endif 18 | 19 | typedef struct randombytes_implementation { 20 | const char *(*implementation_name)(void); /* required */ 21 | uint32_t (*random)(void); /* required */ 22 | void (*stir)(void); /* optional */ 23 | uint32_t (*uniform)(const uint32_t upper_bound); /* optional, a default implementation will be used if NULL */ 24 | void (*buf)(void * const buf, const size_t size); /* required */ 25 | int (*close)(void); /* optional */ 26 | } randombytes_implementation; 27 | 28 | #define randombytes_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 0xffffffffUL) 29 | 30 | #define randombytes_SEEDBYTES 32U 31 | SODIUM_EXPORT 32 | size_t randombytes_seedbytes(void); 33 | 34 | SODIUM_EXPORT 35 | void randombytes_buf(void * const buf, const size_t size) 36 | __attribute__ ((nonnull)); 37 | 38 | SODIUM_EXPORT 39 | void randombytes_buf_deterministic(void * const buf, const size_t size, 40 | const unsigned char seed[randombytes_SEEDBYTES]) 41 | __attribute__ ((nonnull)); 42 | 43 | SODIUM_EXPORT 44 | uint32_t randombytes_random(void); 45 | 46 | SODIUM_EXPORT 47 | uint32_t randombytes_uniform(const uint32_t upper_bound); 48 | 49 | SODIUM_EXPORT 50 | void randombytes_stir(void); 51 | 52 | SODIUM_EXPORT 53 | int randombytes_close(void); 54 | 55 | SODIUM_EXPORT 56 | int randombytes_set_implementation(randombytes_implementation *impl) 57 | __attribute__ ((nonnull)); 58 | 59 | SODIUM_EXPORT 60 | const char *randombytes_implementation_name(void); 61 | 62 | /* -- NaCl compatibility interface -- */ 63 | 64 | SODIUM_EXPORT 65 | void randombytes(unsigned char * const buf, const unsigned long long buf_len) 66 | __attribute__ ((nonnull)); 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /sodium/include/sodium/randombytes_internal_random.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef randombytes_internal_random_H 3 | #define randombytes_internal_random_H 4 | 5 | #include "export.h" 6 | #include "randombytes.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | SODIUM_EXPORT 13 | extern struct randombytes_implementation randombytes_internal_implementation; 14 | 15 | /* Backwards compatibility with libsodium < 1.0.18 */ 16 | #define randombytes_salsa20_implementation randombytes_internal_implementation 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /sodium/include/sodium/randombytes_sysrandom.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef randombytes_sysrandom_H 3 | #define randombytes_sysrandom_H 4 | 5 | #include "export.h" 6 | #include "randombytes.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | SODIUM_EXPORT 13 | extern struct randombytes_implementation randombytes_sysrandom_implementation; 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /sodium/include/sodium/runtime.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef sodium_runtime_H 3 | #define sodium_runtime_H 4 | 5 | #include "export.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | SODIUM_EXPORT_WEAK 12 | int sodium_runtime_has_neon(void); 13 | 14 | SODIUM_EXPORT_WEAK 15 | int sodium_runtime_has_sse2(void); 16 | 17 | SODIUM_EXPORT_WEAK 18 | int sodium_runtime_has_sse3(void); 19 | 20 | SODIUM_EXPORT_WEAK 21 | int sodium_runtime_has_ssse3(void); 22 | 23 | SODIUM_EXPORT_WEAK 24 | int sodium_runtime_has_sse41(void); 25 | 26 | SODIUM_EXPORT_WEAK 27 | int sodium_runtime_has_avx(void); 28 | 29 | SODIUM_EXPORT_WEAK 30 | int sodium_runtime_has_avx2(void); 31 | 32 | SODIUM_EXPORT_WEAK 33 | int sodium_runtime_has_avx512f(void); 34 | 35 | SODIUM_EXPORT_WEAK 36 | int sodium_runtime_has_pclmul(void); 37 | 38 | SODIUM_EXPORT_WEAK 39 | int sodium_runtime_has_aesni(void); 40 | 41 | SODIUM_EXPORT_WEAK 42 | int sodium_runtime_has_rdrand(void); 43 | 44 | /* ------------------------------------------------------------------------- */ 45 | 46 | int _sodium_runtime_get_cpu_features(void); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /sodium/include/sodium/version.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef sodium_version_H 3 | #define sodium_version_H 4 | 5 | #include "export.h" 6 | 7 | #define SODIUM_VERSION_STRING "1.0.18" 8 | 9 | #define SODIUM_LIBRARY_VERSION_MAJOR 10 10 | #define SODIUM_LIBRARY_VERSION_MINOR 3 11 | #define SODIUM_LIBRARY_MINIMAL 1 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | SODIUM_EXPORT 18 | const char *sodium_version_string(void); 19 | 20 | SODIUM_EXPORT 21 | int sodium_library_version_major(void); 22 | 23 | SODIUM_EXPORT 24 | int sodium_library_version_minor(void); 25 | 26 | SODIUM_EXPORT 27 | int sodium_library_minimal(void); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /sodium/lib/arm64-v8a/libsodium.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/sodium/lib/arm64-v8a/libsodium.so -------------------------------------------------------------------------------- /sodium/lib/armeabi-v7a/libsodium.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/sodium/lib/armeabi-v7a/libsodium.so -------------------------------------------------------------------------------- /sodium/lib/x86/libsodium.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/sodium/lib/x86/libsodium.so -------------------------------------------------------------------------------- /sodium/lib/x86_64/libsodium.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zood/george/0c76fd63ff85f5a9c33d8a7536a4f7212158d99c/sodium/lib/x86_64/libsodium.so --------------------------------------------------------------------------------