Skip to content
Back to search

https://github.com/vitorpamplona/amethyst

SkillWorks with Claude CodeGitHubIncomplete

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/vitorpamplona/amethyst with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/vitorpamplona/amethyst'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/vitorpamplona-amethyst/badge.svg)](/listings/vitorpamplona-amethyst)

HTML

<a href="/listings/vitorpamplona-amethyst"><img src="/api/listings/vitorpamplona-amethyst/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Make sure to have the following pre-requisites installed: 1. Java 21+ 2. Android Studio 3. Android 8.0+ Phone or Emulation setup

Fork and clone this repository and import it into Android Studio

git clone https://github.com/vitorpamplona/amethyst.git

Use an Android Studio build action to install and run the app on your device or a simulator.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 230 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # Amethyst Builder Skill
  2. Build customized Amethyst Nostr clients for Android. Fork, rebrand, customize, and distribute your own version.
  3. ## Overview
  4. [Amethyst](https://github.com/vitorpamplona/amethyst) is the premier Nostr client for Android. This skill enables you to:
  5. - Create rebranded versions (custom name, package, icons)
  6. - Build F-Droid-compatible releases (no Google Play dependencies)
  7. - Add or modify features
  8. - Sign and distribute APKs
  9. ## Prerequisites
  10. ### Required Tools
  11. 1. **Java 21** (via SDKMAN)
  12. ```bash
  13. curl -s "https://get.sdkman.io" | bash
  14. source "$HOME/.sdkman/bin/sdkman-init.sh"
  15. sdk install java 21.0.5-tem
  16. sdk use java 21.0.5-tem
  17. ```
  18. 2. **Android SDK**
  19. - Command-line tools from https://developer.android.com/studio#command-line-tools-only
  20. - Required components: build-tools, platform-tools, platforms;android-37
  21. - The exact SDK level is `android-compileSdk` in `gradle/libs.versions.toml` —
  22. check there if this number has drifted.
  23. 3. **Git** for cloning the repository
  24. ### Environment Setup
  25. ```bash
  26. export ANDROID_HOME=$HOME/Android/Sdk
  27. export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
  28. export PATH=$PATH:$ANDROID_HOME/platform-tools
  29. ```
  30. ## Build Workflow
  31. ### 1. Clone the Repository
  32. ```bash
  33. mkdir -p ~/projects/your-app-name
  34. cd ~/projects/your-app-name
  35. git clone https://github.com/vitorpamplona/amethyst.git .
  36. ```
  37. ### 2. Create Signing Key
  38. ```bash
  39. keytool -genkeypair -v \
  40. -keystore ./release-key.jks \
  41. -alias your-app \
  42. -keyalg RSA -keysize 2048 \
  43. -validity 10000
  44. ```
  45. Create `keystore.properties` in project root:
  46. ```properties
  47. storeFile=release-key.jks
  48. storePassword=your-password
  49. keyAlias=your-app
  50. keyPassword=your-password
  51. ```
  52. ### 3. Configure Signing
  53. Add to `amethyst/build.gradle.kts` inside the `android {}` block:
  54. ```kotlin
  55. val keystorePropertiesFile = rootProject.file("keystore.properties")
  56. val keystoreProperties = Properties()
  57. if (keystorePropertiesFile.exists()) {
  58. keystorePropertiesFile.inputStream().use { keystoreProperties.load(it) }
  59. }
  60. signingConfigs {
  61. create("release") {
  62. if (keystorePropertiesFile.exists()) {
  63. storeFile = rootProject.file(keystoreProperties["storeFile"] as String)
  64. storePassword = keystoreProperties["storePassword"] as String
  65. keyAlias = keystoreProperties["keyAlias"] as String
  66. keyPassword = keystoreProperties["keyPassword"] as String
  67. }
  68. }
  69. }
  70. ```
  71. This needs `import java.util.Properties` at the top of the file.
  72. Update the release buildType to use the signing config:
  73. ```kotlin
  74. buildTypes {
  75. getByName("release") {
  76. signingConfig = signingConfigs.getByName("release")
  77. // ... existing config
  78. }
  79. }
  80. ```
  81. Verify with `./gradlew :amethyst:signingReport` — the release variants should
  82. report your keystore rather than `~/.android/debug.keystore`.
  83. ### 4. Disable Google Services (Required for F-Droid)
  84. **⚠️ CRITICAL:** The Google Services plugin fails when you change the package name. For F-Droid builds, disable it.
  85. Edit `amethyst/build.gradle.kts`, comment out the plugin:
  86. ```kotlin
  87. plugins {
  88. alias(libs.plugins.androidApplication)
  89. // alias(libs.plugins.googleServices) // DISABLED for F-Droid
  90. alias(libs.plugins.jetbrainsComposeCompiler)
  91. alias(libs.plugins.serialization)
  92. alias(libs.plugins.googleKsp)
  93. }
  94. ```
  95. ### 5. Build
  96. ```bash
  97. source "$HOME/.sdkman/bin/sdkman-init.sh"
  98. sdk use java 21.0.5-tem
  99. ./gradlew assembleFdroidRelease
  100. ```
  101. **Build time:** ~9 minutes first build, faster on subsequent builds.
  102. ### 6. Locate APKs
  103. Output directory: `amethyst/build/outputs/apk/fdroid/release/`
  104. Files generated:
  105. - `amethyst-fdroid-arm64-v8a-release.apk` - ARM64 (most phones)
  106. - `amethyst-fdroid-universal-release.apk` - All architectures (larger)
  107. ## Customizations
  108. ### Change App Name
  109. Edit `amethyst/src/main/res/values/strings.xml`:
  110. ```xml
  111. <string name="app_name" translatable="false">YourAppName</string>
  112. <string name="app_name_debug" translatable="false">YourAppName Debug</string>
  113. ```
  114. ### Change Package ID
  115. Edit `amethyst/build.gradle.kts`:
  116. ```kotlin
  117. android {
  118. defaultConfig {
  119. applicationId = "com.yourcompany.yourapp"
  120. }
  121. }
  122. ```
  123. ### Change Project Name
  124. Edit `settings.gradle.kts`:
  125. ```kotlin
  126. rootProject.name = "YourAppName"
  127. ```
  128. ### Change App Icon
  129. Replace icon files in:
  130. - `amethyst/src/main/res/mipmap-*/ic_launcher.webp`
  131. - `amethyst/src/main/res/mipmap-*/ic_launcher_round.webp`
  132. ### Add Client Tag to Posts
  133. Make your app identify itself on posts with `["client", "YourAppName"]`.
  134. You do **not** need to add the tag per event type. The client tag is applied
  135. centrally by `NostrSignerWithClientTag`, a signer decorator that appends the tag
  136. to everything it signs (and respects the user's "add client tag" privacy
  137. setting). Changing the name is a one-constant edit:
  138. Edit `amethyst/src/main/java/com/vitorpamplona/amethyst/model/accountsCache/AccountCacheState.kt`:
  139. ```kotlin
  140. const val CLIENT_TAG_NAME = "YourAppName"
  141. ```
  142. That constant is passed to `NostrSignerWithClientTag` when the account's signer
  143. is built, so every signed event carries your name.
  144. The tag itself lives in the Quartz library
  145. ([`nip89AppHandlers/clientTag/`](https://github.com/vitorpamplona/quartz/tree/main/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip89AppHandlers/clientTag),
  146. `ClientTag`, `TagArrayBuilderExt`, `NostrSignerWithClientTag`) — you only need to
  147. touch it if you want the optional NIP-89 handler address / relay hint variants.
  148. ### Modify Default Relays
  149. Edit `commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/defaults/Constants.kt`
  150. (see also `AmethystDefaults.kt` and `DefaultDmIndexerRelays.kt` in the same folder).
  151. ## Troubleshooting
  152. ### google-services.json error
  153. Disable the Google Services plugin (see step 4).
  154. ### Java version error
  155. ```bash
  156. sdk use java 21.0.5-tem
  157. java -version # Must show 21.x
  158. ```
  159. ### Out of memory
  160. Edit `gradle.properties`:
  161. ```properties
  162. org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m
  163. ```
  164. ### Clean build
  165. ```bash
  166. ./gradlew --stop
  167. ./gradlew clean
  168. ./gradlew assembleFdroidRelease
  169. ```
  170. ## Distribution
  171. Deploy APKs via:
  172. - **Surge.sh:** `surge ./releases your-app.surge.sh`
  173. - **Zapstore:** Submit to zapstore.dev
  174. - **Direct download:** Host on any web server
README.md · README · 396 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <div align="center">
  2. <a href="https://amethyst.social">
  3. <img src="./docs/design/3rd%20Logo%20-%20Zitron/amethyst.svg" alt="Amethyst Logo" title="Amethyst logo" width="80"/>
  4. </a>
  5. # Amethyst
  6. ## Nostr Client for Android
  7. Join the social network you control.
  8. [![GitHub downloads](https://img.shields.io/github/downloads/vitorpamplona/amethyst/total?label=Downloads&labelColor=27303D&color=0D1117&logo=github&logoColor=FFFFFF&style=flat)](https://github.com/vitorpamplona/amethyst/releases)
  9. [![PlayStore downloads](https://img.shields.io/endpoint?color=green&logo=google-play&logoColor=green&url=https%3A%2F%2Fplay.cuzi.workers.dev%2Fplay%3Fi%3Dcom.vitorpamplona.amethyst%26gl%3DUS%26hl%3Den%26l%3DPlayStore%26m%3D%24shortinstalls)](https://play.google.com/store/apps/details?id=com.vitorpamplona.amethyst)
  10. [![Last Version](https://img.shields.io/github/release/vitorpamplona/amethyst.svg?maxAge=3600&label=Stable&labelColor=06599d&color=043b69)](https://github.com/vitorpamplona/amethyst)
  11. [![Maven Central](https://img.shields.io/maven-central/v/com.vitorpamplona.quartz/quartz?label=Quartz%20%28Maven%20Central%29&labelColor=27303D&color=0877d2)](https://central.sonatype.com/artifact/com.vitorpamplona.quartz/quartz)
  12. [![JitPack snapshots](https://img.shields.io/badge/Quartz%20snapshots-JitPack-27303D?labelColor=27303D&color=0877d2)](https://jitpack.io/#vitorpamplona/quartz)
  13. [![CI](https://img.shields.io/github/actions/workflow/status/vitorpamplona/amethyst/build.yml?labelColor=27303D)](https://github.com/vitorpamplona/amethyst/actions/workflows/build.yml)
  14. [![License: MIT](https://img.shields.io/github/license/vitorpamplona/amethyst?labelColor=27303D&color=0877d2)](/LICENSE)
  15. ## Download and Install
  16. ### Android
  17. [<img src="./docs/design/zapstore.svg"
  18. alt="Get it on Zap Store"
  19. height="70">](https://github.com/zapstore/zapstore/releases)
  20. [<img src="./docs/design/obtainium.png"
  21. alt="Get it on Obtaininum"
  22. height="70">](https://github.com/ImranR98/Obtainium)
  23. [<img src="https://github.com/machiav3lli/oandbackupx/raw/034b226cea5c1b30eb4f6a6f313e4dadcbb0ece4/badge_github.png" alt="Get it on GitHub"
  24. height="70">](https://github.com/vitorpamplona/amethyst/releases)
  25. [<img src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png"
  26. alt="Get it on Google Play"
  27. height="70">](https://play.google.com/store/apps/details?id=com.vitorpamplona.amethyst)
  28. ### Desktop
  29. | OS | CLI install | Direct download |
  30. |---|---|---|
  31. | macOS (Apple Silicon) | `brew install --cask amethyst-nostr` | [.dmg arm64](https://github.com/vitorpamplona/amethyst/releases/latest) |
  32. | Windows 10/11 | `winget install VitorPamplona.Amethyst` | [.msi](https://github.com/vitorpamplona/amethyst/releases/latest) · [.zip portable](https://github.com/vitorpamplona/amethyst/releases/latest) |
  33. | Debian/Ubuntu | — | [.deb](https://github.com/vitorpamplona/amethyst/releases/latest) |
  34. | Fedora/RHEL/openSUSE | — | [.rpm](https://github.com/vitorpamplona/amethyst/releases/latest) |
  35. | Any Linux | — | [AppImage](https://github.com/vitorpamplona/amethyst/releases/latest) · [.tar.gz](https://github.com/vitorpamplona/amethyst/releases/latest) |
  36. _Coming soon (separate PR): Scoop (Windows), AUR (Arch Linux)._
  37. **Build from source:** see [BUILDING.md](BUILDING.md).
  38. **Install troubleshooting** (Gatekeeper / SmartScreen / AppImage): see
  39. [BUILDING.md § Troubleshooting installs](BUILDING.md#troubleshooting-installs).
  40. </div>
  41. ## Verifying the APK signature
  42. If you sideload Amethyst (Obtainium, GitHub Releases, Zap Store), verify that your
  43. APK is signed by the official release key before installing. All official Amethyst
  44. APKs — both the `googleplay` and `fdroid` flavors — are signed with the same
  45. certificate, whose SHA-256 fingerprint is:
  46. ```
  47. C2:D0:AA:86:BC:B6:B6:20:90:56:1A:41:BB:E3:36:E9:8B:78:C2:D0:21:0A:49:8D:C8:85:F2:8E:13:48:CF:17
  48. ```
  49. To check a downloaded APK yourself, run (`apksigner` ships with the Android SDK
  50. build-tools):
  51. ```bash
  52. apksigner verify --print-certs amethyst-*.apk
  53. ```
  54. and confirm the reported `Signer #1 certificate SHA-256 digest` is
  55. `c2d0aa86bcb6b62090561a41bbe336e98b78c2d0210a498dc885f28e1348cf17`.
  56. Without the Android SDK, `keytool -printcert -jarfile amethyst-*.apk` (bundled
  57. with any JDK) prints the same SHA-256 fingerprint.
  58. With [AppVerifier](https://github.com/soupslurpr/appverifier), paste or share the
  59. APK and compare against:
  60. ```
  61. com.vitorpamplona.amethyst
  62. C2:D0:AA:86:BC:B6:B6:20:90:56:1A:41:BB:E3:36:E9:8B:78:C2:D0:21:0A:49:8D:C8:85:F2:8E:13:48:CF:17
  63. ```
  64. ## Supported Features
  65. <img align="right" src="./docs/screenshots/home.png" data-canonical-src="./docs/screenshots/home.png" width="350px">
  66. - [x] Basic protocol flow (NIP-01)
  67. - [x] Follow List (NIP-02)
  68. - [x] OpenTimestamps Attestations (NIP-03)
  69. - [x] Encrypted Direct Message (NIP-04)
  70. - [x] DNS-based Identifiers (NIP-05)
  71. - [x] Key Derivation from Mnemonic (NIP-06)
  72. - [ ] window.nostr for Web Browsers (NIP-07, Not applicable)
  73. - [x] Handling Mentions (NIP-08)
  74. - [x] Event Deletion Request (NIP-09)
  75. - [x] Text Notes and Threads (NIP-10)
  76. - [x] Relay Information Document (NIP-11)
  77. - [x] Proof of Work (NIP-13)
  78. - [x] Subject Tag in Text Events (NIP-14)
  79. - [x] Nostr Marketplace (NIP-15)
  80. - [x] Private Direct Messages (NIP-17)
  81. - [x] Reposts (NIP-18)
  82. - [x] bech32-encoded Entities (NIP-19)
  83. - [x] nostr: URI Scheme (NIP-21)
  84. - [x] Comment (NIP-22)
  85. - [x] Long-form Content (NIP-23)
  86. - [x] Extra Metadata Fields and Tags (NIP-24)
  87. - [x] Reactions (NIP-25)
  88. - [x] Delegated Event Signing (NIP-26)
  89. - [x] Text Note References (NIP-27)
  90. - [x] Public Chat (NIP-28)
  91. - [x] Relay-based Groups (NIP-29)
  92. - [x] Custom Emoji (NIP-30)
  93. - [x] Dealing with Unknown Events (NIP-31)
  94. - [x] Labeling (NIP-32)
  95. - [x] git stuff (NIP-34)
  96. - [x] Torrents (NIP-35)
  97. - [x] Sensitive Content (NIP-36)
  98. - [x] Draft Events (NIP-37)
  99. - [x] User Statuses (NIP-38)
  100. - [x] External Identities in Profiles (NIP-39)
  101. - [x] Expiration Timestamp (NIP-40)
  102. - [x] Authentication of Clients to Relays (NIP-42)
  103. - [x] Relay Access Metadata and Requests (NIP-43)
  104. - [x] Encrypted Payloads / Versioned (NIP-44)
  105. - [x] Counting Results (NIP-45)
  106. - [x] Nostr Remote Signing (NIP-46)
  107. - [x] Nostr Wallet Connect (NIP-47)
  108. - [x] Proxy Tags (NIP-48)
  109. - [x] Private Key Encryption (NIP-49)
  110. - [x] Search Capability (NIP-50)
  111. - [x] Lists (NIP-51)
  112. - [x] Calendar Events (NIP-52)
  113. - [x] Live Activities (NIP-53)
  114. - [x] Wiki (NIP-54)
  115. - [x] Android Signer Application (NIP-55)
  116. - [x] Reporting (NIP-56)
  117. - [x] Lightning Zaps (NIP-57)
  118. - [x] Zap Splits (NIP-57)
  119. - [x] Private Zaps (NIP-57)
  120. - [x] Zapraiser (NIP-57)
  121. - [x] Badges (NIP-58)
  122. - [x] Gift Wrap (NIP-59)
  123. - [x] Pubkey Static Websites (NIP-5A)
  124. - [x] Cashu Wallet (NIP-60)
  125. - [x] Nutzaps (NIP-61)
  126. - [x] Request to Vanish (NIP-62)
  127. - [x] Chess / PGN (NIP-64)
  128. - [x] Relay List Metadata (NIP-65)
  129. - [x] Relay Discovery and Liveness Monitoring (NIP-66)
  130. - [x] Picture-first Feeds (NIP-68)
  131. - [x] Peer-to-peer Order Events (NIP-69)
  132. - [x] Protected Events (NIP-70)
  133. - [x] Video Events (NIP-71)
  134. - [x] Moderated Communities (NIP-72)
  135. - [x] External Content IDs (NIP-73)
  136. - [x] Zap Goals (NIP-75)
  137. - [x] Negentropy Syncing (NIP-77)
  138. - [x] Application-specific Data (NIP-78)
  139. - [x] Threads (NIP-7D)
  140. - [x] Highlights (NIP-84)
  141. - [x] Trusted Assertions (NIP-85)
  142. - [x] Relay Management API (NIP-86)
  143. - [x] Ecash Mint Discoverability (NIP-87)
  144. - [x] Polls (NIP-88)
  145. - [x] Recommended Application Handlers (NIP-89)
  146. - [x] Data Vending Machines (NIP-90)
  147. - [x] Media Attachments (NIP-92)
  148. - [x] File Metadata (NIP-94)
  149. - [x] Binary Blobs (NIP-95/Draft)
  150. - [x] HTTP File Storage Integration (NIP-96)
  151. - [x] HTTP Auth (NIP-98)
  152. - [x] Classified Listings (NIP-99)
  153. - [x] Voice Messages (NIP-A0)
  154. - [x] Public Messages (NIP-A4)
  155. - [x] Web Bookmarks (NIP-B0)
  156. - [x] Blossom (NIP-B7)
  157. - [x] Nostr BLE Communications Protocol (NIP-BE)
  158. - [x] Code Snippets (NIP-C0)
  159. - [x] Chats (NIP-C7)
  160. - [ ] MLS Protocol (NIP-EE)
  161. - [x] Audio Tracks (zapstr.live) (kind:31337)
  162. - [x] Lightning Tips
  163. - [x] Image/Video/Url/LnInvoice/Cashu Previews
  164. - [x] Push Notifications (Google and Unified Push)
  165. - [x] In-Device Automatic Translations
  166. - [x] Hashtag Following and Custom Hashtags
  167. - [x] Login with QR
  168. - [x] Bounty support (nostrbounties.com)
  169. - [x] De-googled F-Droid flavor
  170. - [x] Multiple Accounts
  171. - [x] Markdown Support
  172. - [x] Medical Data (NIP-xx/Draft)
  173. - [x] Embed events (NIP-xx/Draft)
  174. - [x] Edit Short Notes (NIP-xx/Draft)
  175. - [x] NIP Events (NIP-xx/Draft)
  176. - [ ] Relationship Status (NIP-xx/Draft)
  177. - [ ] Signed Filters (NIP-xx/Draft)
  178. - [ ] Key Migration (NIP-xx/Draft)
  179. - [x] Image Capture in the app
  180. - [x] Video Capture in the app
  181. - [ ] Local Database
  182. - [ ] Workspaces
  183. ## Privacy and Information Permanence
  184. Relays know your IP address, your name, your location (guessed from IP), your pub key, all your contacts, and other relays, and can read every action you do (post, like, boost, quote, report, etc) except for Private Zaps and Private DMs. While the content of direct messages (DMs) is only visible to you and your DM counterparty, everyone can see when you and your counterparty DM each other.
  185. If you want to improve your privacy, consider utilizing a service that masks your IP address (e.g. a VPN or Tor) from trackers online.
  186. The relay also learns which public keys you are requesting, meaning your public key will be tied to your IP address.
  187. Information shared on Nostr can be re-broadcasted to other servers and should be assumed permanent for privacy purposes. There is no way to guarantee the deletion of any content once posted.
  188. # Development Overview
  189. This repository holds the apps and the code they share:
  190. - **Amethyst** - The Android app: a thin shim around the shared UI, plus Android services and system integrations
  191. - **Commons** - Kotlin Multiplatform headless layer: models, state, ViewModels, the relay client
  192. - **CommonsUI** - Compose Multiplatform UI on top of Commons: every screen, the navigation shell, icons, theme, strings
  193. - **DesktopApp** - The desktop app: a JVM shim that renders the same shared UI
  194. - **cli** - `amy`, a non-interactive command-line client over Quartz and Commons
  195. - **nestsClient** - The audio-rooms (MoQ) client; **geode** - a standalone Nostr relay
  196. The protocol code lives in its own Kotlin Multiplatform libraries, each in its own repo and on Maven Central:
  197. | Library | What it is |
  198. |---|---|
  199. | [Quartz](https://github.com/vitorpamplona/quartz) | The Nostr protocol: events, NIPs, signers, the relay client, Marmot's event classes |
  200. | [crypto-kmp](https://github.com/vitorpamplona/crypto-kmp) | Hashes, MACs, HKDF, AES, ChaCha20, X25519 and Ed25519, with no dependencies |
  201. | [mls-kmp](https://github.com/vitorpamplona/mls-kmp) | The RFC 9420 MLS engine |
  202. | [marmot-kmp](https://github.com/vitorpamplona/marmot-kmp) | Marmot, MLS group chats over Nostr |
  203. | [cordn-kmp](https://github.com/vitorpamplona/cordn-kmp) | cordn, MLS group chats over an MCP coordinator |
  204. | [quic-kmp](https://github.com/vitorpamplona/quic-kmp) | A pure-Kotlin QUIC, HTTP/3 and WebTransport client |
  205. [AGENTS.md](AGENTS.md) says what goes in which repo.
  206. The app architecture consists of the UI, which uses the usual State/ViewModel/Composition, the service layer that connects with Nostr relays,
  207. and the model/repository layer, which keeps all Nostr objects in memory, in a full OO graph.
  208. The repository layer stores Nostr Events as Notes and Users separately. Those classes use LiveData and Flow objects to
  209. allow the UI and other parts of the app to subscribe to each Note/User and receive updates when they happen.
  210. They are also responsible for updating viewModels when needed. As the user scrolls through Events, the Datasource classes
  211. are updated to receive more information about those particular Events.
  212. Most of the UI is reactive to changes in the repository classes. The service layer assembles Nostr filters for each need of the app,
  213. receives the data from the Relay, and sends it to the repository. Connection with relays is never closed during the use of the app.
  214. The UI receives a notification that objects have been updated. Instances of User and Notes are mutable directly.
  215. There will never be two Notes with the same ID or two User instances with the same pubkey.
  216. Lastly, the user's account information (private key/pub key) is stored in the Android KeyStore for security.
  217. ## Setup
  218. Make sure to have the following pre-requisites installed:
  219. 1. Java 21+
  220. 2. Android Studio
  221. 3. Android 8.0+ Phone or Emulation setup
  222. Fork and clone this repository and import it into Android Studio
  223. ```bash
  224. git clone https://github.com/vitorpamplona/amethyst.git
  225. ```
  226. Use an Android Studio build action to install and run the app on your device or a simulator.
  227. ## Building
  228. Build the Android app:
  229. ```bash
  230. ./gradlew assembleDebug
  231. ```
  232. Build and run the Desktop app (requires Java 21+):
  233. ```bash
  234. ./gradlew :desktopApp:run
  235. ```
  236. Full build (including tests)
  237. ```bash
  238. ./gradlew build
  239. ```
  240. Requirements:
  241. - Xcode and iOS simulator
  242. - libsodium installed (e.g. via brew: `brew install libsodium`
  243. ## Testing
  244. ```bash
  245. ./gradlew test
  246. ./gradlew connectedAndroidTest
  247. ```
  248. ## Linting
  249. ```bash
  250. ./gradlew spotlessCheck
  251. ./gradlew spotlessApply
  252. ```
  253. ## Installing on device
  254. For the F-Droid build:
  255. ```bash
  256. ./gradlew installFdroidDebug
  257. ```
  258. For the Play build:
  259. ```bash
  260. ./gradlew installPlayDebug
  261. ```
  262. ## Deploying
  263. A release is one tag push. Bump `app` and `appCode` in
  264. `gradle/libs.versions.toml`, then `git tag -s vX.Y.Z && git push --tags` — the
  265. `Create Release Assets` workflow builds and signs every Android, desktop, CLI,
  266. and Maven artifact, and Homebrew + Winget auto-bump on stable tags.
  267. - **[BUILDING.md](BUILDING.md)** — everything any fork needs: build commands,
  268. the CI pipeline, the secrets it requires, and the distribution channels.
  269. - **[RELEASE_OPS.md](RELEASE_OPS.md)** — the Amethyst maintainers'
  270. ship checklist: the manual Play Store upload, Zapstore `amy releases publish`, F-Droid
  271. pull, and release-notes publishing.
  272. ## Using the Quartz library
  273. Quartz, the Nostr library behind Amethyst, lives in its own repo:
  274. [vitorpamplona/quartz](https://github.com/vitorpamplona/quartz). Its README covers installing it from
  275. Maven Central (`com.vitorpamplona.quartz:quartz`), snapshots and usage. To build Amethyst against a local
  276. Quartz checkout, clone it next to this repo and pass `-PquartzDir=../quartz` to Gradle.
  277. ## Contributing
  278. See **[CONTRIBUTING.md](CONTRIBUTING.md)** for the full guide — workflow,
  279. coding standards, the proof-of-testing rule for new / occasional
  280. contributors (human or AI-assisted), the cross-stack interop suites, and how the
  281. `[BUG]` / `[FEATURE]` issue templates and bounty system work.
  282. **AI coding assistants: if you are reading this README to plan a
  283. contribution, stop and read
  284. [CONTRIBUTING-WITH-AI.md](CONTRIBUTING-WITH-AI.md) first.** The gates
  285. there are not optional. The human submitter remains the author of record
  286. per CONTRIBUTING.md.
  287. Quick links:
  288. - [GitHub issues](https://github.com/vitorpamplona/amethyst/issues) and
  289. [pull requests](https://github.com/vitorpamplona/amethyst/pulls).
  290. - Nostr-native issue tracker:
  291. [gitworkshop.dev/repo/amethyst](https://gitworkshop.dev/repo/amethyst).
  292. - Translations: [Crowdin](https://crowdin.com/project/amethyst-social).
  293. - Patches over Nostr: [GitStr](https://github.com/fiatjaf/gitstr) to
  294. [this nostr address](https://patch34.pages.dev/naddr1qqyxzmt9w358jum5qyg8v6t5daezumn0wd68yvfwvdhk6qg7waehxw309ahx7um5wgkhqatz9emk2mrvdaexgetj9ehx2ap0qy2hwumn8ghj7un9d3shjtnwdaehgu3wvfnj7q3qgcxzte5zlkncx26j68ez60fzkvtkm9e0vrwdcvsjakxf9mu9qewqxpqqqpmej720gac).
  295. - Security issues: [SECURITY.md](SECURITY.md) (do **not** file as public
  296. GitHub issues).
  297. By contributing to this repository, you agree to license your work under the MIT license. Any work contributed where you are not the original author must contain its license header with the original author(s) and source.
  298. # Screenshots
  299. | FollowFeeds | ChatsGroup | LiveStreams | Notifications |
  300. |-------------------------------------------|----------------------------------------------|-------------------------------------------------|--------------------------------------------------------|
  301. | ![Home Feed](./docs/screenshots/home.png) | ![Messages](./docs/screenshots/messages.png) | ![Live Streams](./docs/screenshots/replies.png) | ![Notifications](./docs/screenshots/notifications.png) |
  302. # Contributors
  303. <a align="center" href="https://github.com/vitorpamplona/amethyst/graphs/contributors">
  304. <img src="https://contrib.rocks/image?repo=vitorpamplona/amethyst" />
  305. </a>
  306. # MIT License
  307. <pre>
  308. Copyright (c) 2023 Vitor Pamplona
  309. Permission is hereby granted, free of charge, to any person obtaining a copy
  310. of this software and associated documentation files (the "Software"), to deal
  311. in the Software without restriction, including without limitation the rights
  312. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  313. copies of the Software, and to permit persons to whom the Software is
  314. furnished to do so, subject to the following conditions:
  315. The above copyright notice and this permission notice shall be included in all
  316. copies or substantial portions of the Software.
  317. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  318. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  319. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  320. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  321. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  322. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  323. SOFTWARE.
  324. </pre>
scripts/retrace.sh · Bundled script · 259 lines · 1 finding marked
  1. #!/usr/bin/env bash
  2. #
  3. # Turn an obfuscated Amethyst crash report back into real class, method, file
  4. # and line names.
  5. #
  6. # scripts/retrace.sh report.txt # figures out the release by itself
  7. # pbpaste | scripts/retrace.sh # ... or straight off the clipboard
  8. #
  9. # A report produced by ReportAssembler names its own build on line 1:
  10. #
  11. # java.lang.IllegalStateException: 1.16.0-PLAY
  12. #
  13. # so that is all this needs to fetch the right mapping from the matching GitHub
  14. # Release (amethyst-googleplay-mapping-v1.16.0.txt.gz) and cache it.
  15. #
  16. # If you only have a bare stack trace with no such header, name the build:
  17. #
  18. # scripts/retrace.sh --release v1.16.0 --flavor play trace.txt
  19. #
  20. # ... or point at a mapping yourself, e.g. for a build you made locally:
  21. #
  22. # scripts/retrace.sh amethyst/build/outputs/mapping/playRelease/mapping.txt trace.txt
  23. #
  24. # Mappings are never guessed at. Every frame of an obfuscated trace carries
  25. # `r8-map-id-<hash>`, which is the `pg_map_id` of the one mapping that produced
  26. # that build, so the mapping is checked against the report before any output is
  27. # printed — a wrong mapping produces plausible, wrong answers, which is worse
  28. # than no answer. --force overrides.
  29. #
  30. # The R8 that does the work is fetched at the version recorded in the mapping's
  31. # own header, so there is no tooling to pin and this keeps working across AGP
  32. # bumps.
  33. #
  34. # Everything is cached under ~/.cache/amethyst-retrace/, and that cache is not
  35. # small: a mapping is ~29 MB compressed and ~500 MB expanded, per release you
  36. # retrace. `rm -rf ~/.cache/amethyst-retrace` whenever you want it back; the
  37. # next run re-downloads.
  38. set -euo pipefail
  39. REPO="${AMETHYST_REPO:-vitorpamplona/amethyst}"
  40. CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/amethyst-retrace"
  41. MAPPING=""
  42. RELEASE=""
  43. FLAVOR=""
  44. REPORT=""
  45. FORCE=0
  46. die() { echo "error: $*" >&2; exit 2; }
  47. usage() {
  48. sed -n '3,30p' "$0" | sed 's/^# \{0,1\}//'
  49. exit "${1:-2}"
  50. }
  51. # The first 4 KiB of a mapping, which is where R8 puts its whole header. Read
  52. # once, into a variable: `sed ... "$MAPPING" | head -1` would stream all ~500 MB
  53. # looking for a line that is always in the first hundred bytes, and would also
  54. # leave the pipeline's status at head's SIGPIPE.
  55. mapping_header() {
  56. case "$1" in
  57. *.gz) gunzip -c "$1" 2>/dev/null | head -c 4096 || true ;;
  58. *) head -c 4096 "$1" 2>/dev/null || true ;;
  59. esac
  60. }
  61. # A mapping file, or the report? Decide by content, not by extension, so both
  62. # documented argument orders keep working.
  63. #
  64. # Deliberately NOT `... | grep -q`: `grep -q` exits at the first match, the
  65. # producer takes SIGPIPE, and `set -o pipefail` then reports the whole pipeline
  66. # as failed — so a real mapping.txt.gz was classified as a report and the actual
  67. # report came back as "unexpected argument".
  68. looks_like_mapping() {
  69. [ -f "$1" ] || return 1
  70. case "$1" in
  71. *.prt) return 0 ;;
  72. esac
  73. case "$(mapping_header "$1")" in
  74. "# compiler"*) return 0 ;;
  75. *) return 1 ;;
  76. esac
  77. }
  78. while [ $# -gt 0 ]; do
  79. case "$1" in
  80. --release) RELEASE="${2:-}"; shift 2 ;;
  81. --flavor) FLAVOR="${2:-}"; shift 2 ;;
  82. --mapping) MAPPING="${2:-}"; shift 2 ;;
  83. --force) FORCE=1; shift ;;
  84. -h|--help) usage 0 ;;
  85. -*) die "unknown option $1 (try --help)" ;;
  86. *)
  87. if [ -z "$MAPPING" ] && [ -z "$RELEASE" ] && looks_like_mapping "$1"; then
  88. MAPPING="$1"
  89. elif [ -z "$REPORT" ]; then
  90. REPORT="$1"
  91. else
  92. die "unexpected argument $1"
  93. fi
  94. shift ;;
  95. esac
  96. done
  97. mkdir -p "$CACHE"
  98. TMP="$(mktemp -d)"
  99. trap 'rm -rf "$TMP"' EXIT
  100. # ---- materialise the report ------------------------------------------------
  101. # Always to a file: we have to read it twice (header, map id) before retracing,
  102. # and that is not possible on a pipe.
  103. REPORT_FILE="$TMP/report.txt"
  104. if [ -n "$REPORT" ]; then
  105. [ -f "$REPORT" ] || die "no such file: $REPORT"
  106. cp "$REPORT" "$REPORT_FILE"
  107. else
  108. [ -t 0 ] && echo "reading the report from stdin (ctrl-D when done) ..." >&2
  109. cat > "$REPORT_FILE"
  110. fi
  111. [ -s "$REPORT_FILE" ] || die "the report is empty"
  112. # Retrace only rewrites frames it recognises, and it recognises them by the
  113. # leading `at`. Reports from Amethyst builds before the ReportAssembler fix
  114. # wrote bare " com.foo.Bar.baz(File.kt:12)" lines, which would otherwise be
  115. # passed through still obfuscated and look like a mapping problem. Put the `at`
  116. # back on any frame-shaped line that is missing it. Anything that is not
  117. # <indent><dotted.name>(<something>:<digits>) is left exactly as it is.
  118. sed -E 's/^([[:space:]]+)([A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z0-9_$<>]+)+\([^()]*:[0-9]+\))[[:space:]]*$/\1at \2/' \
  119. "$REPORT_FILE" > "$TMP/normalised.txt"
  120. mv "$TMP/normalised.txt" "$REPORT_FILE"
  121. # ---- work out which mapping --------------------------------------------------
  122. if [ -z "$MAPPING" ]; then
  123. if [ -z "$RELEASE" ]; then
  124. # --auto: parse "<exception>: <version>-<FLAVOR>" off line 1.
  125. header="$(head -1 "$REPORT_FILE" | tr -d '\r')"
  126. case "$header" in
  127. *": "*) ;;
  128. *) die "line 1 is not an Amethyst crash-report header, so the build is unknown.
  129. Pass --release <tag> [--flavor play|fdroid], or a mapping file." ;;
  130. esac
  131. vf="${header#*: }"
  132. vf="$(echo "$vf" | tr -d '[:space:]')"
  133. [ -n "$vf" ] || die "line 1 has no '<version>-<FLAVOR>' after the exception name."
  134. parsed_flavor="${vf##*-}"
  135. version="${vf%-*}"
  136. [ -n "$parsed_flavor" ] && [ -n "$version" ] && [ "$version" != "$vf" ] \
  137. || die "cannot read '<version>-<FLAVOR>' out of line 1: $header"
  138. [ -n "$FLAVOR" ] || FLAVOR="$parsed_flavor"
  139. case "$version" in
  140. [0-9]*.[0-9]*.[0-9]*) ;;
  141. *) die "line 1 reports version '$version', which is not a release version." ;;
  142. esac
  143. # generateVersionName() appends the git branch on non-main builds, so a
  144. # dev build reads e.g. 1.16.0-my-branch-PLAY. There is no release for it.
  145. case "$version" in
  146. *[!0-9.]*) die "version '$version' carries a branch suffix, so this is a local/CI
  147. build, not a release — its mapping was never published. Retrace against
  148. that build's own amethyst/build/outputs/mapping/<variant>/mapping.txt." ;;
  149. esac
  150. RELEASE="v$version"
  151. fi
  152. case "$RELEASE" in v*) ;; *) RELEASE="v$RELEASE" ;; esac
  153. case "$(echo "${FLAVOR:-play}" | tr '[:upper:]' '[:lower:]')" in
  154. play|googleplay) channel=googleplay ;;
  155. fdroid) channel=fdroid ;;
  156. *) die "unknown flavor '$FLAVOR' (expected play or fdroid)" ;;
  157. esac
  158. asset="amethyst-${channel}-mapping-${RELEASE}.txt.gz"
  159. MAPPING="$CACHE/$asset"
  160. if [ ! -s "$MAPPING" ]; then
  161. url="https://github.com/${REPO}/releases/download/${RELEASE}/${asset}"
  162. echo "fetching $asset ..." >&2
  163. curl -fsSL -o "$MAPPING.tmp" "$url" || {
  164. rm -f "$MAPPING.tmp"
  165. die "could not download $url
  166. Either that release predates mapping publication (builds up to v1.16.0
  167. were not obfuscated — read those traces as-is), or the flavor is wrong.
  168. Assets: gh release view $RELEASE --json assets --jq '.assets[].name'"
  169. }
  170. mv "$MAPPING.tmp" "$MAPPING"
  171. fi
  172. fi
  173. [ -f "$MAPPING" ] || die "no such mapping: $MAPPING"
  174. # Keep the name the user actually gave us for error messages — once a .gz is
  175. # expanded, $MAPPING points at a cache path they never typed.
  176. MAPPING_LABEL="$(basename "$MAPPING")"
  177. # ---- decompress if needed --------------------------------------------------
  178. PARTITION=0
  179. case "$MAPPING" in
  180. *.prt) PARTITION=1 ;;
  181. *.gz)
  182. # Keyed on the full source path, not just the basename: two different
  183. # mappings are both called mapping.txt.gz if you gzip a playRelease and
  184. # an fdroidRelease by hand. (The map-id check below would catch the mixup
  185. # anyway, but "wrong release" is a much clearer error than a stale cache.)
  186. key="$(printf '%s' "$(cd "$(dirname "$MAPPING")" && pwd)/$(basename "$MAPPING")" | cksum | cut -d' ' -f1)"
  187. plain="$CACHE/$(basename "${MAPPING%.gz}").$key"
  188. if [ ! -s "$plain" ] || [ "$MAPPING" -nt "$plain" ]; then
  189. echo "decompressing $(basename "$MAPPING") ..." >&2
  190. gunzip -c "$MAPPING" > "$plain"
  191. fi
  192. MAPPING="$plain"
  193. ;;
  194. esac
  195. # ---- make sure this mapping really built this report ------------------------
  196. if [ "$PARTITION" -eq 0 ]; then
  197. HEADER="$(mapping_header "$MAPPING")"
  198. trace_id="$(grep -om1 'r8-map-id-[0-9a-f]\{16,\}' "$REPORT_FILE" | sed 's/^r8-map-id-//' || true)"
  199. map_id="$(printf '%s\n' "$HEADER" | sed -n 's/^# pg_map_id: *//p' | head -1 || true)"
  200. if [ -z "$trace_id" ]; then
  201. echo "note: no r8-map-id in the report (an un-obfuscated build, or a trimmed" >&2
  202. echo " trace) — cannot confirm the mapping matches." >&2
  203. elif [ "$trace_id" != "$map_id" ]; then
  204. msg="this mapping did not build this report.
  205. report: $trace_id
  206. mapping: $map_id ($MAPPING_LABEL)
  207. Retracing anyway yields wrong names that look right. Check the release
  208. tag and the flavor (play vs fdroid are separate R8 runs)."
  209. [ "$FORCE" -eq 1 ] && echo "warning: $msg" >&2 || die "$msg"
  210. fi
  211. fi
  212. # ---- fetch the R8 that wrote it ---------------------------------------------
  213. if [ "$PARTITION" -eq 1 ]; then
  214. R8_VERSION="${R8_VERSION:-$(ls "$CACHE"/r8-*.jar 2>/dev/null | sed 's/.*r8-\(.*\)\.jar/\1/' | sort -V | tail -1 || true)}"
  215. [ -n "$R8_VERSION" ] || die "a .prt partition map does not expose its R8 version.
  216. Set R8_VERSION=<x.y.z> (the 'compiler_version' of the matching
  217. mapping.txt), or retrace against the .txt.gz instead."
  218. else
  219. R8_VERSION="$(printf '%s\n' "${HEADER:-$(mapping_header "$MAPPING")}" | sed -n 's/^# compiler_version: *//p' | head -1 || true)"
  220. [ -n "$R8_VERSION" ] || die "no '# compiler_version:' header in $MAPPING — not an R8 mapping?"
  221. fi
  222. R8_JAR="$CACHE/r8-${R8_VERSION}.jar"
  223. if [ ! -s "$R8_JAR" ]; then
  224. echo "fetching R8 ${R8_VERSION} ..." >&2
  225. curl -fsSL -o "$R8_JAR.tmp" \
  226. "https://maven.google.com/com/android/tools/r8/${R8_VERSION}/r8-${R8_VERSION}.jar" \
    • Note: Links to a Windows program from code, which is how droppers fetch their payload
    • Line 245 on GitHub
  227. || { rm -f "$R8_JAR.tmp"; die "could not download R8 ${R8_VERSION} from Google's Maven"; }
  228. mv "$R8_JAR.tmp" "$R8_JAR"
  229. fi
  230. # ---- retrace ---------------------------------------------------------------
  231. # Not `exec`: exec replaces this shell, so the EXIT trap never runs and $TMP is
  232. # left behind on every single invocation.
  233. if [ "$PARTITION" -eq 1 ]; then
  234. java -cp "$R8_JAR" com.android.tools.r8.retrace.Retrace \
  235. --partition-map "$MAPPING" "$REPORT_FILE"
  236. else
  237. java -cp "$R8_JAR" com.android.tools.r8.retrace.Retrace \
  238. "$MAPPING" "$REPORT_FILE"
  239. fi

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.